Fixes bug 899174 Update SignatureSummary middleware

* Refine the SQL for SignatureSummary middleware
* Added a connection close() because we aren't using the base class query()
* Adding tests for SignatureSummary* middleware calls
Fixes 899174 r=@gabithume, @peterbe, @brandonsavage

* PEP8 fixes
* Cleanup of debugging
* Refactor tests to use a dict and a loop
* Remove signatures subselect
* Be sure to truncate all tables in tests
Merge pull request #1377 from selenamarie/bug899174-sigsum-middleware

Fixes bug 899174 update SignatureSummary middleware