def test_can_connect(database_client):
    ''' Tests whether we can connect to the mongo database at all.

    Test that we can read/write data on the database while we are at it.  This
    test assumes that the same information that is used in the mongodbhistorian
    will be able to used in this test.
    '''
    db = database_client[mongo_connection_params()['database']]
    result = db.test.insert_one({'x': 1})
    assert result > 0
    result = db.test.insert_one({'here': 'Data to search on'})
    assert result > 0

    result = db.test.find_one({'x': 1})
    assert result['x'] == 1
    result = db.test.find_one({'here': 'Data to search on'})
    assert result['here'] == 'Data to search on'
    assert db.test.remove()
    assert db.test.find().count() == 0
def test_can_connect(database_client):
    ''' Tests whether we can connect to the mongo database at all.

    Test that we can read/write data on the database while we are at it.  This
    test assumes that the same information that is used in the mongodbhistorian
    will be able to used in this test.
    '''
    db = database_client[mongo_connection_params()['database']]
    result = db.test.insert_one({'x': 1})
    assert result > 0
    result = db.test.insert_one({'here': 'Data to search on'})
    assert result > 0

    result = db.test.find_one({'x': 1})
    assert result['x'] == 1
    result = db.test.find_one({'here': 'Data to search on'})
    assert result['here'] == 'Data to search on'
    assert db.test.remove()
    assert db.test.find().count() == 0
def clean_db(client):
    db = client[mongo_connection_params()['database']]
    db['data'].drop()
    db['topics'].drop()
def clean_db(client):
    db = client[mongo_connection_params()['database']]
    db['data'].drop()
    db['topics'].drop()