fix unit test failures
new tab approach produces new API call, which were unmocked. also added missing stuff in order to repair unit tests. Change-Id: Ie9eba4773df6be9ac9663fdba0d07fa44afe6912 Closes-bug: 1578195
This commit is contained in:
parent
df018e91b6
commit
35ab4ab33b
|
@ -32,7 +32,10 @@ DETAILS_URL = reverse(
|
|||
|
||||
|
||||
class DataProcessingClusterTemplateTests(test.TestCase):
|
||||
@test.create_stubs({api.sahara: ('cluster_template_list',)})
|
||||
@test.create_stubs({api.sahara: ('cluster_template_list',
|
||||
'image_list',
|
||||
'cluster_list',
|
||||
'nodegroup_template_list')})
|
||||
def test_index(self):
|
||||
api.sahara.cluster_template_list(IsA(http.HttpRequest), {}) \
|
||||
.AndReturn(self.cluster_templates.list())
|
||||
|
@ -42,7 +45,8 @@ class DataProcessingClusterTemplateTests(test.TestCase):
|
|||
self.assertContains(res, 'Cluster Templates')
|
||||
self.assertContains(res, 'Name')
|
||||
|
||||
@test.create_stubs({api.sahara: ('cluster_template_get',),
|
||||
@test.create_stubs({api.sahara: ('cluster_template_get',
|
||||
'nodegroup_template_get'),
|
||||
dash_api.nova: ('flavor_get',)})
|
||||
def test_details(self):
|
||||
flavor = self.flavors.first()
|
||||
|
@ -56,7 +60,8 @@ class DataProcessingClusterTemplateTests(test.TestCase):
|
|||
res = self.client.get(DETAILS_URL)
|
||||
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
|
||||
|
||||
@test.create_stubs({api.sahara: ('cluster_template_get',
|
||||
@test.create_stubs({api.sahara: ('client',
|
||||
'cluster_template_get',
|
||||
'plugin_get_version_details',
|
||||
'nodegroup_template_find')})
|
||||
def test_copy(self):
|
||||
|
@ -100,7 +105,8 @@ class DataProcessingClusterTemplateTests(test.TestCase):
|
|||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
self.assertMessageCount(success=1)
|
||||
|
||||
@test.create_stubs({api.sahara: ('cluster_template_get',
|
||||
@test.create_stubs({api.sahara: ('client',
|
||||
'cluster_template_get',
|
||||
'cluster_template_update',
|
||||
'plugin_get_version_details',
|
||||
'nodegroup_template_find')})
|
||||
|
|
|
@ -15,6 +15,8 @@ from django import http
|
|||
from mox3.mox import IsA # noqa
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from openstack_dashboard import api as os_api
|
||||
|
||||
from sahara_dashboard import api
|
||||
from sahara_dashboard.test import helpers as test
|
||||
|
||||
|
@ -25,7 +27,10 @@ DETAILS_URL = reverse(
|
|||
|
||||
|
||||
class DataProcessingClusterTests(test.TestCase):
|
||||
@test.create_stubs({api.sahara: ('cluster_list',)})
|
||||
@test.create_stubs({api.sahara: ('cluster_template_list',
|
||||
'image_list',
|
||||
'cluster_list',
|
||||
'nodegroup_template_list')})
|
||||
def test_index(self):
|
||||
api.sahara.cluster_list(IsA(http.HttpRequest), {}) \
|
||||
.AndReturn(self.clusters.list())
|
||||
|
@ -35,7 +40,10 @@ class DataProcessingClusterTests(test.TestCase):
|
|||
self.assertContains(res, 'Clusters')
|
||||
self.assertContains(res, 'Name')
|
||||
|
||||
@test.create_stubs({api.sahara: ('cluster_template_list', 'image_list')})
|
||||
@test.create_stubs({api.sahara: ('cluster_template_list', 'image_list',
|
||||
'plugin_get_version_details'),
|
||||
os_api.neutron: ('network_list',),
|
||||
os_api.nova: ('keypair_list',)})
|
||||
def test_launch_cluster_get_nodata(self):
|
||||
api.sahara.cluster_template_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn([])
|
||||
|
|
|
@ -26,7 +26,10 @@ REGISTER_URL = reverse(
|
|||
|
||||
|
||||
class DataProcessingImageRegistryTests(test.TestCase):
|
||||
@test.create_stubs({api.sahara: ('image_list',)})
|
||||
@test.create_stubs({api.sahara: ('cluster_template_list',
|
||||
'image_list',
|
||||
'cluster_list',
|
||||
'nodegroup_template_list')})
|
||||
def test_index(self):
|
||||
api.sahara.image_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.images.list())
|
||||
|
|
|
@ -68,7 +68,10 @@ class DataProcessingNodeGroupTests(test.TestCase):
|
|||
|
||||
return ngt, configs, res
|
||||
|
||||
@test.create_stubs({api.sahara: ('nodegroup_template_list',)})
|
||||
@test.create_stubs({api.sahara: ('cluster_template_list',
|
||||
'image_list',
|
||||
'cluster_list',
|
||||
'nodegroup_template_list')})
|
||||
def test_index(self):
|
||||
api.sahara.nodegroup_template_list(IsA(http.HttpRequest), {}) \
|
||||
.AndReturn(self.nodegroup_templates.list())
|
||||
|
@ -112,7 +115,10 @@ class DataProcessingNodeGroupTests(test.TestCase):
|
|||
self.assertMessageCount(success=1)
|
||||
|
||||
@test.create_stubs({api.sahara: ('nodegroup_template_get',
|
||||
'plugin_get_version_details'),
|
||||
'plugin_get_version_details',
|
||||
'image_list'),
|
||||
dash_api.nova: ('availability_zone_list',
|
||||
'flavor_list'),
|
||||
dash_api.network: ('floating_ip_pools_list',
|
||||
'security_group_list'),
|
||||
dash_api.cinder: ('extension_supported',
|
||||
|
@ -130,7 +136,8 @@ class DataProcessingNodeGroupTests(test.TestCase):
|
|||
'plugin_get_version_details'),
|
||||
dash_api.network: ('floating_ip_pools_list',
|
||||
'security_group_list'),
|
||||
dash_api.nova: ('flavor_list',),
|
||||
dash_api.nova: ('flavor_list',
|
||||
'availability_zone_list'),
|
||||
dash_api.cinder: ('extension_supported',
|
||||
'availability_zone_list',
|
||||
'volume_type_list')})
|
||||
|
@ -222,7 +229,8 @@ class DataProcessingNodeGroupTests(test.TestCase):
|
|||
'plugin_get_version_details'),
|
||||
dash_api.network: ('floating_ip_pools_list',
|
||||
'security_group_list'),
|
||||
dash_api.nova: ('flavor_list',),
|
||||
dash_api.nova: ('flavor_list',
|
||||
'availability_zone_list'),
|
||||
dash_api.cinder: ('extension_supported',
|
||||
'availability_zone_list',
|
||||
'volume_type_list')})
|
||||
|
@ -313,7 +321,10 @@ class DataProcessingNodeGroupTests(test.TestCase):
|
|||
self.assertMessageCount(success=1)
|
||||
|
||||
@test.create_stubs({api.sahara: ('nodegroup_template_get',
|
||||
'plugin_get_version_details'),
|
||||
'plugin_get_version_details',
|
||||
'image_list'),
|
||||
dash_api.nova: ('availability_zone_list',
|
||||
'flavor_list'),
|
||||
dash_api.network: ('floating_ip_pools_list',
|
||||
'security_group_list'),
|
||||
dash_api.cinder: ('extension_supported',
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from sahara_dashboard import api
|
||||
from sahara_dashboard.test import helpers as test
|
||||
|
||||
|
||||
|
@ -23,7 +24,9 @@ CLUSTER_GUIDE_RESET_URL = reverse(
|
|||
|
||||
|
||||
class DataProcessingClusterGuideTests(test.TestCase):
|
||||
@test.create_stubs({api.sahara: ('nodegroup_template_find',)})
|
||||
def test_cluster_guide(self):
|
||||
self.mox.ReplayAll()
|
||||
res = self.client.get(CLUSTER_GUIDE_URL)
|
||||
self.assertTemplateUsed(
|
||||
res, 'cluster_wizard/cluster_guide.html')
|
||||
|
|
|
@ -26,7 +26,10 @@ DETAILS_URL = reverse(
|
|||
|
||||
|
||||
class DataProcessingPluginsTests(test.TestCase):
|
||||
@test.create_stubs({api.sahara: ('plugin_list',)})
|
||||
@test.create_stubs({api.sahara: ('job_execution_list',
|
||||
'plugin_list', 'job_binary_list',
|
||||
'data_source_list',
|
||||
'job_list')})
|
||||
def test_index(self):
|
||||
api.sahara.plugin_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.plugins.list())
|
||||
|
|
|
@ -29,7 +29,10 @@ EDIT_URL = reverse(
|
|||
|
||||
|
||||
class DataProcessingDataSourceTests(test.TestCase):
|
||||
@test.create_stubs({api.sahara: ('data_source_list',)})
|
||||
@test.create_stubs({api.sahara: ('job_execution_list',
|
||||
'plugin_list', 'job_binary_list',
|
||||
'data_source_list',
|
||||
'job_list')})
|
||||
def test_index(self):
|
||||
api.sahara.data_source_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.data_sources.list())
|
||||
|
|
|
@ -29,7 +29,10 @@ CREATE_URL = reverse(
|
|||
|
||||
|
||||
class DataProcessingJobBinaryTests(test.TestCase):
|
||||
@test.create_stubs({api.sahara: ('job_binary_list',)})
|
||||
@test.create_stubs({api.sahara: ('job_execution_list',
|
||||
'plugin_list', 'job_binary_list',
|
||||
'data_source_list',
|
||||
'job_list')})
|
||||
def test_index(self):
|
||||
api.sahara.job_binary_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.job_binaries.list())
|
||||
|
@ -99,7 +102,8 @@ class DataProcessingJobBinaryTests(test.TestCase):
|
|||
)
|
||||
|
||||
@test.create_stubs({api.sahara: ('job_binary_get',
|
||||
'job_binary_update')})
|
||||
'job_binary_update',
|
||||
'job_binary_internal_list')})
|
||||
def test_update(self):
|
||||
jb = api.sahara.job_binary_get(IsA(http.HttpRequest), IsA(six.text_type)) \
|
||||
.AndReturn(self.job_binaries.first())
|
||||
|
@ -125,6 +129,8 @@ class DataProcessingJobBinaryTests(test.TestCase):
|
|||
self.assertNoFormErrors(res)
|
||||
|
||||
@test.create_stubs({api.manila: ('share_list', ),
|
||||
api.sahara: ('job_binary_create',
|
||||
'job_binary_internal_list'),
|
||||
api.sahara.base: ('is_service_enabled', )})
|
||||
def test_create_manila(self):
|
||||
share = self.mox.CreateMockAnything(
|
||||
|
|
|
@ -25,7 +25,10 @@ DETAILS_URL = reverse(
|
|||
|
||||
|
||||
class DataProcessingJobTemplateTests(test.TestCase):
|
||||
@test.create_stubs({api.sahara: ('job_list',)})
|
||||
@test.create_stubs({api.sahara: ('job_execution_list',
|
||||
'plugin_list', 'job_binary_list',
|
||||
'data_source_list',
|
||||
'job_list')})
|
||||
def test_index(self):
|
||||
api.sahara.job_list(IsA(http.HttpRequest), {}) \
|
||||
.AndReturn(self.jobs.list())
|
||||
|
|
|
@ -25,7 +25,10 @@ DETAILS_URL = reverse(
|
|||
|
||||
|
||||
class DataProcessingJobTests(test.TestCase):
|
||||
@test.create_stubs({api.sahara: ('job_execution_list',)})
|
||||
@test.create_stubs({api.sahara: ('job_execution_list',
|
||||
'plugin_list', 'job_binary_list',
|
||||
'data_source_list',
|
||||
'job_list')})
|
||||
def test_index(self):
|
||||
api.sahara.job_execution_list(IsA(http.HttpRequest), {}) \
|
||||
.AndReturn(self.job_executions.list())
|
||||
|
@ -42,7 +45,9 @@ class DataProcessingJobTests(test.TestCase):
|
|||
self.assertTemplateUsed(res, 'jobs/index.html')
|
||||
self.assertContains(res, 'Jobs')
|
||||
|
||||
@test.create_stubs({api.sahara: ('job_execution_get',)})
|
||||
@test.create_stubs({api.sahara: ('job_execution_get',
|
||||
'cluster_get', 'job_get',
|
||||
'data_source_get')})
|
||||
def test_details(self):
|
||||
api.sahara.job_execution_get(IsA(http.HttpRequest), IsA(six.text_type)) \
|
||||
.MultipleTimes().AndReturn(self.job_executions.first())
|
||||
|
|
Loading…
Reference in New Issue