Adds tests and some inline fixes in db pagination

Refactors the pagination code to be a bit more DRY and
gets the procession.db.api module up to 100% code coverage.
Merge pull request #9 from jaypipes/test-cleanups

Adds tests and some inline fixes in db pagination