Add assertion to test_page_reverse method

In neutron/tests/unit/test_api_v2.APIv2TestCase.test_page_reverse
there is no second call to test_case with 'page_reverse': 'False,
because of use assert_called_once_with.
In proposed change before second testcase, reset_mock is called.
Remove also second 'instance' initialization.

Closes-Bug: #1373126
Change-Id: I552b7b47456a1cdfccdeb8d7853ec3395317097a
This commit is contained in:
Wlodzimierz Borkowski 2014-10-25 14:59:24 +02:00
parent ce98d5f738
commit 60974fa5b0

View File

@ -368,18 +368,20 @@ class APIv2TestCase(APIv2TestBase):
calls = []
instance = self.plugin.return_value
instance.get_networks.return_value = []
self.api.get(_get_path('networks'),
{'page_reverse': 'True'})
kwargs = self._get_collection_kwargs(page_reverse=True)
calls.append(mock.call.get_networks(mock.ANY, **kwargs))
instance.get_networks.assert_called_once_with(mock.ANY, **kwargs)
instance = self.plugin.return_value
instance.get_networks.return_value = []
instance.get_networks.reset_mock()
self.api.get(_get_path('networks'),
{'page_reverse': 'False'})
kwargs = self._get_collection_kwargs(page_reverse=False)
calls.append(mock.call.get_networks(mock.ANY, **kwargs))
instance.get_networks.assert_called_once_with(mock.ANY, **kwargs)
def test_page_reverse_with_non_bool(self):
instance = self.plugin.return_value