Пример #1
0
def test_find_one_accepts_argument_to_encrypt_fields():
    """Tests that the Store's find_one method will accept an encrypt_list
    parameter and that any field named in the list will be encrypted
    with password."""
    store = _create_store()
    record = store.find_one({"that": "foo"}, encrypt_list=["this"], password="******")
    assert record["this"] != store.find_one({"that": "foo"})["this"]
    assert decrypt(record["this"], key="password") == store.find_one({"that": "foo"})["this"]
Пример #2
0
def test_find_accepts_argument_to_encrypt_list():
    """Tests that the Store's find method will accept an encrypt_list
    parameter and that any field named in the list will be encrypted
    with password."""
    store = _create_store()
    results = store.find({}, encrypt_list=["this"], password="******")
    assert isinstance(results, Store)
    for index, record in enumerate(results):
        assert record["this"] != store[index]["this"]
        assert decrypt(record["this"], key="password") == store[index]["this"]
Пример #3
0
def test_find_accepts_argument_to_encrypt_list():
    """Tests that the Store's find method will accept an encrypt_list
    parameter and that any field named in the list will be encrypted
    with password."""
    store = _create_store()
    results = store.find({}, encrypt_list=["this"], password="******")
    assert isinstance(results, Store)
    for index, record in enumerate(results):
        assert record["this"] != store[index]["this"]
        assert decrypt(record["this"], key="password") == store[index]["this"]
Пример #4
0
def test_find_one_accepts_argument_to_encrypt_fields():
    """Tests that the Store's find_one method will accept an encrypt_list
    parameter and that any field named in the list will be encrypted
    with password."""
    store = _create_store()
    record = store.find_one({"that": "foo"},
                            encrypt_list=["this"],
                            password="******")
    assert record["this"] != store.find_one({"that": "foo"})["this"]
    assert decrypt(record["this"],
                   key="password") == store.find_one({"that": "foo"})["this"]