コード例 #1
0
ファイル: test_Store.py プロジェクト: iLoveTux/data_store
 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
ファイル: test_Store.py プロジェクト: lowks/data_store
 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
ファイル: test_Store.py プロジェクト: iLoveTux/data_store
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
ファイル: test_Store.py プロジェクト: iLoveTux/data_store
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
ファイル: test_Store.py プロジェクト: lowks/data_store
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
ファイル: test_Store.py プロジェクト: lowks/data_store
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