Database setup and tests for it