本文整理汇总了Python中tempest.tests.fake_http.fake_httplib2函数的典型用法代码示例。如果您正苦于以下问题:Python fake_httplib2函数的具体用法?Python fake_httplib2怎么用?Python fake_httplib2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fake_httplib2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
super(TestTenantIsolation, self).setUp()
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
self.stubs.Set(http.ClosingHttp, 'request',
fake_identity._fake_v2_response)
示例2: setUp
def setUp(self):
super(TestTenantIsolation, self).setUp()
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, "TempestConfigPrivate", fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
self.stubs.Set(json_token_client.TokenClientJSON, "raw_request", fake_identity._fake_v2_response)
cfg.CONF.set_default("operator_role", "FakeRole", group="object-storage")
示例3: setUp
def setUp(self):
self.fake_http = fake_http.fake_httplib2()
super(TestNegativeRestClient, self).setUp()
self.negative_rest_client = rest_client.NegativeRestClient(
fake_auth_provider.FakeAuthProvider())
self.useFixture(mockpatch.PatchObject(self.negative_rest_client,
'_log_request'))
示例4: setUp
def setUp(self):
super(BaseAuthTestsSetUp, self).setUp()
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
self.stubs.Set(http.ClosingHttp, 'request', self.fake_http.request)
self.auth_provider = self._auth(self.credentials)
示例5: setUp
def setUp(self):
super(BaseAuthTestsSetUp, self).setUp()
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
self.stubs.Set(auth, 'get_credentials', fake_get_credentials)
self.stubs.Set(auth, 'get_default_credentials',
fake_get_default_credentials)
self.auth_provider = self._auth(self.credentials)
示例6: setUp
def setUp(self):
super(TestTenantIsolation, self).setUp()
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
self.stubs.Set(http.ClosingHttp, 'request',
fake_identity._fake_v2_response)
cfg.CONF.set_default('operator_role', 'FakeRole',
group='object-storage')
示例7: setUp
def setUp(self):
self.fake_http = fake_http.fake_httplib2()
super(TestNegativeRestClient, self).setUp()
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.stubs.Set(httplib2.Http, 'request', self.fake_http.request)
self.negative_rest_client = negative_rest_client.NegativeRestClient(
fake_auth_provider.FakeAuthProvider(), None)
self.useFixture(mockpatch.PatchObject(self.negative_rest_client,
'_log_request'))
示例8: setUp
def setUp(self):
super(TestDynamicCredentialProvider, self).setUp()
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
self.stubs.Set(json_token_client.TokenClient, 'raw_request',
fake_identity._fake_v2_response)
cfg.CONF.set_default('operator_role', 'FakeRole',
group='object-storage')
self._mock_list_ec2_credentials('fake_user_id', 'fake_tenant_id')
示例9: setUp
def setUp(self):
super(TestGlanceHTTPClient, self).setUp()
self.fake_http = fake_http.fake_httplib2(return_type=200)
# NOTE(maurosr): using http here implies that we will be using httplib
# directly. With https glance_client would use an httpS version, but
# the real backend would still be httplib anyway and since we mock it
# that there is no reason to care.
self.endpoint = 'http://fake_url.com'
self.fake_auth = fake_auth_provider.FakeAuthProvider()
self.fake_auth.base_url = mock.MagicMock(return_value=self.endpoint)
self.useFixture(mockpatch.PatchObject(httplib.HTTPConnection,
'request',
side_effect=self.fake_http.request(self.endpoint)[1]))
self.client = glance_http.HTTPClient(self.fake_auth, {})
示例10: setUp
def setUp(self):
super(TestAccount, self).setUp()
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, "TempestConfigPrivate", fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
self.stubs.Set(token_client.TokenClientJSON, "raw_request", fake_identity._fake_v2_response)
self.useFixture(lockutils_fixtures.ExternalLockFixture())
self.test_accounts = [
{"username": "test_user1", "tenant_name": "test_tenant1", "password": "p"},
{"username": "test_user2", "tenant_name": "test_tenant2", "password": "p"},
{"username": "test_user3", "tenant_name": "test_tenant3", "password": "p"},
{"username": "test_user4", "tenant_name": "test_tenant4", "password": "p"},
{"username": "test_user5", "tenant_name": "test_tenant5", "password": "p"},
{"username": "test_user6", "tenant_name": "test_tenant6", "password": "p", "roles": ["role1", "role2"]},
{"username": "test_user7", "tenant_name": "test_tenant7", "password": "p", "roles": ["role2", "role3"]},
{"username": "test_user8", "tenant_name": "test_tenant8", "password": "p", "roles": ["role4", "role1"]},
{
"username": "test_user9",
"tenant_name": "test_tenant9",
"password": "p",
"roles": ["role1", "role2", "role3", "role4"],
},
{
"username": "test_user10",
"tenant_name": "test_tenant10",
"password": "p",
"roles": ["role1", "role2", "role3", "role4"],
},
{
"username": "test_user11",
"tenant_name": "test_tenant11",
"password": "p",
"roles": [cfg.CONF.identity.admin_role],
},
{
"username": "test_user12",
"tenant_name": "test_tenant12",
"password": "p",
"roles": [cfg.CONF.identity.admin_role],
},
]
self.accounts_mock = self.useFixture(
mockpatch.Patch("tempest.common.accounts.read_accounts_yaml", return_value=self.test_accounts)
)
cfg.CONF.set_default("test_accounts_file", "fake_path", group="auth")
self.useFixture(mockpatch.Patch("os.path.isfile", return_value=True))
示例11: setUp
def setUp(self):
super(TestAccount, self).setUp()
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
self.stubs.Set(token_client.TokenClientJSON, 'raw_request',
fake_identity._fake_v2_response)
self.useFixture(lockutils_fixtures.ExternalLockFixture())
self.test_accounts = [
{'username': 'test_user1', 'tenant_name': 'test_tenant1',
'password': 'p'},
{'username': 'test_user2', 'tenant_name': 'test_tenant2',
'password': 'p'},
{'username': 'test_user3', 'tenant_name': 'test_tenant3',
'password': 'p'},
{'username': 'test_user4', 'tenant_name': 'test_tenant4',
'password': 'p'},
{'username': 'test_user5', 'tenant_name': 'test_tenant5',
'password': 'p'},
{'username': 'test_user6', 'tenant_name': 'test_tenant6',
'password': 'p', 'roles': ['role1', 'role2']},
{'username': 'test_user7', 'tenant_name': 'test_tenant7',
'password': 'p', 'roles': ['role2', 'role3']},
{'username': 'test_user8', 'tenant_name': 'test_tenant8',
'password': 'p', 'roles': ['role4', 'role1']},
{'username': 'test_user9', 'tenant_name': 'test_tenant9',
'password': 'p', 'roles': ['role1', 'role2', 'role3', 'role4']},
{'username': 'test_user10', 'tenant_name': 'test_tenant10',
'password': 'p', 'roles': ['role1', 'role2', 'role3', 'role4']},
{'username': 'test_user11', 'tenant_name': 'test_tenant11',
'password': 'p', 'roles': [cfg.CONF.identity.admin_role]},
{'username': 'test_user12', 'tenant_name': 'test_tenant12',
'password': 'p', 'roles': [cfg.CONF.identity.admin_role]},
{'username': 'test_user13', 'tenant_name': 'test_tenant13',
'password': 'p', 'resources': {'network': 'network-1'}},
{'username': 'test_user14', 'tenant_name': 'test_tenant14',
'password': 'p', 'roles': ['role-7', 'role-11'],
'resources': {'network': 'network-2'}},
]
self.useFixture(mockpatch.Patch(
'tempest.common.accounts.read_accounts_yaml',
return_value=self.test_accounts))
cfg.CONF.set_default('test_accounts_file', 'fake_path', group='auth')
self.useFixture(mockpatch.Patch('os.path.isfile', return_value=True))
示例12: setUp
def setUp(self):
super(TestPreProvisionedCredentials, self).setUp()
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
self.stubs.Set(token_client.TokenClient, 'raw_request',
fake_identity._fake_v2_response)
self.useFixture(lockutils_fixtures.ExternalLockFixture())
self.test_accounts = [
{'username': 'test_user1', 'tenant_name': 'test_tenant1',
'password': 'p'},
{'username': 'test_user2', 'tenant_name': 'test_tenant2',
'password': 'p'},
{'username': 'test_user3', 'tenant_name': 'test_tenant3',
'password': 'p'},
{'username': 'test_user4', 'tenant_name': 'test_tenant4',
'password': 'p'},
{'username': 'test_user5', 'tenant_name': 'test_tenant5',
'password': 'p'},
{'username': 'test_user6', 'tenant_name': 'test_tenant6',
'password': 'p', 'roles': ['role1', 'role2']},
{'username': 'test_user7', 'tenant_name': 'test_tenant7',
'password': 'p', 'roles': ['role2', 'role3']},
{'username': 'test_user8', 'tenant_name': 'test_tenant8',
'password': 'p', 'roles': ['role4', 'role1']},
{'username': 'test_user9', 'tenant_name': 'test_tenant9',
'password': 'p', 'roles': ['role1', 'role2', 'role3', 'role4']},
{'username': 'test_user10', 'tenant_name': 'test_tenant10',
'password': 'p', 'roles': ['role1', 'role2', 'role3', 'role4']},
{'username': 'test_user11', 'tenant_name': 'test_tenant11',
'password': 'p', 'roles': [cfg.CONF.identity.admin_role]},
{'username': 'test_user12', 'tenant_name': 'test_tenant12',
'password': 'p', 'roles': [cfg.CONF.identity.admin_role]},
]
self.accounts_mock = self.useFixture(mockpatch.Patch(
'tempest.common.preprov_creds.read_accounts_yaml',
return_value=self.test_accounts))
self.useFixture(mockpatch.Patch('os.path.isfile', return_value=True))
示例13: setUp
def setUp(self):
super(CredentialsTests, self).setUp()
self.fake_http = fake_http.fake_httplib2(return_type=200)
self.stubs.Set(http.ClosingHttp, 'request', self.fake_http.request)
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
示例14: setUp
def setUp(self):
self.fake_http = fake_http.fake_httplib2(404)
super(TestRestClientNotFoundHandling, self).setUp()
示例15: setUp
def setUp(self):
super(BaseAuthTestsSetUp, self).setUp()
self.fake_http = fake_http.fake_httplib2(return_type=200)
self.stubs.Set(auth, 'get_credentials', fake_get_credentials)
self.auth_provider = self._auth(self.credentials,
fake_identity.FAKE_AUTH_URL)