def test_can_get_crypto(self):
        key = '/some/path/to/file.jpg'
        storage = Storage(self.context)
        self.memcached.set(storage.crypto_key_for(key), 'test-crypto-data')

        data = storage.get_crypto(key).result()
        expect(data).to_equal('test-crypto-data')
    def test_can_get_crypto(self):
        key = '/some/path/to/file.jpg'
        storage = Storage(self.context)
        self.memcached.set(storage.crypto_key_for(key), 'test-crypto-data')

        data = storage.get_crypto(key).result()
        expect(data).to_equal('test-crypto-data')
    def test_get_crypto_when_not_storing_crypto_for_each_image(self):
        ctx = mock.Mock(config=mock.Mock(
            MEMCACHE_STORAGE_SERVERS=[
                'localhost:5555',
            ],
            STORAGE_EXPIRATION_SECONDS=120,
            STORES_CRYPTO_KEY_FOR_EACH_IMAGE=False,
        ))

        storage = Storage(ctx)
        data = storage.get_crypto('/some/path/to/file.jpg').result()
        expect(data).to_be_null()
    def test_get_crypto_when_not_storing_crypto_for_each_image(self):
        ctx = mock.Mock(
            config=mock.Mock(
                MEMCACHE_STORAGE_SERVERS=[
                    'localhost:5555',
                ],
                STORAGE_EXPIRATION_SECONDS=120,
                STORES_CRYPTO_KEY_FOR_EACH_IMAGE=False,
            )
        )

        storage = Storage(ctx)
        data = storage.get_crypto('/some/path/to/file.jpg').result()
        expect(data).to_be_null()