예제 #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")
예제 #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")
예제 #3
0
def test_persist_will_accept_a_password_to_encrypt_the_store():
    """Tests that persist will accept a password and if provided
    the store will be encrypted using the password."""
    store = _create_store()
    store.persist("test.db", password="******")
    with pytest.raises(KeyError):
        store2 = data.store.load("test.db")
    store3 = data.store.load("test.db", password="******")
    assert store3 == store
예제 #4
0
def test_persist_will_persist_to_file_and_can_be_read_by_load():
    """Tests that the Store's persist method will persist the Store
    to a file, and that the file can be read and loaded by using
    the load function."""
    filename = os.path.join(tempfile.gettempdir(), "testdb")
    store = _create_store()
    store.persist(filename)
    store2 = data.store.load(filename)
    assert store == store2
예제 #5
0
def test_persist_will_accept_a_password_to_encrypt_the_store():
    """Tests that persist will accept a password and if provided
    the store will be encrypted using the password."""
    store = _create_store()
    store.persist("test.db", password="******")
    with pytest.raises(KeyError):
        store2 = data.store.load("test.db")
    store3 = data.store.load("test.db", password="******")
    assert store3 == store
예제 #6
0
def test_persist_will_persist_to_file_and_can_be_read_by_load():
    """Tests that the Store's persist method will persist the Store
    to a file, and that the file can be read and loaded by using
    the load function."""
    filename = os.path.join(tempfile.gettempdir(), "testdb")
    store = _create_store()
    store.persist(filename)
    store2 = data.store.load(filename)
    assert store == store2