diff --git a/heat_dashboard/test/settings.py b/heat_dashboard/test/settings.py index ff71c6dd..8ff1ca2b 100644 --- a/heat_dashboard/test/settings.py +++ b/heat_dashboard/test/settings.py @@ -12,14 +12,12 @@ # under the License. # Default to Horizons test settings to avoid any missing keys -import heat_dashboard.enabled -import openstack_dashboard.enabled import openstack_dashboard.enabled # noqa: F811 from openstack_dashboard.test.settings import * # noqa: F403,H303 - from openstack_dashboard.utils import settings +import heat_dashboard.enabled # pop these keys to avoid log warnings about deprecation # update_dashboards will populate them anyway diff --git a/heat_dashboard/test/tests/api/heat_rest_tests.py b/heat_dashboard/test/tests/api/heat_rest_tests.py index d20e4058..ca731dd9 100644 --- a/heat_dashboard/test/tests/api/heat_rest_tests.py +++ b/heat_dashboard/test/tests/api/heat_rest_tests.py @@ -38,32 +38,33 @@ class HeatRestTestCase(test.TestCase): # Services # - @test.create_stubs({api.base: ('is_service_enabled',)}) + @test.create_mocks({api.base: ('is_service_enabled',)}) @mock.patch.object(heat.api, 'heat') def test_services_get(self, hc): request = self.mock_rest_request(GET={}) - api.base.is_service_enabled(request, 'orchestration').AndReturn(True) + self.mock_is_service_enabled.return_value = True hc.service_list.return_value = [ mock.Mock(**{'to_dict.return_value': {'id': '1'}}), mock.Mock(**{'to_dict.return_value': {'id': '2'}}) ] - self.mox.ReplayAll() response = heat.Services().get(request) self.assertStatusCode(response, 200) self.assertEqual(response.content.decode('utf-8'), '{"items": [{"id": "1"}, {"id": "2"}]}') hc.service_list.assert_called_once_with(request) + self.mock_is_service_enabled.assert_called_once_with( + request, 'orchestration') - @test.create_stubs({api.base: ('is_service_enabled',)}) + @test.create_mocks({api.base: ('is_service_enabled',)}) def test_services_get_disabled(self): request = self.mock_rest_request(GET={}) - api.base.is_service_enabled(request, 'orchestration').AndReturn(False) - - self.mox.ReplayAll() + self.mock_is_service_enabled.return_value = False response = heat.Services().get(request) self.assertStatusCode(response, 501) + self.mock_is_service_enabled.assert_called_once_with( + request, 'orchestration') diff --git a/heat_dashboard/test/tests/api/heat_tests.py b/heat_dashboard/test/tests/api/heat_tests.py index 8f8a4249..7c7a1a05 100644 --- a/heat_dashboard/test/tests/api/heat_tests.py +++ b/heat_dashboard/test/tests/api/heat_tests.py @@ -21,6 +21,7 @@ from horizon import exceptions class HeatApiTests(test.APITestCase): + use_mox = True def test_stack_list(self):