Drop mox usage in SaharaApiTest

Apart of the mox3 community goal for Rocky.

Change-Id: I8f464e10f800eddfe0183fb3c2c152e37f001097
Signed-off-by: Charles Short <zulcss@gmail.com>
This commit is contained in:
Charles Short 2018-05-12 11:58:07 -04:00
parent 34481589ea
commit a262a42a94
2 changed files with 3 additions and 25 deletions

View File

@ -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',

View File

@ -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