Пример #1
0
        def topic(self, storages):
            file_storage, crypto_storage, detector_storage = storages
            storage = MixedStorage(None, file_storage, crypto_storage, detector_storage)
            storage.put('path1', 'contents')
            storage.put_crypto('path1')

            return storage
Пример #2
0
class MixedStorageFromConfTestCase(BaseMidexStorageTestCase):
    def get_context(self, *args, **kwargs):
        context = super(MixedStorageFromConfTestCase,
                        self).get_context(*args, **kwargs)
        self.storage = MixedStorage(context)
        return context

    @tornado.testing.gen_test
    def test_get_data(self):
        path = yield self.storage.get('path')
        file_storage, crypto_storage, detector_storage = self.get_storages()
        expect(self.storage.file_storage).to_be_instance_of(NoStorage)
        expect(path).to_be_null()

    @tornado.testing.gen_test
    def test_get_detector_data(self):
        path = yield self.storage.get_detector_data('path')
        expect(self.storage.detector_storage).to_be_instance_of(NoStorage)
        expect(path).to_be_null()

    @tornado.testing.gen_test
    def test_get_crypto(self):
        path = yield self.storage.get_crypto('path')
        expect(self.storage.crypto_storage).to_be_instance_of(NoStorage)
        expect(path).to_be_null()
Пример #3
0
 def get_context(self, *args, **kwargs):
     context = super(BaseMidexStorageTestCase, self).get_context(*args, **kwargs)
     self.storage = MixedStorage(None, *self.get_storages())
     self.storage.put('path1', 'contents')
     self.storage.put_crypto('path1')
     self.storage.put_detector_data('path1', 'detector')
     return context
Пример #4
0
 def get_context(self, *args, **kwargs):
     context = super(BaseMidexStorageTestCase, self).get_context(*args, **kwargs)
     self.storage = MixedStorage(None, *self.get_storages())
     self.storage.put('path1', 'contents')
     self.storage.put_crypto('path1')
     self.storage.put_detector_data('path1', 'detector')
     return context
Пример #5
0
        def topic(self, storages):
            file_storage, crypto_storage, detector_storage = storages
            storage = MixedStorage(None, file_storage, crypto_storage, detector_storage)

            storage.put("path1", "contents")
            storage.put_crypto("path1")
            storage.put_detector_data("path1", "detector")

            return storage
Пример #6
0
class MixedStorageFromConfTestCase(BaseMidexStorageTestCase):
    def get_context(self, *args, **kwargs):
        context = super(MixedStorageFromConfTestCase, self).get_context(*args, **kwargs)
        self.storage = MixedStorage(context)
        return context

    @tornado.testing.gen_test
    def test_get_data(self):
        path = yield self.storage.get('path')
        file_storage, crypto_storage, detector_storage = self.get_storages()
        expect(self.storage.file_storage).to_be_instance_of(NoStorage)
        expect(path).to_be_null()

    @tornado.testing.gen_test
    def test_get_detector_data(self):
        path = yield self.storage.get_detector_data('path')
        expect(self.storage.detector_storage).to_be_instance_of(NoStorage)
        expect(path).to_be_null()

    @tornado.testing.gen_test
    def test_get_crypto(self):
        path = yield self.storage.get_crypto('path')
        expect(self.storage.crypto_storage).to_be_instance_of(NoStorage)
        expect(path).to_be_null()
Пример #7
0
class BaseMidexStorageTestCase(TestCase):
    def get_storages(self):
        return Storage('security-key'), Storage('security-key'), Storage('detector')

    def get_context(self, *args, **kwargs):
        context = super(BaseMidexStorageTestCase, self).get_context(*args, **kwargs)
        self.storage = MixedStorage(None, *self.get_storages())
        self.storage.put('path1', 'contents')
        self.storage.put_crypto('path1')
        self.storage.put_detector_data('path1', 'detector')
        return context

    def get_server(self, *args, **kwargs):
        server = ServerParameters(8888, 'localhost', 'thumbor.conf', None, 'info', None)
        server.security_key = 'ACME-SEC'
        return server

    def get_importer(self, *args, **kwargs):
        return Importer(self.config)
Пример #8
0
class BaseMidexStorageTestCase(TestCase):
    def get_storages(self):
        return Storage('security-key'), Storage('security-key'), Storage('detector')

    def get_context(self, *args, **kwargs):
        context = super(BaseMidexStorageTestCase, self).get_context(*args, **kwargs)
        self.storage = MixedStorage(None, *self.get_storages())
        self.storage.put('path1', 'contents')
        self.storage.put_crypto('path1')
        self.storage.put_detector_data('path1', 'detector')
        return context

    def get_server(self, *args, **kwargs):
        server = ServerParameters(8888, 'localhost', 'thumbor.conf', None, 'info', None)
        server.security_key = 'ACME-SEC'
        return server

    def get_importer(self, *args, **kwargs):
        return Importer(self.config)
Пример #9
0
 def get_context(self, *args, **kwargs):
     context = super(MixedStorageFromConfTestCase,
                     self).get_context(*args, **kwargs)
     self.storage = MixedStorage(context)
     return context
Пример #10
0
 def get_context(self, *args, **kwargs):
     context = super(MixedStorageFromConfTestCase, self).get_context(*args, **kwargs)
     self.storage = MixedStorage(context)
     return context