summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Short <zulcss@gmail.com>2018-05-04 22:47:44 -0400
committerkaz_shinohara <ksnhr.tech@gmail.com>2018-06-08 10:27:13 +0900
commit53ad52ce5a55a9c153792c255d68ef8b067ad1ab (patch)
tree2fa73885fc622352366d83b426336bafc7f27ebb
parentfccac60a97d7b64909dcb33450acc203154bb69f (diff)
Remove mox3 from TemplateGeneratorTests
Apart of the mox3 community goal for Rocky. Change-Id: Iabd07327946c0b5e3641c4c907a00fbf3661beff Depends-On: Ibf41998cb154c5170e8038f5b2708c928b68b8b4 Signed-off-by: Charles Short <zulcss@gmail.com>
Notes
Notes (review): Code-Review+2: Kazunori Shinohara <ksnhr.tech@gmail.com> Code-Review+2: Keiichi Hikita <keiichi.hikita@gmail.com> Workflow+1: Keiichi Hikita <keiichi.hikita@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Fri, 08 Jun 2018 01:51:16 +0000 Reviewed-on: https://review.openstack.org/566427 Project: openstack/heat-dashboard Branch: refs/heads/master
-rw-r--r--heat_dashboard/test/tests/content/test_template_generator.py94
1 files changed, 55 insertions, 39 deletions
diff --git a/heat_dashboard/test/tests/content/test_template_generator.py b/heat_dashboard/test/tests/content/test_template_generator.py
index 0f1f45d..f5abd5a 100644
--- a/heat_dashboard/test/tests/content/test_template_generator.py
+++ b/heat_dashboard/test/tests/content/test_template_generator.py
@@ -13,9 +13,6 @@
13 13
14import json 14import json
15 15
16from mox3.mox import IsA
17
18from django import http
19from django.urls import reverse 16from django.urls import reverse
20from openstack_dashboard import api as dashboard_api 17from openstack_dashboard import api as dashboard_api
21 18
@@ -25,12 +22,14 @@ from heat_dashboard.test import helpers as test
25 22
26class TemplateGeneratorTests(test.TestCase): 23class TemplateGeneratorTests(test.TestCase):
27 24
25 use_mox = False
26
28 def test_index(self): 27 def test_index(self):
29 self.client.get(reverse('horizon:project:template_generator:index')) 28 self.client.get(reverse('horizon:project:template_generator:index'))
30 self.assertTemplateUsed( 29 self.assertTemplateUsed(
31 template_name='project/template_generator/index.html') 30 template_name='project/template_generator/index.html')
32 31
33 @test.create_stubs({ 32 @test.create_mocks({
34 api.heat: ('template_version_list', ), 33 api.heat: ('template_version_list', ),
35 dashboard_api.neutron: ( 34 dashboard_api.neutron: (
36 'network_list', 'subnet_list', 'tenant_floating_ip_list', 35 'network_list', 'subnet_list', 'tenant_floating_ip_list',
@@ -60,41 +59,23 @@ class TemplateGeneratorTests(test.TestCase):
60 keypairs = self.keypairs.list() 59 keypairs = self.keypairs.list()
61 template_versions = self.template_versions.list() 60 template_versions = self.template_versions.list()
62 61
63 dashboard_api.cinder.volume_list( 62 self.mock_volume_list.return_value = volumes
64 IsA(http.HttpRequest)).AndReturn(volumes) 63 self.mock_volume_snapshot_list.return_value = volume_snapshots
65 dashboard_api.cinder.volume_snapshot_list( 64 self.mock_volume_type_list.return_vlue = volume_types
66 IsA(http.HttpRequest)).AndReturn(volume_snapshots) 65 self.mock_volume_backup_list.return_value = volume_backups
67 dashboard_api.cinder.volume_type_list( 66 self.mock_image_list_detailed.return_value = images
68 IsA(http.HttpRequest)).AndReturn(volume_types) 67 self.mock_network_list.return_value = networks
69 dashboard_api.cinder.volume_backup_list( 68 self.mock_subnet_list.return_value = subnets
70 IsA(http.HttpRequest)).AndReturn(volume_backups) 69 self.mock_tenant_floating_ip_list.return_value = floating_ips
71 dashboard_api.glance.image_list_detailed( 70 self.mock_port_list.return_value = ports
72 IsA(http.HttpRequest)).AndReturn(images) 71 self.mock_security_group_list.return_value = security_groups
73 dashboard_api.neutron.network_list( 72 self.mock_router_list.return_value = routers
74 IsA(http.HttpRequest)).AndReturn(networks) 73 self.mock_policy_list.return_value = qos_policies
75 dashboard_api.neutron.subnet_list( 74 self.mock_availability_zone_list.return_value = availability_zones
76 IsA(http.HttpRequest)).AndReturn(subnets) 75 self.mock_flavor_list.return_value = flavors
77 dashboard_api.neutron.tenant_floating_ip_list( 76 self.mock_server_list.return_value = instances
78 IsA(http.HttpRequest), True).AndReturn(floating_ips) 77 self.mock_keypair_list.return_value = keypairs
79 dashboard_api.neutron.port_list( 78 self.mock_template_version_list.return_value = template_versions
80 IsA(http.HttpRequest)).AndReturn(ports)
81 dashboard_api.neutron.security_group_list(
82 IsA(http.HttpRequest)).AndReturn(security_groups)
83 dashboard_api.neutron.router_list(
84 IsA(http.HttpRequest)).AndReturn(routers)
85 dashboard_api.neutron.policy_list(
86 IsA(http.HttpRequest)).AndReturn(qos_policies)
87 dashboard_api.nova.availability_zone_list(
88 IsA(http.HttpRequest)).AndReturn(availability_zones)
89 dashboard_api.nova.flavor_list(
90 IsA(http.HttpRequest)).AndReturn(flavors)
91 dashboard_api.nova.server_list(
92 IsA(http.HttpRequest)).AndReturn(instances)
93 dashboard_api.nova.keypair_list(
94 IsA(http.HttpRequest)).AndReturn(keypairs)
95 api.heat.template_version_list(
96 IsA(http.HttpRequest)).AndReturn(template_versions)
97 self.mox.ReplayAll()
98 79
99 resp = self.client.get(reverse( 80 resp = self.client.get(reverse(
100 'horizon:project:template_generator:apis')) 81 'horizon:project:template_generator:apis'))
@@ -103,3 +84,38 @@ class TemplateGeneratorTests(test.TestCase):
103 data = data.decode('utf-8') 84 data = data.decode('utf-8')
104 json_data = json.loads(data) 85 json_data = json.loads(data)
105 self.assertEqual(len(json_data.keys()), 20) 86 self.assertEqual(len(json_data.keys()), 20)
87
88 self.mock_volume_list.assert_called_once_with(
89 test.IsHttpRequest())
90 self.mock_volume_snapshot_list.assert_called_once_with(
91 test.IsHttpRequest())
92 self.mock_volume_type_list.assert_called_once_with(
93 test.IsHttpRequest())
94 self.mock_volume_backup_list.assert_called_once_with(
95 test.IsHttpRequest())
96 self.mock_image_list_detailed.assert_called_once_with(
97 test.IsHttpRequest())
98 self.mock_network_list.assert_called_once_with(
99 test.IsHttpRequest())
100 self.mock_subnet_list.assert_called_once_with(
101 test.IsHttpRequest())
102 self.mock_tenant_floating_ip_list.assert_called_once_with(
103 test.IsHttpRequest(), True)
104 self.mock_port_list.assert_called_once_with(
105 test.IsHttpRequest())
106 self.mock_security_group_list.assert_called_once_with(
107 test.IsHttpRequest())
108 self.mock_router_list.assert_called_once_with(
109 test.IsHttpRequest())
110 self.mock_policy_list.assert_called_once_with(
111 test.IsHttpRequest())
112 self.mock_availability_zone_list.assert_called_once_with(
113 test.IsHttpRequest())
114 self.mock_flavor_list.assert_called_once_with(
115 test.IsHttpRequest())
116 self.mock_server_list.assert_called_once_with(
117 test.IsHttpRequest())
118 self.mock_keypair_list.assert_called_once_with(
119 test.IsHttpRequest())
120 self.mock_template_version_list.assert_called_once_with(
121 test.IsHttpRequest())