moved tests from db.py to tests.py
moved db lookup functions to db.py and made better tests