Added some tests on database functionality