Пример #1
0
def test_put_decryption_materials():
    cache_key = b'ex_cache_key'
    value = MagicMock(__class__=DecryptionMaterials)
    check_value = CryptoMaterialsCacheEntry(cache_key=cache_key, value=value)
    cache = NullCryptoMaterialsCache()

    test = cache.put_decryption_materials(cache_key=cache_key,
                                          decryption_materials=value)

    assert test == check_value
Пример #2
0
def test_put_encryption_materials():
    cache_key = b'ex_cache_key'
    value = MagicMock(__class__=EncryptionMaterials)
    check_value = CryptoMaterialsCacheEntry(cache_key=cache_key, value=value)
    cache = NullCryptoMaterialsCache()

    test = cache.put_encryption_materials(cache_key=cache_key,
                                          encryption_materials=value,
                                          plaintext_length=0,
                                          entry_hints=None)

    assert test == check_value
Пример #3
0
def test_gets(method_name, args):
    test = NullCryptoMaterialsCache()

    with pytest.raises(CacheKeyError) as excinfo:
        getattr(test, method_name)(*args)

    excinfo.match(r'Key not found in cache')