Browse Source

Disable mox usage by default in test helper

- Add use_mox = True to tests which still depend on mox
- Remove use_mox = False from all tests converted into mock
- Update the warning messages
- Replace 'S'-release with 'Stein'

Part of blueprint mock-framework-in-unit-tests
Change-Id: I208185e97b2de346304a09643a9cb3f1425a7683
Signed-off-by: Akihiro Motoki <amotoki@gmail.com>
tags/14.0.0.0b2
Akihiro Motoki 1 year ago
parent
commit
58019a7411
31 changed files with 81 additions and 79 deletions
  1. 3
    0
      horizon/test/helpers.py
  2. 6
    0
      openstack_dashboard/dashboards/admin/flavors/tests.py
  3. 2
    0
      openstack_dashboard/dashboards/admin/networks/agents/tests.py
  4. 2
    0
      openstack_dashboard/dashboards/admin/networks/ports/tests.py
  5. 2
    0
      openstack_dashboard/dashboards/admin/networks/subnets/tests.py
  6. 3
    0
      openstack_dashboard/dashboards/admin/networks/tests.py
  7. 2
    0
      openstack_dashboard/dashboards/admin/overview/tests.py
  8. 9
    0
      openstack_dashboard/dashboards/identity/domains/tests.py
  9. 3
    0
      openstack_dashboard/dashboards/identity/groups/tests.py
  10. 2
    0
      openstack_dashboard/dashboards/identity/identity_providers/protocols/tests.py
  11. 3
    0
      openstack_dashboard/dashboards/identity/identity_providers/tests.py
  12. 3
    0
      openstack_dashboard/dashboards/identity/mappings/tests.py
  13. 21
    0
      openstack_dashboard/dashboards/identity/projects/tests.py
  14. 3
    0
      openstack_dashboard/dashboards/identity/roles/tests.py
  15. 3
    0
      openstack_dashboard/dashboards/identity/users/tests.py
  16. 0
    4
      openstack_dashboard/dashboards/project/instances/tests.py
  17. 0
    8
      openstack_dashboard/dashboards/project/routers/tests.py
  18. 14
    13
      openstack_dashboard/test/helpers.py
  19. 0
    2
      openstack_dashboard/test/unit/api/rest/test_cinder.py
  20. 0
    2
      openstack_dashboard/test/unit/api/rest/test_config.py
  21. 0
    2
      openstack_dashboard/test/unit/api/rest/test_glance.py
  22. 0
    2
      openstack_dashboard/test/unit/api/rest/test_keystone.py
  23. 0
    4
      openstack_dashboard/test/unit/api/rest/test_network.py
  24. 0
    16
      openstack_dashboard/test/unit/api/rest/test_neutron.py
  25. 0
    2
      openstack_dashboard/test/unit/api/rest/test_nova.py
  26. 0
    2
      openstack_dashboard/test/unit/api/rest/test_policy.py
  27. 0
    2
      openstack_dashboard/test/unit/api/rest/test_swift.py
  28. 0
    4
      openstack_dashboard/test/unit/api/rest/test_utils.py
  29. 0
    12
      openstack_dashboard/test/unit/api/test_base.py
  30. 0
    2
      openstack_dashboard/test/unit/api/test_nova.py
  31. 0
    2
      openstack_dashboard/test/unit/usage/test_quotas.py

+ 3
- 0
horizon/test/helpers.py View File

@@ -140,6 +140,9 @@ class TestCase(django_test.TestCase):
140 140
     def setUp(self):
141 141
         super(TestCase, self).setUp()
142 142
         if self.use_mox:
143
+            LOG.warning("'use_mox' will be dropped at the beginning of "
144
+                        "'Stein' release. If you still depend on mox, "
145
+                        "you must prepare mox environment in your test case.")
143 146
             self.mox = mox.Mox()
144 147
         self._setup_test_data()
145 148
         self._setup_factory()

+ 6
- 0
openstack_dashboard/dashboards/admin/flavors/tests.py View File

@@ -25,6 +25,9 @@ from openstack_dashboard.test import helpers as test
25 25
 
26 26
 
27 27
 class FlavorsViewTests(test.BaseAdminViewTests):
28
+
29
+    use_mox = True
30
+
28 31
     @test.create_stubs({api.nova: ('flavor_list_paged',),
29 32
                         flavors.Flavor: ('get_keys',), })
30 33
     def test_index(self):
@@ -177,6 +180,9 @@ class FlavorsViewTests(test.BaseAdminViewTests):
177 180
 
178 181
 
179 182
 class BaseFlavorWorkflowTests(test.BaseAdminViewTests):
183
+
184
+    use_mox = True
185
+
180 186
     def _flavor_create_params(self, flavor, id=None):
181 187
         eph = getattr(flavor, 'OS-FLV-EXT-DATA:ephemeral')
182 188
         flavor_info = {"name": flavor.name,

+ 2
- 0
openstack_dashboard/dashboards/admin/networks/agents/tests.py View File

@@ -26,6 +26,8 @@ NETWORKS_DETAIL_URL = 'horizon:admin:networks:detail'
26 26
 
27 27
 class NetworkAgentTests(test.BaseAdminViewTests):
28 28
 
29
+    use_mox = True
30
+
29 31
     @test.create_stubs({api.neutron: ('agent_list',
30 32
                                       'network_get',
31 33
                                       'list_dhcp_agent_hosting_networks',)})

+ 2
- 0
openstack_dashboard/dashboards/admin/networks/ports/tests.py View File

@@ -31,6 +31,8 @@ NETWORKS_DETAIL_URL = 'horizon:admin:networks:detail'
31 31
 
32 32
 class NetworkPortTests(test.BaseAdminViewTests):
33 33
 
34
+    use_mox = True
35
+
34 36
     @test.create_stubs({api.neutron: ('network_get',
35 37
                                       'port_get',
36 38
                                       'is_extension_supported',)})

+ 2
- 0
openstack_dashboard/dashboards/admin/networks/subnets/tests.py View File

@@ -32,6 +32,8 @@ NETWORKS_DETAIL_URL = 'horizon:admin:networks:detail'
32 32
 
33 33
 class NetworkSubnetTests(test.BaseAdminViewTests):
34 34
 
35
+    use_mox = True
36
+
35 37
     @test.create_stubs({api.neutron: ('network_get',
36 38
                                       'subnet_get',
37 39
                                       'is_extension_supported')})

+ 3
- 0
openstack_dashboard/dashboards/admin/networks/tests.py View File

@@ -31,6 +31,9 @@ INDEX_URL = reverse('horizon:admin:networks:index')
31 31
 
32 32
 
33 33
 class NetworkTests(test.BaseAdminViewTests):
34
+
35
+    use_mox = True
36
+
34 37
     @test.create_stubs({api.neutron: ('network_list',
35 38
                                       'list_dhcp_agent_hosting_networks',
36 39
                                       'is_extension_supported'),

+ 2
- 0
openstack_dashboard/dashboards/admin/overview/tests.py View File

@@ -38,6 +38,8 @@ INDEX_URL = reverse('horizon:project:overview:index')
38 38
 
39 39
 class UsageViewTests(test.BaseAdminViewTests):
40 40
 
41
+    use_mox = True
42
+
41 43
     def _stub_api_calls(self, nova_stu_enabled):
42 44
         self.mox.StubOutWithMock(api.nova, 'usage_list')
43 45
         self.mox.StubOutWithMock(api.nova, 'extension_supported')

+ 9
- 0
openstack_dashboard/dashboards/identity/domains/tests.py View File

@@ -36,6 +36,9 @@ GROUP_ROLE_PREFIX = constants.DOMAIN_GROUP_MEMBER_SLUG + "_role_"
36 36
 
37 37
 
38 38
 class DomainsViewTests(test.BaseAdminViewTests):
39
+
40
+    use_mox = True
41
+
39 42
     @test.create_stubs({api.keystone: ('domain_get',
40 43
                                        'domain_list',)})
41 44
     def test_index(self):
@@ -175,6 +178,9 @@ class DomainsViewTests(test.BaseAdminViewTests):
175 178
 
176 179
 
177 180
 class CreateDomainWorkflowTests(test.BaseAdminViewTests):
181
+
182
+    use_mox = True
183
+
178 184
     def _get_domain_info(self, domain):
179 185
         domain_info = {"name": domain.name,
180 186
                        "description": domain.description,
@@ -218,6 +224,9 @@ class CreateDomainWorkflowTests(test.BaseAdminViewTests):
218 224
 
219 225
 
220 226
 class UpdateDomainWorkflowTests(test.BaseAdminViewTests):
227
+
228
+    use_mox = True
229
+
221 230
     def _get_domain_info(self, domain):
222 231
         domain_info = {"domain_id": domain.id,
223 232
                        "name": domain.name,

+ 3
- 0
openstack_dashboard/dashboards/identity/groups/tests.py View File

@@ -32,6 +32,9 @@ GROUP_ADD_MEMBER_URL = reverse(constants.GROUPS_ADD_MEMBER_URL, args=[1])
32 32
 
33 33
 
34 34
 class GroupsViewTests(test.BaseAdminViewTests):
35
+
36
+    use_mox = True
37
+
35 38
     def _get_domain_id(self):
36 39
         return self.request.session.get('domain_context', None)
37 40
 

+ 2
- 0
openstack_dashboard/dashboards/identity/identity_providers/protocols/tests.py View File

@@ -31,6 +31,8 @@ PROTOCOLS_CREATE_URL = reverse(
31 31
 
32 32
 class ProtocolsViewTests(test.BaseAdminViewTests):
33 33
 
34
+    use_mox = True
35
+
34 36
     @test.create_stubs({api.keystone: ('mapping_list',
35 37
                                        'protocol_create', )})
36 38
     def test_create(self):

+ 3
- 0
openstack_dashboard/dashboards/identity/identity_providers/tests.py View File

@@ -31,6 +31,9 @@ IDPS_DETAIL_URL = reverse('horizon:identity:identity_providers:detail',
31 31
 
32 32
 
33 33
 class IdPsViewTests(test.BaseAdminViewTests):
34
+
35
+    use_mox = True
36
+
34 37
     @test.create_stubs({api.keystone: ('identity_provider_list',)})
35 38
     def test_index(self):
36 39
         api.keystone.identity_provider_list(IgnoreArg()). \

+ 3
- 0
openstack_dashboard/dashboards/identity/mappings/tests.py View File

@@ -31,6 +31,9 @@ MAPPINGS_UPDATE_URL = reverse('horizon:identity:mappings:update',
31 31
 
32 32
 
33 33
 class MappingsViewTests(test.BaseAdminViewTests):
34
+
35
+    use_mox = True
36
+
34 37
     @test.create_stubs({api.keystone: ('mapping_list',)})
35 38
     def test_index(self):
36 39
         api.keystone.mapping_list(IgnoreArg()). \

+ 21
- 0
openstack_dashboard/dashboards/identity/projects/tests.py View File

@@ -41,6 +41,9 @@ PROJECT_DETAIL_URL = reverse('horizon:identity:projects:detail', args=[1])
41 41
 
42 42
 
43 43
 class TenantsViewTests(test.BaseAdminViewTests):
44
+
45
+    use_mox = True
46
+
44 47
     @test.create_stubs({api.keystone: ('domain_get',
45 48
                                        'tenant_list',
46 49
                                        'domain_lookup'),
@@ -102,6 +105,9 @@ class TenantsViewTests(test.BaseAdminViewTests):
102 105
 
103 106
 
104 107
 class ProjectsViewNonAdminTests(test.TestCase):
108
+
109
+    use_mox = True
110
+
105 111
     @override_settings(POLICY_CHECK_FUNCTION='openstack_auth.policy.check')
106 112
     @test.create_stubs({api.keystone: ('tenant_list',
107 113
                                        'domain_lookup')})
@@ -125,6 +131,9 @@ class ProjectsViewNonAdminTests(test.TestCase):
125 131
 
126 132
 
127 133
 class CreateProjectWorkflowTests(test.BaseAdminViewTests):
134
+
135
+    use_mox = True
136
+
128 137
     def _get_project_info(self, project):
129 138
         domain = self._get_default_domain()
130 139
         project_info = {"name": project.name,
@@ -443,6 +452,9 @@ class CreateProjectWorkflowTests(test.BaseAdminViewTests):
443 452
 
444 453
 
445 454
 class UpdateProjectWorkflowTests(test.BaseAdminViewTests):
455
+
456
+    use_mox = True
457
+
446 458
     def _get_all_users(self, domain_id):
447 459
         if not domain_id:
448 460
             users = self.users.list()
@@ -870,6 +882,9 @@ class UpdateProjectWorkflowTests(test.BaseAdminViewTests):
870 882
 
871 883
 
872 884
 class UpdateQuotasWorkflowTests(test.BaseAdminViewTests):
885
+
886
+    use_mox = True
887
+
873 888
     def _get_quota_info(self, quota):
874 889
         cinder_quota = self.cinder_quotas.first()
875 890
         neutron_quota = self.neutron_quotas.first()
@@ -1048,6 +1063,9 @@ class UpdateQuotasWorkflowTests(test.BaseAdminViewTests):
1048 1063
 
1049 1064
 
1050 1065
 class UsageViewTests(test.BaseAdminViewTests):
1066
+
1067
+    use_mox = True
1068
+
1051 1069
     def _stub_nova_api_calls(self, nova_stu_enabled=True):
1052 1070
         self.mox.StubOutWithMock(api.nova, 'usage_get')
1053 1071
         self.mox.StubOutWithMock(api.nova, 'extension_supported')
@@ -1100,6 +1118,9 @@ class UsageViewTests(test.BaseAdminViewTests):
1100 1118
 
1101 1119
 
1102 1120
 class DetailProjectViewTests(test.BaseAdminViewTests):
1121
+
1122
+    use_mox = True
1123
+
1103 1124
     @test.create_stubs({api.keystone: ('tenant_get',),
1104 1125
                         quotas: ('enabled_quotas',)})
1105 1126
     def test_detail_view(self):

+ 3
- 0
openstack_dashboard/dashboards/identity/roles/tests.py View File

@@ -29,6 +29,9 @@ INDEX_TEMPLATE = 'horizon/common/_data_table_view.html'
29 29
 
30 30
 
31 31
 class RolesViewTests(test.BaseAdminViewTests):
32
+
33
+    use_mox = True
34
+
32 35
     @test.create_stubs({api.keystone: ('role_list',)})
33 36
     def test_index(self):
34 37
         filters = {}

+ 3
- 0
openstack_dashboard/dashboards/identity/users/tests.py View File

@@ -38,6 +38,9 @@ USER_CHANGE_PASSWORD_URL = reverse('horizon:identity:users:change_password',
38 38
 
39 39
 
40 40
 class UsersViewTests(test.BaseAdminViewTests):
41
+
42
+    use_mox = True
43
+
41 44
     def _get_default_domain(self):
42 45
         domain = {"id": self.request.session.get('domain_context',
43 46
                                                  None),

+ 0
- 4
openstack_dashboard/dashboards/project/instances/tests.py View File

@@ -76,8 +76,6 @@ class InstanceTestBase(helpers.ResetImageAPIVersionMixin,
76 76
                        InstanceTestHelperMixin,
77 77
                        helpers.TestCase):
78 78
 
79
-    use_mox = False
80
-
81 79
     def setUp(self):
82 80
         super(InstanceTestBase, self).setUp()
83 81
         if api.glance.VERSIONS.active < 2:
@@ -4988,8 +4986,6 @@ class InstanceAjaxTests(helpers.TestCase, InstanceTestHelperMixin):
4988 4986
 
4989 4987
 class ConsoleManagerTests(helpers.ResetImageAPIVersionMixin, helpers.TestCase):
4990 4988
 
4991
-    use_mox = False
4992
-
4993 4989
     def setup_consoles(self):
4994 4990
         # Need to refresh with mocks or will fail since mox do not detect
4995 4991
         # the api_call() as mocked.

+ 0
- 8
openstack_dashboard/dashboards/project/routers/tests.py View File

@@ -84,8 +84,6 @@ class RouterMixin(object):
84 84
 
85 85
 class RouterTestCase(object):
86 86
 
87
-    use_mox = False
88
-
89 87
     @test.create_mocks({api.neutron: ('router_list',
90 88
                                       'network_list',
91 89
                                       'is_extension_supported'),
@@ -298,8 +296,6 @@ class RouterActionTests(test.TestCase):
298 296
     INDEX_URL = reverse('horizon:%s:routers:index' % DASHBOARD)
299 297
     DETAIL_PATH = 'horizon:%s:routers:detail' % DASHBOARD
300 298
 
301
-    use_mox = False
302
-
303 299
     @test.create_mocks({api.neutron: ('router_create',
304 300
                                       'get_feature_permission',
305 301
                                       'network_list',
@@ -1050,8 +1046,6 @@ class RouterActionTests(test.TestCase):
1050 1046
 
1051 1047
 class RouterRouteTestCase(object):
1052 1048
 
1053
-    use_mox = False
1054
-
1055 1049
     @test.create_mocks({api.neutron: ('router_get',
1056 1050
                                       'port_list',
1057 1051
                                       'network_get',
@@ -1165,8 +1159,6 @@ class RouterViewTests(RouterMixin, test.TestCase):
1165 1159
     DASHBOARD = 'project'
1166 1160
     INDEX_URL = reverse('horizon:%s:routers:index' % DASHBOARD)
1167 1161
 
1168
-    use_mox = False
1169
-
1170 1162
     @test.create_mocks({api.neutron: ('router_list',
1171 1163
                                       'network_list',
1172 1164
                                       'is_extension_supported'),

+ 14
- 13
openstack_dashboard/test/helpers.py View File

@@ -261,11 +261,6 @@ class TestCase(horizon_helpers.TestCase):
261 261
     # boolean variable to store failures
262 262
     missing_mocks = False
263 263
 
264
-    # Most openstack_dashbaord tests depends on mox,
265
-    # we mark use_mox to True by default.
266
-    # Eventually we can drop this when mock migration has good progress.
267
-    use_mox = True
268
-
269 264
     def fake_conn_request(self):
270 265
         # print a stacktrace to illustrate where the unmocked API call
271 266
         # is being made from
@@ -493,8 +488,16 @@ class APITestCase(TestCase):
493 488
     For use with tests which deal with the underlying clients rather than
494 489
     stubbing out the openstack_dashboard.api.* methods.
495 490
     """
491
+
492
+    # NOTE: This test class depends on mox but does not declare use_mox = True
493
+    # to notify mox is no longer recommended.
494
+    # If a consumer would like to use this class, declare use_mox = True.
495
+
496 496
     def setUp(self):
497 497
         super(APITestCase, self).setUp()
498
+        LOG.warning("APITestCase has been deprecated in favor of mock usage "
499
+                    "and will be removed at the beginning of 'Stein' release. "
500
+                    "Please convert your to use APIMockTestCase instead.")
498 501
         utils.patch_middleware_get_user()
499 502
 
500 503
         def fake_keystoneclient(request, admin=False):
@@ -547,7 +550,7 @@ class APITestCase(TestCase):
547 550
         )
548 551
 
549 552
     def stub_novaclient(self):
550
-        self._warn_client('nova', 'S')
553
+        self._warn_client('nova', 'Stein')
551 554
         if not hasattr(self, "novaclient"):
552 555
             self.mox.StubOutWithMock(nova_client, 'Client')
553 556
             # mock the api_version since MockObject.__init__ ignores it.
@@ -562,14 +565,14 @@ class APITestCase(TestCase):
562 565
         return self.novaclient
563 566
 
564 567
     def stub_cinderclient(self):
565
-        self._warn_client('cinder', 'S')
568
+        self._warn_client('cinder', 'Stein')
566 569
         if not hasattr(self, "cinderclient"):
567 570
             self.mox.StubOutWithMock(cinder_client, 'Client')
568 571
             self.cinderclient = self.mox.CreateMock(cinder_client.Client)
569 572
         return self.cinderclient
570 573
 
571 574
     def stub_keystoneclient(self):
572
-        self._warn_client('keystone', 'S')
575
+        self._warn_client('keystone', 'Stein')
573 576
         if not hasattr(self, "keystoneclient"):
574 577
             self.mox.StubOutWithMock(keystone_client, 'Client')
575 578
             # NOTE(saschpe): Mock properties, MockObject.__init__ ignores them:
@@ -583,21 +586,21 @@ class APITestCase(TestCase):
583 586
         return self.keystoneclient
584 587
 
585 588
     def stub_glanceclient(self):
586
-        self._warn_client('glance', 'S')
589
+        self._warn_client('glance', 'Stein')
587 590
         if not hasattr(self, "glanceclient"):
588 591
             self.mox.StubOutWithMock(glanceclient, 'Client')
589 592
             self.glanceclient = self.mox.CreateMock(glanceclient.Client)
590 593
         return self.glanceclient
591 594
 
592 595
     def stub_neutronclient(self):
593
-        self._warn_client('neutron', 'S')
596
+        self._warn_client('neutron', 'Stein')
594 597
         if not hasattr(self, "neutronclient"):
595 598
             self.mox.StubOutWithMock(neutron_client, 'Client')
596 599
             self.neutronclient = self.mox.CreateMock(neutron_client.Client)
597 600
         return self.neutronclient
598 601
 
599 602
     def stub_swiftclient(self, expected_calls=1):
600
-        self._warn_client('swift', 'S')
603
+        self._warn_client('swift', 'Stein')
601 604
         if not hasattr(self, "swiftclient"):
602 605
             self.mox.StubOutWithMock(swift_client, 'Connection')
603 606
             self.swiftclient = self.mox.CreateMock(swift_client.Connection)
@@ -617,8 +620,6 @@ class APITestCase(TestCase):
617 620
 
618 621
 class APIMockTestCase(TestCase):
619 622
 
620
-    use_mox = False
621
-
622 623
     def setUp(self):
623 624
         super(APIMockTestCase, self).setUp()
624 625
         utils.patch_middleware_get_user()

+ 0
- 2
openstack_dashboard/test/unit/api/rest/test_cinder.py View File

@@ -25,8 +25,6 @@ from openstack_dashboard.usage import quotas
25 25
 
26 26
 class CinderRestTestCase(test.TestCase):
27 27
 
28
-    use_mox = False
29
-
30 28
     #
31 29
     # Volumes
32 30
     #

+ 0
- 2
openstack_dashboard/test/unit/api/rest/test_config.py View File

@@ -18,8 +18,6 @@ from openstack_dashboard.test import helpers as test
18 18
 
19 19
 class ConfigRestTestCase(test.TestCase):
20 20
 
21
-    use_mox = False
22
-
23 21
     def test_settings_config_get(self):
24 22
         request = self.mock_rest_request()
25 23
         response = config.Settings().get(request)

+ 0
- 2
openstack_dashboard/test/unit/api/rest/test_glance.py View File

@@ -21,8 +21,6 @@ from openstack_dashboard.test import helpers as test
21 21
 
22 22
 class ImagesRestTestCase(test.ResetImageAPIVersionMixin, test.TestCase):
23 23
 
24
-    use_mox = False
25
-
26 24
     def setUp(self):
27 25
         super(ImagesRestTestCase, self).setUp()
28 26
         api.glance.VERSIONS.clear_active_cache()

+ 0
- 2
openstack_dashboard/test/unit/api/rest/test_keystone.py View File

@@ -24,8 +24,6 @@ from openstack_dashboard.test import helpers as test
24 24
 
25 25
 class KeystoneRestTestCase(test.TestCase):
26 26
 
27
-    use_mox = False
28
-
29 27
     #
30 28
     # Version
31 29
     #

+ 0
- 4
openstack_dashboard/test/unit/api/rest/test_network.py View File

@@ -20,8 +20,6 @@ from openstack_dashboard.test import helpers as test
20 20
 
21 21
 class RestNetworkApiSecurityGroupTests(test.TestCase):
22 22
 
23
-    use_mox = False
24
-
25 23
     @test.create_mocks({api.neutron: ['security_group_list']})
26 24
     def test_security_group_detailed(self):
27 25
         request = self.mock_rest_request()
@@ -38,8 +36,6 @@ class RestNetworkApiSecurityGroupTests(test.TestCase):
38 36
 
39 37
 class RestNetworkApiFloatingIpTests(test.TestCase):
40 38
 
41
-    use_mox = False
42
-
43 39
     @test.create_mocks({api.neutron: ['tenant_floating_ip_list']})
44 40
     def test_floating_ip_list(self):
45 41
         request = self.mock_rest_request()

+ 0
- 16
openstack_dashboard/test/unit/api/rest/test_neutron.py View File

@@ -25,8 +25,6 @@ from openstack_dashboard.usage import quotas
25 25
 
26 26
 class NeutronNetworksTestCase(test.TestCase):
27 27
 
28
-    use_mox = False
29
-
30 28
     def _dictify_network(self, network):
31 29
         net_dict = network.to_dict()
32 30
         net_dict['subnets'] = [s.to_dict() for s in net_dict['subnets']]
@@ -112,8 +110,6 @@ class NeutronNetworksTestCase(test.TestCase):
112 110
 
113 111
 class NeutronSubnetsTestCase(test.TestCase):
114 112
 
115
-    use_mox = False
116
-
117 113
     @mock.patch.object(api.neutron, 'subnet_list')
118 114
     def test_get(self, mock_subnet_list):
119 115
         network_id = self.networks.first().id
@@ -146,8 +142,6 @@ class NeutronSubnetsTestCase(test.TestCase):
146 142
 
147 143
 class NeutronPortsTestCase(test.TestCase):
148 144
 
149
-    use_mox = False
150
-
151 145
     @mock.patch.object(api.neutron, 'port_list_with_trunk_types')
152 146
     def test_get(self, mock_port_list_with_trunk_types):
153 147
         network_id = self.networks.first().id
@@ -162,8 +156,6 @@ class NeutronPortsTestCase(test.TestCase):
162 156
 
163 157
 class NeutronTrunkTestCase(test.TestCase):
164 158
 
165
-    use_mox = False
166
-
167 159
     @mock.patch.object(api.neutron, 'trunk_delete')
168 160
     def test_trunk_delete(self, mock_trunk_delete):
169 161
         mock_trunk_delete.return_value = None
@@ -198,8 +190,6 @@ class NeutronTrunkTestCase(test.TestCase):
198 190
 
199 191
 class NeutronTrunksTestCase(test.TestCase):
200 192
 
201
-    use_mox = False
202
-
203 193
     @mock.patch.object(api.neutron, 'trunk_list')
204 194
     def test_trunks_get(self, mock_trunk_list):
205 195
         request = self.mock_rest_request(GET=django_request.QueryDict())
@@ -227,8 +217,6 @@ class NeutronTrunksTestCase(test.TestCase):
227 217
 
228 218
 class NeutronExtensionsTestCase(test.TestCase):
229 219
 
230
-    use_mox = False
231
-
232 220
     @mock.patch.object(api.neutron, 'list_extensions')
233 221
     def test_list_extensions(self, mock_list_extensions):
234 222
         request = self.mock_rest_request(**{'GET': {}})
@@ -241,8 +229,6 @@ class NeutronExtensionsTestCase(test.TestCase):
241 229
 
242 230
 class NeutronDefaultQuotasTestCase(test.TestCase):
243 231
 
244
-    use_mox = False
245
-
246 232
     @test.create_mocks({api.base: ['is_service_enabled'],
247 233
                         api.neutron: ['tenant_quota_get']})
248 234
     def test_quotas_sets_defaults_get_when_service_is_enabled(self):
@@ -283,8 +269,6 @@ class NeutronDefaultQuotasTestCase(test.TestCase):
283 269
 
284 270
 class NeutronQuotaSetsTestCase(test.TestCase):
285 271
 
286
-    use_mox = False
287
-
288 272
     @test.create_mocks({api.base: ['is_service_enabled'],
289 273
                         api.neutron: ['is_extension_supported',
290 274
                                       'tenant_quota_update'],

+ 0
- 2
openstack_dashboard/test/unit/api/rest/test_nova.py View File

@@ -28,8 +28,6 @@ from openstack_dashboard.usage import quotas
28 28
 
29 29
 class NovaRestTestCase(test.TestCase):
30 30
 
31
-    use_mox = False
32
-
33 31
     #
34 32
     # Snapshots
35 33
     #

+ 0
- 2
openstack_dashboard/test/unit/api/rest/test_policy.py View File

@@ -20,8 +20,6 @@ from openstack_dashboard.test import helpers as test
20 20
 
21 21
 class PolicyRestTestCase(test.TestCase):
22 22
 
23
-    use_mox = False
24
-
25 23
     @override_settings(POLICY_CHECK_FUNCTION='openstack_auth.policy.check')
26 24
     def _test_policy(self, body, expected=True):
27 25
         request = self.mock_rest_request(body=body)

+ 0
- 2
openstack_dashboard/test/unit/api/rest/test_swift.py View File

@@ -20,8 +20,6 @@ from openstack_dashboard.test import helpers as test
20 20
 
21 21
 class SwiftRestTestCase(test.TestCase):
22 22
 
23
-    use_mox = False
24
-
25 23
     #
26 24
     # Version
27 25
     #

+ 0
- 4
openstack_dashboard/test/unit/api/rest/test_utils.py View File

@@ -18,8 +18,6 @@ from openstack_dashboard.test import helpers as test
18 18
 
19 19
 class RestUtilsTestCase(test.TestCase):
20 20
 
21
-    use_mox = False
22
-
23 21
     def test_api_success(self):
24 22
         @utils.ajax()
25 23
         def f(self, request):
@@ -168,8 +166,6 @@ class RestUtilsTestCase(test.TestCase):
168 166
 
169 167
 class JSONEncoderTestCase(test.TestCase):
170 168
 
171
-    use_mox = False
172
-
173 169
     # NOTE(tsufiev): NaN numeric is "conventional" in a sense that the custom
174 170
     # NaNJSONEncoder encoder translates it to the same token that the standard
175 171
     # JSONEncoder encoder does

+ 0
- 12
openstack_dashboard/test/unit/api/test_base.py View File

@@ -60,8 +60,6 @@ class APIDict(api_base.APIDictWrapper):
60 60
 
61 61
 class APIVersionTests(test.TestCase):
62 62
 
63
-    use_mox = False
64
-
65 63
     def test_equal(self):
66 64
         version = api_base.Version('1.0')
67 65
         self.assertEqual(1, version)
@@ -109,8 +107,6 @@ class APIVersionTests(test.TestCase):
109 107
 # Wrapper classes that only define _attrs don't need extra testing.
110 108
 class APIResourceWrapperTests(test.TestCase):
111 109
 
112
-    use_mox = False
113
-
114 110
     def test_get_attribute(self):
115 111
         resource = APIResource.get_instance()
116 112
         self.assertEqual('foo', resource.foo)
@@ -138,8 +134,6 @@ class APIResourceWrapperTests(test.TestCase):
138 134
 
139 135
 class APIDictWrapperTests(test.TestCase):
140 136
 
141
-    use_mox = False
142
-
143 137
     # APIDict allows for both attribute access and dictionary style [element]
144 138
     # style access.  Test both
145 139
     def test_get_item(self):
@@ -208,8 +202,6 @@ class APIDictWrapperTests(test.TestCase):
208 202
 
209 203
 class ApiVersionTests(test.TestCase):
210 204
 
211
-    use_mox = False
212
-
213 205
     def setUp(self):
214 206
         super(ApiVersionTests, self).setUp()
215 207
         self.previous_settings = settings.OPENSTACK_API_VERSIONS
@@ -247,8 +239,6 @@ class ApiVersionTests(test.TestCase):
247 239
 class ApiHelperTests(test.TestCase):
248 240
     """Tests for functions that don't use one of the api objects."""
249 241
 
250
-    use_mox = False
251
-
252 242
     def test_url_for(self):
253 243
         url = api_base.url_for(self.request, 'image')
254 244
         self.assertEqual('http://public.glance.example.com:9292', url)
@@ -304,8 +294,6 @@ class ApiHelperTests(test.TestCase):
304 294
 
305 295
 class QuotaSetTests(test.TestCase):
306 296
 
307
-    use_mox = False
308
-
309 297
     def test_quotaset_add_with_plus(self):
310 298
         quota_dict = {'foo': 1, 'bar': 10}
311 299
         other_quota_dict = {'my_test': 12}

+ 0
- 2
openstack_dashboard/test/unit/api/test_nova.py View File

@@ -36,8 +36,6 @@ from openstack_dashboard.test import helpers as test
36 36
 
37 37
 class ServerWrapperTests(test.TestCase):
38 38
 
39
-    use_mox = False
40
-
41 39
     def test_get_base_attribute(self):
42 40
         server = api.nova.Server(self.servers.first(), self.request)
43 41
         self.assertEqual(self.servers.first().id, server.id)

+ 0
- 2
openstack_dashboard/test/unit/usage/test_quotas.py View File

@@ -34,8 +34,6 @@ from openstack_dashboard.usage import quotas
34 34
 
35 35
 class QuotaTests(test.APITestCase):
36 36
 
37
-    use_mox = False
38
-
39 37
     def _mock_service_enabled(self, compute_enabled=True,
40 38
                               network_enabled=False, volume_enabled=True):
41 39
         services = {'network': network_enabled,

Loading…
Cancel
Save