def topic(self): conf = Config(MONGO_STORAGE_SERVER_PORT=7777, STORES_CRYPTO_KEY_FOR_EACH_IMAGE=True) server = get_server('ACME-SEC') storage = MongoStorage(Context(config=conf, server=server)) storage.put(IMAGE_URL % 6, IMAGE_BYTES) return storage.get_crypto(IMAGE_URL % 6)
def topic(self): storage = MongoStorage( Context( config=Config(MONGO_STORAGE_SERVER_PORT=7777, STORES_CRYPTO_KEY_FOR_EACH_IMAGE=True, SECURITY_KEY='ACME-SEC'))) return storage.get_crypto(IMAGE_URL % 7)
def topic(self): conf = Config(MONGO_STORAGE_SERVER_PORT=7777, STORES_CRYPTO_KEY_FOR_EACH_IMAGE=False, SECURITY_KEY='ACME-SEC') storage = MongoStorage(Context(config=conf)) storage.put(IMAGE_URL % 12, IMAGE_BYTES) storage.put_crypto(IMAGE_URL % 12) item = storage.get_crypto(IMAGE_URL % 12) return item
def topic(self): storage = MongoStorage( Context(config=Config( MONGO_STORAGE_SERVER_PORT=7777, STORES_CRYPTO_KEY_FOR_EACH_IMAGE=True, SECURITY_KEY='ACME-SEC') ) ) return storage.get_crypto(IMAGE_URL % 7)
def test_get_crypto_for_url(self): rm_storage() image_url = 'www.globo.com/media/globocom/img/sprite1.png' http_loaded = http.load(image_url) storage = Storage() storage.put(image_url, http_loaded) assert storage.get_crypto(image_url) == options.SECURITY_KEY
def topic(self): conf = Config(MONGO_STORAGE_SERVER_PORT=7777, STORES_CRYPTO_KEY_FOR_EACH_IMAGE=False, SECURITY_KEY='ACME-SEC') storage = MongoStorage(Context(config=conf)) storage.put(IMAGE_URL % 12, IMAGE_BYTES) storage.put_crypto(IMAGE_URL % 12) item = storage.get_crypto(IMAGE_URL % 12) return item.result()
def topic(self): conf = Config(MONGO_STORAGE_SERVER_PORT=7777, STORES_CRYPTO_KEY_FOR_EACH_IMAGE=False) server = get_server('ACME-SEC') storage = MongoStorage(Context(config=conf, server=server)) storage.put(IMAGE_URL % 11, IMAGE_BYTES) conf.STORES_CRYPTO_KEY_FOR_EACH_IMAGE = True storage.put_crypto(IMAGE_URL % 11) item = storage.get_crypto(IMAGE_URL % 11) return item.result()
def test_get_crypto_for_url_returns_None_if_urls_was_never_seen(self): rm_storage() image_url = 'www.globo.com/media/globocom/img/sprite1.png' storage = Storage() assert not storage.get_crypto(image_url)