def test_db_write(database_name, collection_name):
    db = connect_database()
    nb_doc_before = db[collection_name].count_documents({})

    db_write_message = "Hola"
    db_write(db_write_message, database_name, collection_name)

    nb_doc_after = db[collection_name].count_documents({})

    assert nb_doc_after - 1 == nb_doc_before
Example #2
0
def test_write_message_in_database(database_name, collection_name):
    db = connect_database(database_name)

    nb_doc_before = db[collection_name].count_documents({})

    message = "hola"
    write_message_in_database(message, database_name, collection_name)

    nb_doc_after = db[collection_name].count_documents({})

    assert nb_doc_before == nb_doc_after - 1
Example #3
0
def test_connect_database():
    db = connect_database("nestor")
    assert db is not None
Example #4
0
def test_connect_database():
    db = connect_database("root", "")
    assert db is not None
def test_connect_database():
    conection = connect_database()
    assert conection is not None