add mock for test_create_flavor_not_allowed

observed unittests in local environment was taking forever
and found code under test is calling out to list flavors
but the test case was not mocking anything.

Change-Id: I02e8c9bbf7b25c650800f22d65fe99a6a3887227
This commit is contained in:
Jon Schlueter 2018-01-22 09:30:40 -05:00
parent e61aa57609
commit eb099e97ce

View File

@ -538,6 +538,10 @@ class TestFlavors(BaseConfigTempestTest):
mock_function.assert_has_calls(calls, any_order=True)
def test_create_flavor_not_allowed(self):
# mock list_flavors() to return empty list
mock_function = mock.Mock(return_value={"flavors": []})
self.useFixture(MonkeyPatch(self.CLIENT_MOCK + '.list_flavors',
mock_function))
exc = Exception
self.assertRaises(exc,
tool.find_or_create_flavor,