refactored the database tests to be more coherent, and more closely resemble unit tests