本文整理汇总了Python中tests.unit.fakes.FakeResponse.getheaders方法的典型用法代码示例。如果您正苦于以下问题:Python FakeResponse.getheaders方法的具体用法?Python FakeResponse.getheaders怎么用?Python FakeResponse.getheaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.unit.fakes.FakeResponse
的用法示例。
在下文中一共展示了FakeResponse.getheaders方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_fetch_cdn_not_found
# 需要导入模块: from tests.unit.fakes import FakeResponse [as 别名]
# 或者: from tests.unit.fakes.FakeResponse import getheaders [as 别名]
def test_fetch_cdn_not_found(self):
self.client.connection.cdn_request = Mock()
resp = FakeResponse()
resp.status = 404
resp.getheaders = Mock()
test_uri = "http://example.com"
test_ttl = "6666"
test_ssl_uri = "http://ssl.example.com"
test_streaming_uri = "http://streaming.example.com"
test_log_retention = True
resp.getheaders.return_value = []
self.client.connection.cdn_request.return_value = resp
# We need an actual container
cont = Container(self.client, "realcontainer", 0, 0)
self.assertIsNone(cont.cdn_uri)
示例2: test_fetch_cdn
# 需要导入模块: from tests.unit.fakes import FakeResponse [as 别名]
# 或者: from tests.unit.fakes.FakeResponse import getheaders [as 别名]
def test_fetch_cdn(self):
self.client.connection.cdn_request = Mock()
resp = FakeResponse()
resp.status = 204
resp.getheaders = Mock()
test_uri = "http://example.com"
test_ttl = "6666"
test_ssl_uri = "http://ssl.example.com"
test_streaming_uri = "http://streaming.example.com"
test_log_retention = True
resp.getheaders.return_value = [("x-cdn-uri", test_uri), ("x-ttl", test_ttl),
("x-cdn-ssl-uri", test_ssl_uri), ("x-cdn-streaming-uri", test_streaming_uri),
("x-log-retention", test_log_retention)]
self.client.connection.cdn_request.return_value = resp
# We need an actual container
cont = Container(self.client, "realcontainer", 0, 0)
self.assertEqual(cont.cdn_uri, test_uri)