当前位置: 首页>>代码示例>>Python>>正文


Python FakeResponse.headers方法代码示例

本文整理汇总了Python中tests.unit.fakes.FakeResponse.headers方法的典型用法代码示例。如果您正苦于以下问题:Python FakeResponse.headers方法的具体用法?Python FakeResponse.headers怎么用?Python FakeResponse.headers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tests.unit.fakes.FakeResponse的用法示例。


在下文中一共展示了FakeResponse.headers方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_container_cdn_metadata

# 需要导入模块: from tests.unit.fakes import FakeResponse [as 别名]
# 或者: from tests.unit.fakes.FakeResponse import headers [as 别名]
 def test_get_container_cdn_metadata(self):
     client = self.client
     client.connection.cdn_request = Mock()
     resp = FakeResponse()
     resp.headers = [("a", "b"), ("c", "d")]
     client.connection.cdn_request.return_value = resp
     returned = client.get_container_cdn_metadata(self.cont_name)
     expected = {"a": "b", "c": "d"}
     self.assertEqual(expected, returned)
开发者ID:datalogics,项目名称:pyrax,代码行数:11,代码来源:test_cf_client.py

示例2: test_make_private

# 需要导入模块: from tests.unit.fakes import FakeResponse [as 别名]
# 或者: from tests.unit.fakes.FakeResponse import headers [as 别名]
 def test_make_private(self):
     cont = self.container
     cont.client.connection.cdn_request = Mock()
     example = "http://example.com"
     cont.cdn_uri = example
     resp = FakeResponse()
     resp.headers = [("c", "d")]
     cont.client.connection.cdn_request.return_value = resp
     cont.make_private()
     cont.client.connection.cdn_request.assert_called_with("PUT",
             [cont.name], hdrs={"X-CDN-Enabled": "False"})
开发者ID:jirwin,项目名称:pyrax,代码行数:13,代码来源:test_cf_container.py

示例3: test_list_public_containers

# 需要导入模块: from tests.unit.fakes import FakeResponse [as 别名]
# 或者: from tests.unit.fakes.FakeResponse import headers [as 别名]
 def test_list_public_containers(self):
     client = self.client
     client.connection.cdn_request = Mock()
     resp = FakeResponse()
     resp.headers = [("a", "b"), ("c", "d")]
     resp.status = 500
     client.connection.cdn_request.return_value = resp
     self.assertRaises(exc.CDNFailed, client.list_public_containers)
     resp.status = 200
     conts = client.list_public_containers()
     client.connection.cdn_request.assert_called_with("GET", [""])
     self.assertEqual(len(conts), 2)
开发者ID:datalogics,项目名称:pyrax,代码行数:14,代码来源:test_cf_client.py

示例4: test_make_public

# 需要导入模块: from tests.unit.fakes import FakeResponse [as 别名]
# 或者: from tests.unit.fakes.FakeResponse import headers [as 别名]
 def test_make_public(self, ttl=None):
     cont = self.container
     cont.cdn_uri = ""
     cont.client.connection.cdn_request = Mock()
     example = "http://example.com"
     ttl = 6666
     resp = FakeResponse()
     resp.headers = [("x-cdn-uri", example), ("c", "d")]
     cont.client.connection.cdn_request.return_value = resp
     cont.make_public(ttl)
     cont.client.connection.cdn_request.assert_called_with("PUT",
             [cont.name], hdrs={"X-TTL": str(ttl), "X-CDN-Enabled": "True"})
开发者ID:jirwin,项目名称:pyrax,代码行数:14,代码来源:test_cf_container.py

示例5: test_make_container_private

# 需要导入模块: from tests.unit.fakes import FakeResponse [as 别名]
# 或者: from tests.unit.fakes.FakeResponse import headers [as 别名]
 def test_make_container_private(self):
     client = self.client
     client.connection.head_container = Mock()
     cont = client.get_container(self.cont_name)
     cont.cdn_uri = None
     client.connection.cdn_request = Mock()
     example = "http://example.com"
     resp = FakeResponse()
     resp.headers = [("x-cdn-uri", example), ("c", "d")]
     resp.status = 500
     client.connection.cdn_request.return_value = resp
     self.assertRaises(exc.CDNFailed, client.make_container_public, self.cont_name)
     resp.status = 204
     client.make_container_private(self.cont_name)
     client.connection.cdn_request.assert_called_with("PUT", [self.cont_name], hdrs={"X-CDN-Enabled": "False"})
开发者ID:piecommerce,项目名称:pyrax,代码行数:17,代码来源:test_cf_client.py


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