Exemple #1
0
def test_counter_must_return_changed_value_after_document_adding(db):
    c = db.collection1

    c.insert({'_id':1})
    assert last_id_for(c) == 1

    c.insert({'_id':100})
    assert last_id_for(c) == 100
Exemple #2
0
def test_counter_must_return_max_value(db):
    c1 = db.collection1
    c2 = db.collection2

    c1.insert({'_id':1})
    c1.insert({'_id':2})

    c2.insert({'_id':50})

    assert last_id_for(c1) == 2
    assert last_id_for(c2) == 50
Exemple #3
0
def test_counter_must_return_zero_for_nonexisting_keys(db):
    assert last_id_for(db.some_collection1) == 0