1030905 more api tests

Add api tests for filtering by date.
Also edited code for pep8 compliance for quality.
I don't believe it actually is sorted by default. When you remove this line the tests will fail intermittently.