def test_update_one_ok(): """test_update_one_ok""" mongo_db_access = MongoDBAccess(CONFIG, "DEBUG") mongo_db_access.insert("testUpdateOne", { "clave": "IPUpdateOne", "value": 0 }) res_update1 = mongo_db_access.update_one("testUpdateOne", {"clave": "IPUpdateOne"}, {'value': 1}) res_find1 = mongo_db_access.find_one("testUpdateOne", {"clave": "IPUpdateOne"}) mongo_db_access.delete_one("testUpdateOne", {"clave": "IPUpdateOne"}) mongo_db_access.drop("testUpdateOne") assert res_update1 != None assert res_find1['value'] == 1
def test_insert_ok(): """test_insert_ok""" mongo_db_access = MongoDBAccess(CONFIG, "DEBUG") res_insert = mongo_db_access.insert("testInsert_ok", {"clave": "IPInsert"}) res_find1 = mongo_db_access.find_one("testInsert_ok", {"clave": "IPInsert"}) assert res_insert != None assert res_find1['clave'] == "IPInsert" res_remove = mongo_db_access.delete_one("testInsert_ok", {"clave": "IPInsert"}) res_find2 = mongo_db_access.find_one("testInsert_ok", {"clave": "IPInsert"}) mongo_db_access.drop("testInsert_ok") assert res_remove.deleted_count == 1 assert res_find2 is None