Improved test coverage of database module