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_ios_uri = "http://ios.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)
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_ios_uri = "http://ios.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-cdn-ios-uri", test_ios_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)
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_ios_uri = "http://ios.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-cdn-ios-uri", test_ios_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)