コード例 #1
0
    def test_configure_registry_client_not_using_use_user_token(self):
        self.config(use_user_token=False)
        self.mox.StubOutWithMock(rapi, 'configure_registry_admin_creds')
        rapi.configure_registry_admin_creds()

        self.mox.ReplayAll()

        rapi.configure_registry_client()
        self.mox.VerifyAll()
コード例 #2
0
    def test_configure_registry_admin_creds_with_auth_url(self):
        expected = self._get_fake_config_creds()
        self.config(admin_user=expected['user'])
        self.config(admin_password=expected['password'])
        self.config(admin_tenant_name=expected['tenant'])
        self.config(auth_url=expected['auth_url'])
        self.config(auth_strategy='test_strategy')
        self.config(auth_region=expected['region'])

        self.assertIsNone(rapi._CLIENT_CREDS)
        rapi.configure_registry_admin_creds()
        self.assertEqual(expected, rapi._CLIENT_CREDS)
コード例 #3
0
    def test_configure_registry_admin_creds_with_auth_url(self):
        expected = self._get_fake_config_creds()
        self.config(admin_user=expected['user'])
        self.config(admin_password=expected['password'])
        self.config(admin_tenant_name=expected['tenant'])
        self.config(auth_url=expected['auth_url'])
        self.config(auth_strategy='test_strategy')
        self.config(auth_region=expected['region'])

        self.assertEquals(rapi._CLIENT_CREDS, None)
        rapi.configure_registry_admin_creds()
        self.assertEquals(rapi._CLIENT_CREDS, expected)
コード例 #4
0
    def test_configure_registry_admin_creds_with_auth_url(self):
        expected = self._get_fake_config_creds()
        self.config(admin_user=expected["user"])
        self.config(admin_password=expected["password"])
        self.config(admin_tenant_name=expected["tenant"])
        self.config(auth_url=expected["auth_url"])
        self.config(auth_strategy="test_strategy")
        self.config(auth_region=expected["region"])

        self.assertEqual(rapi._CLIENT_CREDS, None)
        rapi.configure_registry_admin_creds()
        self.assertEqual(rapi._CLIENT_CREDS, expected)
コード例 #5
0
    def test_configure_registry_admin_creds(self):
        expected = self._get_fake_config_creds(auth_url=None, strategy="configured_strategy")
        self.config(admin_user=expected["user"])
        self.config(admin_password=expected["password"])
        self.config(admin_tenant_name=expected["tenant"])
        self.config(auth_strategy=expected["strategy"])
        self.config(auth_region=expected["region"])
        self.stubs.Set(os, "getenv", lambda x: None)

        self.assertEqual(rapi._CLIENT_CREDS, None)
        rapi.configure_registry_admin_creds()
        self.assertEqual(rapi._CLIENT_CREDS, expected)
コード例 #6
0
    def test_configure_registry_admin_creds(self):
        expected = self._get_fake_config_creds(auth_url=None,
                                               strategy='configured_strategy')
        self.config(admin_user=expected['user'])
        self.config(admin_password=expected['password'])
        self.config(admin_tenant_name=expected['tenant'])
        self.config(auth_strategy=expected['strategy'])
        self.config(auth_region=expected['region'])
        self.stubs.Set(os, 'getenv', lambda x: None)

        self.assertIsNone(rapi._CLIENT_CREDS)
        rapi.configure_registry_admin_creds()
        self.assertEqual(expected, rapi._CLIENT_CREDS)
コード例 #7
0
    def test_configure_registry_admin_creds(self):
        expected = self._get_fake_config_creds(auth_url=None,
                                               strategy='configured_strategy')
        self.config(admin_user=expected['user'])
        self.config(admin_password=expected['password'])
        self.config(admin_tenant_name=expected['tenant'])
        self.config(auth_strategy=expected['strategy'])
        self.config(auth_region=expected['region'])
        self.stubs.Set(os, 'getenv', lambda x: None)

        self.assertEquals(rapi._CLIENT_CREDS, None)
        rapi.configure_registry_admin_creds()
        self.assertEquals(rapi._CLIENT_CREDS, expected)
コード例 #8
0
    def test_configure_registry_admin_creds_with_auth_url(self):
        expected = {
            'user': '******',
            'password': '******',
            'username': '******',
            'tenant': 'tenant',
            'auth_url': 'auth_url',
            'strategy': 'keystone',
            'region': 'region',
        }
        self.config(admin_user=expected['user'])
        self.config(admin_password=expected['password'])
        self.config(admin_tenant_name=expected['tenant'])
        self.config(auth_url=expected['auth_url'])
        self.config(auth_strategy='test_strategy')
        self.config(auth_region=expected['region'])

        self.assertEquals(rapi._CLIENT_CREDS, None)
        rapi.configure_registry_admin_creds()
        self.assertEquals(rapi._CLIENT_CREDS, expected)
コード例 #9
0
    def test_configure_registry_admin_creds(self):
        expected = {
            'user': '******',
            'password': '******',
            'username': '******',
            'tenant': 'tenant',
            'auth_url': None,
            'strategy': 'configured_strategy',
            'region': 'region',
        }
        self.config(admin_user=expected['user'])
        self.config(admin_password=expected['password'])
        self.config(admin_tenant_name=expected['tenant'])
        self.config(auth_strategy=expected['strategy'])
        self.config(auth_region=expected['region'])
        self.stubs.Set(os, 'getenv', lambda x: None)

        self.assertEquals(rapi._CLIENT_CREDS, None)
        rapi.configure_registry_admin_creds()
        self.assertEquals(rapi._CLIENT_CREDS, expected)
コード例 #10
0
ファイル: test_registry_client.py プロジェクト: Gwen2/glance
    def test_configure_registry_admin_creds_with_auth_url(self):
        expected = {
            'user': '******',
            'password': '******',
            'username': '******',
            'tenant': 'tenant',
            'auth_url': 'auth_url',
            'strategy': 'keystone',
            'region': 'region',
        }
        self.config(admin_user=expected['user'])
        self.config(admin_password=expected['password'])
        self.config(admin_tenant_name=expected['tenant'])
        self.config(auth_url=expected['auth_url'])
        self.config(auth_strategy='test_strategy')
        self.config(auth_region=expected['region'])

        self.assertEquals(rapi._CLIENT_CREDS, None)
        rapi.configure_registry_admin_creds()
        self.assertEquals(rapi._CLIENT_CREDS, expected)
コード例 #11
0
ファイル: test_registry_client.py プロジェクト: Gwen2/glance
    def test_configure_registry_admin_creds(self):
        expected = {
            'user': '******',
            'password': '******',
            'username': '******',
            'tenant': 'tenant',
            'auth_url': None,
            'strategy': 'configured_strategy',
            'region': 'region',
        }
        self.config(admin_user=expected['user'])
        self.config(admin_password=expected['password'])
        self.config(admin_tenant_name=expected['tenant'])
        self.config(auth_strategy=expected['strategy'])
        self.config(auth_region=expected['region'])
        self.stubs.Set(os, 'getenv', lambda x: None)

        self.assertEquals(rapi._CLIENT_CREDS, None)
        rapi.configure_registry_admin_creds()
        self.assertEquals(rapi._CLIENT_CREDS, expected)