Merge pull request #1246 from toopay/db-tests

Improved test coverage for Database.