Add unit tests to database.py