Esempio n. 1
0
    def setUp2(self, backend_class, backend_fs_name):
        
        options = Namespace()
        options.no_ssl = False
        options.ssl_ca_path = None

        (backend_login, backend_password,
         fs_name) = get_remote_test_info(backend_fs_name, self.skipTest)
        
        self.backend = backend_class(fs_name, backend_login, backend_password,
                                     ssl_context=get_ssl_context(options))

        try:
            self.backend.fetch('empty_object')
        except DanglingStorageURLError:
            raise unittest.SkipTest('Bucket %s does not exist' % fs_name) from None
        except AuthorizationError:
            raise unittest.SkipTest('No permission to access %s' % fs_name) from None
        except AuthenticationError:
            raise unittest.SkipTest('Unable to access %s, invalid credentials or skewed '
                                    'system clock?' % fs_name) from None
        except NoSuchObject:
            pass
        else:
            raise unittest.SkipTest('Test bucket not empty') from None
Esempio n. 2
0
 def setup_method(self, method, name):
     super().setup_method(method)
     try:
         (backend_login, backend_pw,
          self.storage_url) = get_remote_test_info(name)
     except NoTestSection as exc:
         pytest.skip(exc.reason)
     self.backend_login = backend_login
     self.backend_passphrase = backend_pw
Esempio n. 3
0
 def setup_method(self, method, name):
     super().setup_method(method)
     try:
         (backend_login, backend_pw,
          self.storage_url) = get_remote_test_info(name)
     except NoTestSection as exc:
         pytest.skip(exc.reason)
     self.backend_login = backend_login
     self.backend_passphrase = backend_pw
Esempio n. 4
0
    def setUp(self):
        super().setUp()
        (backend_login, backend_pw,
         self.storage_url) = get_remote_test_info('gs-test', self.skipTest)
        self.backend_login = backend_login
        self.backend_passphrase = backend_pw

        options = Namespace()
        options.no_ssl = False
        options.ssl_ca_path = None

        self.backend = gs.Backend(self.storage_url, backend_login, backend_pw,
                                  ssl_context=get_ssl_context(options))
Esempio n. 5
0
    def setup_method(self, method):
        super().setup_method(method)
        try:
            (backend_login, backend_pw,
             self.storage_url) = get_remote_test_info('gs-test')
        except NoTestSection as exc:
            super().teardown_method(method)
            pytest.skip(exc.reason)

        self.backend_login = backend_login
        self.backend_passphrase = backend_pw

        self.backend = gs.Backend(Namespace(
            storage_url=self.storage_url, backend_login=backend_login,
            backend_password=backend_pw, backend_options={}))
Esempio n. 6
0
    def setUp(self):
        super().setUp()
        (backend_login, backend_pw,
         self.storage_url) = get_remote_test_info('gs-test', self.skipTest)
        self.backend_login = backend_login
        self.backend_passphrase = backend_pw

        options = Namespace()
        options.no_ssl = False
        options.ssl_ca_path = None

        self.backend = gs.Backend(self.storage_url,
                                  backend_login,
                                  backend_pw,
                                  ssl_context=get_ssl_context(options))
Esempio n. 7
0
def _get_backend_info():
    '''Get information about raw backends available for testing'''

    info = []

    # Local backend
    bi = Namespace()
    bi.name = 'local'
    bi.classname = 'local'
    info.append(bi)

    # Backends talking to actual remote servers (if available)
    for name in backends.prefix_map:
         if name == 'local': # local backend has already been handled
             continue

         try:
             (login, password,
              storage_url) = get_remote_test_info(name + '-test')
         except NoTestSection as exc:
             log.info('Not running remote tests for %s backend: %s',
                      name, exc.reason)
             continue

         bi = Namespace()
         bi.name = 'remote-' + name
         bi.classname = name
         bi.storage_url = storage_url
         bi.login = login
         bi.password = password
         info.append(bi)

    # Backends talking to local mock servers
    for (request_handler, storage_url) in mock_server.handler_list:
        name = re.match(r'^([a-zA-Z0-9]+)://', storage_url).group(1)
        bi = Namespace()
        bi.name = 'mock-' + name
        bi.classname = name
        bi.request_handler = request_handler
        bi.storage_url = storage_url
        info.append(bi)

    return info
Esempio n. 8
0
def _get_backend_info():
    '''Get information about raw backends available for testing'''

    info = []

    # Local backend
    bi = Namespace()
    bi.name = 'local'
    bi.classname = 'local'
    info.append(bi)

    # Backends talking to actual remote servers (if available)
    for name in backends.prefix_map:
        if name == 'local':  # local backend has already been handled
            continue

        try:
            (login, password,
             storage_url) = get_remote_test_info(name + '-test')
        except NoTestSection as exc:
            log.info('Not running remote tests for %s backend: %s', name,
                     exc.reason)
            continue

        bi = Namespace()
        bi.name = 'remote-' + name
        bi.classname = name
        bi.storage_url = storage_url
        bi.login = login
        bi.password = password
        info.append(bi)

    # Backends talking to local mock servers
    for (request_handler, storage_url) in mock_server.handler_list:
        name = re.match(r'^([a-zA-Z0-9]+)://', storage_url).group(1)
        bi = Namespace()
        bi.name = 'mock-' + name
        bi.classname = name
        bi.request_handler = request_handler
        bi.storage_url = storage_url
        info.append(bi)

    return info
Esempio n. 9
0
    def setUp2(self, backend_class, backend_fs_name):

        options = Namespace()
        options.no_ssl = False
        options.ssl_ca_path = None

        (backend_login, backend_password, fs_name) = get_remote_test_info(backend_fs_name, self.skipTest)

        self.backend = backend_class(fs_name, backend_login, backend_password, ssl_context=get_ssl_context(options))

        try:
            self.backend.fetch("empty_object")
        except DanglingStorageURLError:
            raise unittest.SkipTest("Bucket %s does not exist" % fs_name) from None
        except AuthorizationError:
            raise unittest.SkipTest("No permission to access %s" % fs_name) from None
        except AuthenticationError:
            raise unittest.SkipTest(
                "Unable to access %s, invalid credentials or skewed " "system clock?" % fs_name
            ) from None
        except NoSuchObject:
            pass
        else:
            raise unittest.SkipTest("Test bucket not empty") from None
Esempio n. 10
0
 def setUp(self, name):
     super().setUp()
     (backend_login, backend_pw,
      self.storage_url) = get_remote_test_info(name, self.skipTest)
     self.backend_login = backend_login
     self.backend_passphrase = backend_pw