Ejemplo n.º 1
0
 def run(self):
     for x in xrange(10):
         sx = str(x)
         record = store.add_record({"name": sx, "email": sx})
         store.persist("tmp.db")
         store.del_record(record)
         store.persist("tmp.db")
Ejemplo n.º 2
0
 def run(self):
     for x in xrange(10):
         sx = str(x)
         record = store.add_record({"name": sx, "email": sx})
         store.persist("tmp.db")
         store.del_record(record)
         store.persist("tmp.db")
Ejemplo n.º 3
0
 def add_delete():
     for x in xrange(10):
         sx = str(x)
         record = store.add_record({
             "name": sx,
             "email": "{}@example.com".format(sx)
         })
         store.del_record(record)
Ejemplo n.º 4
0
def test_del_record_removes_a_record():
    """Tests that del_record will remove a record from the Store."""
    store = Store()

    store.add_record({"this": "that", "that": "foo"})
    assert len(store) == 1
    store.del_record({"this": "that", "that": "foo"})
    assert len(store) == 0
Ejemplo n.º 5
0
def test_del_record_removes_a_record():
    """Tests that del_record will remove a record from the Store."""
    store = Store()

    store.add_record({"this": "that", "that": "foo"})
    assert len(store) == 1
    store.del_record({"this": "that", "that": "foo"})
    assert len(store) == 0
Ejemplo n.º 6
0
def test_del_record_raises_ValueError_if_record_doesnt_exist():
    """Tests that del_record will raise a ValueError if the
    record doesn't exist."""
    store = _create_store()
    with pytest.raises(ValueError):
        store.del_record({"_id": 1})
Ejemplo n.º 7
0
 def add_delete():
     for x in xrange(10):
         sx = str(x)
         record = store.add_record({"name": sx, "email": "{}@example.com".format(sx)})
         store.del_record(record)
Ejemplo n.º 8
0
def test_del_record_raises_ValueError_if_record_doesnt_exist():
    """Tests that del_record will raise a ValueError if the
    record doesn't exist."""
    store = _create_store()
    with pytest.raises(ValueError):
        store.del_record({"_id": 1})