diff --git a/neutronclient/tests/unit/test_cli20.py b/neutronclient/tests/unit/test_cli20.py index 4ff306abc..2a18329b4 100644 --- a/neutronclient/tests/unit/test_cli20.py +++ b/neutronclient/tests/unit/test_cli20.py @@ -816,6 +816,11 @@ class ClientV2TestJson(CLITestV20Base): self.mox.VerifyAll() self.mox.UnsetStubs() + def test_deserialize_without_data(self): + data = u'' + result = self.client.deserialize(data, 200) + self.assertEqual(data, result) + class CLITestV20ExceptionHandler(CLITestV20Base): diff --git a/neutronclient/v2_0/client.py b/neutronclient/v2_0/client.py index 759f7765e..65df0c82a 100644 --- a/neutronclient/v2_0/client.py +++ b/neutronclient/v2_0/client.py @@ -312,7 +312,8 @@ class ClientBase(object): def deserialize(self, data, status_code): """Deserializes a JSON string into a dictionary.""" - if status_code == 204: + # TODO(hichihara): Remove checking 204 in bug 1611167 + if status_code == 204 or not data: return data return serializer.Serializer().deserialize( data)['body']