From eb099e97cee5a745c6f077bb3bf9377622e9da3a Mon Sep 17 00:00:00 2001 From: Jon Schlueter Date: Mon, 22 Jan 2018 09:30:40 -0500 Subject: [PATCH] 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 --- config_tempest/tests/test_config_tempest.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config_tempest/tests/test_config_tempest.py b/config_tempest/tests/test_config_tempest.py index 08d5a9bc..1cda3057 100644 --- a/config_tempest/tests/test_config_tempest.py +++ b/config_tempest/tests/test_config_tempest.py @@ -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,