• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python fake_http.fake_httplib2函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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)
开发者ID:JasGit,项目名称:tempest,代码行数:7,代码来源:test_tenant_isolation.py


示例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")
开发者ID:CiscoSystems,项目名称:tempest,代码行数:7,代码来源:test_tenant_isolation.py


示例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'))
开发者ID:sshnaidm,项目名称:tempest,代码行数:7,代码来源:test_rest_client.py


示例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)
开发者ID:yangxiangfu,项目名称:tempest,代码行数:7,代码来源:test_auth.py


示例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)
开发者ID:CiscoSystems,项目名称:tempest,代码行数:9,代码来源:test_auth.py


示例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')
开发者ID:hkumarmk,项目名称:tempest,代码行数:9,代码来源:test_tenant_isolation.py


示例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'))
开发者ID:CiscoSystems,项目名称:tempest,代码行数:10,代码来源:test_negative_rest_client.py


示例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')
开发者ID:ravisantoshgudimetla,项目名称:tempest,代码行数:10,代码来源:test_dynamic_creds.py


示例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, {})
开发者ID:BhargavaRegalla,项目名称:tempest,代码行数:16,代码来源:test_glance_http.py


示例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))
开发者ID:calba,项目名称:tempest,代码行数:46,代码来源:test_accounts.py


示例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))
开发者ID:lishang84,项目名称:tempest_automate_ironic,代码行数:44,代码来源:test_accounts.py


示例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))
开发者ID:jishandong,项目名称:tempest,代码行数:38,代码来源:test_preprov_creds.py


示例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)
开发者ID:BhargavaRegalla,项目名称:tempest,代码行数:6,代码来源:test_credentials.py


示例14: setUp

 def setUp(self):
     self.fake_http = fake_http.fake_httplib2(404)
     super(TestRestClientNotFoundHandling, self).setUp()
开发者ID:ntt-sic,项目名称:tempest,代码行数:3,代码来源:test_rest_client.py


示例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)
开发者ID:Dynavisor,项目名称:tempest,代码行数:6,代码来源:test_auth.py



注:本文中的tempest.tests.fake_http.fake_httplib2函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python fake_http.fake_http_response函数代码示例发布时间:2022-05-27
下一篇:
Python test.is_extension_enabled函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap