def test_get_container_logs_bad_return_code(self): mock_conn = self.mox.CreateMockAnything() url = "/v1.4/containers/XXX/attach?logs=1&stream=0&stdout=1&stderr=1" mock_conn.request("POST", url, headers={"Content-Type": "application/json"}) response = FakeResponse(404) mock_conn.getresponse().AndReturn(response) self.mox.ReplayAll() client = nova.virt.docker.client.DockerHTTPClient(mock_conn) logs = client.get_container_logs("XXX") self.assertEqual(None, logs) self.mox.VerifyAll()
def test_get_container_logs_bad_return_code(self): mock_conn = self.mox.CreateMockAnything() url = '/v1.4/containers/XXX/attach?logs=1&stream=0&stdout=1&stderr=1' mock_conn.request('POST', url, headers={'Content-Type': 'application/json'}) response = FakeResponse(404) mock_conn.getresponse().AndReturn(response) self.mox.ReplayAll() client = nova.virt.docker.client.DockerHTTPClient(mock_conn) logs = client.get_container_logs('XXX') self.assertIsNone(logs) self.mox.VerifyAll()