Fix neutron API tests

Previously test_is_extension_supported() in neutron API tests was
completely meaningless because it just checked the return value from
the mocked methods. This commit changes to mock the python neutronclient
method to test is_extension_supported correctly.

Change-Id: Id1da355fecd9c44db9b998521ba8b1f5aecf010a
This commit is contained in:
Akihiro Motoki 2017-05-25 01:19:50 +00:00
parent cd931258b4
commit 8956e689bf
1 changed files with 3 additions and 5 deletions

View File

@ -510,12 +510,10 @@ class NeutronApiTests(test.APITestCase):
api.neutron.router_remove_interface(
self.request, router_id, port_id=fake_port)
@test.create_stubs({api.neutron: ('is_extension_supported',)})
def test_is_extension_supported(self):
api.neutron.is_extension_supported(self.request, "quotas")\
.AndReturn(True)
api.neutron.is_extension_supported(self.request, "doesntexist") \
.AndReturn(False)
neutronclient = self.stub_neutronclient()
neutronclient.list_extensions() \
.AndReturn({'extensions': self.api_extensions.list()})
self.mox.ReplayAll()
self.assertTrue(