def test_inspect_image_bad_return_code(self): mock_conn = self.mox.CreateMockAnything() mock_conn.request("GET", "/v1.4/images/XXX/json", headers={"Content-Type": "application/json"}) response = FakeResponse(404) mock_conn.getresponse().AndReturn(response) self.mox.ReplayAll() client = nova.virt.docker.client.DockerHTTPClient(mock_conn) image = client.inspect_image("XXX") self.assertEqual(None, image) self.mox.VerifyAll()
def test_inspect_image_bad_return_code(self): mock_conn = self.mox.CreateMockAnything() mock_conn.request('GET', '/v1.4/images/XXX/json', headers={'Content-Type': 'application/json'}) response = FakeResponse(404) mock_conn.getresponse().AndReturn(response) self.mox.ReplayAll() client = nova.virt.docker.client.DockerHTTPClient(mock_conn) image = client.inspect_image('XXX') self.assertIsNone(image) self.mox.VerifyAll()
def test_inspect_image_bad_return_code(self): mock_conn = self.mox.CreateMockAnything() mock_conn.request('GET', '/v1.4/images/XXX/json', headers={'Content-Type': 'application/json'}) response = FakeResponse(404) mock_conn.getresponse().AndReturn(response) self.mox.ReplayAll() client = nova.virt.docker.client.DockerHTTPClient(mock_conn) image = client.inspect_image('XXX') self.assertIsNone(image) self.mox.VerifyAll()
def test_inspect_image(self): mock_conn = self.mox.CreateMockAnything() mock_conn.request('GET', '/v1.4/images/XXX/json', headers={'Content-Type': 'application/json'}) response = FakeResponse(200, data='{"name": "XXX"}', headers={'Content-Type': 'application/json'}) mock_conn.getresponse().AndReturn(response) self.mox.ReplayAll() client = nova.virt.docker.client.DockerHTTPClient(mock_conn) image = client.inspect_image('XXX') self.assertEqual({'name': 'XXX'}, image) self.mox.VerifyAll()
def test_inspect_image(self): mock_conn = self.mox.CreateMockAnything() mock_conn.request('GET', '/v1.4/images/XXX/json', headers={'Content-Type': 'application/json'}) response = FakeResponse(200, data='{"name": "XXX"}', headers={'Content-Type': 'application/json'}) mock_conn.getresponse().AndReturn(response) self.mox.ReplayAll() client = nova.virt.docker.client.DockerHTTPClient(mock_conn) image = client.inspect_image('XXX') self.assertEqual({'name': 'XXX'}, image) self.mox.VerifyAll()