def test_dbmanager_users(): """ Tests the user section of the database """ test_user = { 'username': '******', 'jobs': 0, 'reputation': 10 } if DBManager.is_user(test_user['username']): DBManager.del_user(test_user['username']) DBManager.add_user(test_user['username'], test_user['jobs'], test_user['reputation']) assert DBManager.is_user(test_user['username']) get_test_user = DBManager.get_user(test_user['username']) assert get_test_user['reputation'] == test_user['reputation'] DBManager.update_user(test_user['username'], 20, test_user['reputation']) get_test_user = DBManager.get_user(test_user['username']) assert get_test_user['jobs'] == 20 DBManager.del_user(test_user['username']) assert DBManager.is_user(test_user['username']) is False
def test_usermanager_reputation(): """ Setups tests the user managers reputation function """ test_user = { "username": "******", "jobs": 1, "reputation": int(Config.get("reputation", "TrustedLevel")) + 1, } DBManager.add_user(test_user["username"], test_user["jobs"], test_user["reputation"]) rep_level = UserManager.get_rep_level(test_user["username"]) assert rep_level == "Very Trusted"