collective/collective.solr — pull request #40 by do3cc (2014-12-30 11:06:40+00:00)
Title: Refactor solr search results + pep8 + plone.app.testing

Sorry for this convoluted PR.
The responsability to transform a normal search to a solr search were quite convoluted. I moved the responsability to the search utility. This way, one can reuse this code much easier, which is what I need for a third party package.
Even though my changes were fine, a huge number of tests failed.
It turned out that the brittleness and missing test isolation of PloneTestCase were the cause of it and soon I ended up converting all tests to plone.app.testing. The biggest change here here was that plone.app.testing does not create a lot of test content to play with, so I had to recreate this so that I don't have to change the tests tooo much. Else real failures might have been hidden by rewriting tests.
After that I checked that all files that I have modified pass code-analysis.
solrSearchResults has a too high complexity according to the rules. The complexity stems from the fact that it has to handle many different ways to get called and it does not much else. So instead of doing an ill refactoring to hide the complexity, I just marked tha method as # noQa.
Other methods in code I touched also have a too high complexity alert. I did not mark them with noqa because I did not evaluate properly whether the need refactoring or not.
@saily