Пример #1
0
def test_update_one_error_db():
    """test_update_one_error_db"""
    mongo_db_access = MongoDBAccess(CONFIG_ERROR, "DEBUG")
    res = mongo_db_access.update_one("testUpdateone_error_db", {"clave": "IP"},
                                     {'valorX': "1234"})

    assert res is None
Пример #2
0
def test_update_one_error_find():
    """test_update_one_error_find"""
    mongo_db_access = MongoDBAccess(CONFIG, "DEBUG")
    mongo_db_access.insert("testUpdateone_errorFind",\
                                        {"clave":"IPUpdateOne", "value":0})
    res = mongo_db_access.update_one("testUpdateone_errorFind",\
                                     {"clave":"IPFind"}, {'valorX':"1234"})
    mongo_db_access.drop("testUpdateone_errorFind")

    assert res.modified_count == 0
Пример #3
0
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