From a262a42a94e8baeeab60270165ae8b8a406862f1 Mon Sep 17 00:00:00 2001 From: Charles Short Date: Sat, 12 May 2018 11:58:07 -0400 Subject: [PATCH] Drop mox usage in SaharaApiTest Apart of the mox3 community goal for Rocky. Change-Id: I8f464e10f800eddfe0183fb3c2c152e37f001097 Signed-off-by: Charles Short --- .../test/api_tests/sahara_tests.py | 21 ++----------------- sahara_dashboard/test/helpers.py | 7 +------ 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/sahara_dashboard/test/api_tests/sahara_tests.py b/sahara_dashboard/test/api_tests/sahara_tests.py index 8c7a155c..950ab2ca 100644 --- a/sahara_dashboard/test/api_tests/sahara_tests.py +++ b/sahara_dashboard/test/api_tests/sahara_tests.py @@ -22,25 +22,8 @@ class SaharaApiTest(test.SaharaAPITestCase): # def test_cluster_create_count(self): saharaclient = self.stub_saharaclient() - saharaclient.clusters = self.mox.CreateMockAnything() - saharaclient.clusters.create(anti_affinity=None, - cluster_configs=None, - cluster_template_id=None, - count=2, - use_autoconfig=None, - default_image_id=None, - description=None, - hadoop_version='1.0.0', - is_transient=None, - name='name', - net_id=None, - node_groups=None, - plugin_name='fake_plugin', - user_keypair_id=None, - is_public=False, - is_protected=False) \ - .AndReturn({"Clusters": ['cluster1', 'cluster2']}) - self.mox.ReplayAll() + saharaclient.clusters.create.return_value = \ + {"Clusters": ['cluster1', 'cluster2']} ret_val = api.sahara.cluster_create(self.request, 'name', 'fake_plugin', diff --git a/sahara_dashboard/test/helpers.py b/sahara_dashboard/test/helpers.py index 3bc64340..3772574c 100644 --- a/sahara_dashboard/test/helpers.py +++ b/sahara_dashboard/test/helpers.py @@ -13,8 +13,6 @@ import mock -from saharaclient import client as sahara_client - from openstack_dashboard.test import helpers from sahara_dashboard import api @@ -51,8 +49,6 @@ class BaseAdminViewTests(SaharaTestsMixin, helpers.TestCase): class SaharaAPITestCase(helpers.APITestCase): - use_mox = True - def setUp(self): super(SaharaAPITestCase, self).setUp() @@ -66,6 +62,5 @@ class SaharaAPITestCase(helpers.APITestCase): def stub_saharaclient(self): if not hasattr(self, "saharaclient"): - self.mox.StubOutWithMock(sahara_client, 'Client') - self.saharaclient = self.mox.CreateMock(sahara_client.Client) + self.saharaclient = mock.Mock() return self.saharaclient