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"})
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"})
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"})
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" })