def test_stop_container_bad_return_code(self): mock_conn = self.mox.CreateMockAnything() mock_conn.request("POST", "/v1.4/containers/XXX/stop?t=5", headers={"Content-Type": "application/json"}) response = FakeResponse(400) mock_conn.getresponse().AndReturn(response) self.mox.ReplayAll() client = nova.virt.docker.client.DockerHTTPClient(mock_conn) self.assertEqual(False, client.stop_container("XXX")) self.mox.VerifyAll()
def test_stop_container_bad_return_code(self): mock_conn = self.mox.CreateMockAnything() mock_conn.request('POST', '/v1.4/containers/XXX/stop?t=5', headers={'Content-Type': 'application/json'}) response = FakeResponse(400) mock_conn.getresponse().AndReturn(response) self.mox.ReplayAll() client = nova.virt.docker.client.DockerHTTPClient(mock_conn) self.assertEqual(False, client.stop_container('XXX')) self.mox.VerifyAll()
def test_stop_container(self): mock_conn = self.mox.CreateMockAnything() mock_conn.request('POST', '/v1.4/containers/XXX/stop?t=5', headers={'Content-Type': 'application/json'}) response = FakeResponse(204, headers={'Content-Type': 'application/json'}) mock_conn.getresponse().AndReturn(response) self.mox.ReplayAll() client = nova.virt.docker.client.DockerHTTPClient(mock_conn) self.assertEqual(True, client.stop_container('XXX')) self.mox.VerifyAll()