Browse Source

update test code after the unittest reorg

The structure for the unit test tree in neutron has
been changed, so we need to update our unit tests
accordingly.

policy_file override is no longer required, as it has
been fixed in neutron upstream.

Change-Id: Id5d2d6f7d97c1c68c4dfe864d4916dcf757ddf5d
Harkirat Singh 4 years ago
parent
commit
5921b3b1c6

+ 0
- 51
networking_brocade/vyatta/tests/base.py View File

@@ -1,51 +0,0 @@
1
-# Copyright 2015 Brocade Communications System, Inc.
2
-# All Rights Reserved.
3
-#
4
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
5
-#    not use this file except in compliance with the License. You may obtain
6
-#    a copy of the License at
7
-#
8
-#         http://www.apache.org/licenses/LICENSE-2.0
9
-#
10
-#    Unless required by applicable law or agreed to in writing, software
11
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
-#    License for the specific language governing permissions and limitations
14
-#    under the License.
15
-
16
-import os
17
-
18
-import neutron
19
-from neutron.tests import base as n_base
20
-from neutron.tests.unit import test_db_plugin
21
-from neutron.tests.unit import testlib_api
22
-from oslo_config import cfg
23
-
24
-
25
-def override_nvalues():
26
-    neutron_path = os.path.abspath(
27
-        os.path.join(os.path.dirname(neutron.__file__), os.pardir))
28
-    neutron_policy = os.path.join(neutron_path, 'etc/policy.json')
29
-    cfg.CONF.set_override('policy_file', neutron_policy)
30
-
31
-
32
-class BaseTestCase(n_base.BaseTestCase):
33
-
34
-    def setUp(self):
35
-        override_nvalues()
36
-        super(BaseTestCase, self).setUp()
37
-
38
-
39
-class NeutronDbPluginV2TestCase(test_db_plugin.NeutronDbPluginV2TestCase):
40
-
41
-    def setUp(self, plugin=None, service_plugins=None, ext_mgr=None):
42
-        override_nvalues()
43
-        super(NeutronDbPluginV2TestCase, self).setUp(
44
-            plugin, service_plugins, ext_mgr)
45
-
46
-
47
-class SqlTestCase(testlib_api.SqlTestCase):
48
-
49
-    def setUp(self):
50
-        override_nvalues()
51
-        super(SqlTestCase, self).setUp()

+ 5
- 5
networking_brocade/vyatta/tests/test_vrouter_driver.py View File

@@ -20,9 +20,9 @@ import urllib
20 20
 from neutron import context
21 21
 from neutron.db import models_v2
22 22
 from neutron.openstack.common import uuidutils
23
+from neutron.tests import base as n_base
23 24
 
24 25
 from networking_brocade.vyatta.common import utils as vyatta_utils
25
-from networking_brocade.vyatta.tests import base
26 26
 from networking_brocade.vyatta.vrouter import client as vyatta_client
27 27
 from networking_brocade.vyatta.vrouter import driver as vrouter_driver
28 28
 
@@ -40,7 +40,7 @@ def mock_object(target, attribute, new=mock.DEFAULT):
40 40
     return patcher.start()
41 41
 
42 42
 
43
-class TestVRouterDriver(base.BaseTestCase):
43
+class TestVRouterDriver(n_base.BaseTestCase):
44 44
     def setUp(self):
45 45
         super(TestVRouterDriver, self).setUp()
46 46
 
@@ -198,7 +198,7 @@ class TestVRouterDriver(base.BaseTestCase):
198 198
             routes_to_add, routes_to_del)
199 199
 
200 200
 
201
-class TestVRouterDriverApi(base.BaseTestCase):
201
+class TestVRouterDriverApi(n_base.BaseTestCase):
202 202
 
203 203
     def setUp(self):
204 204
         super(TestVRouterDriverApi, self).setUp()
@@ -322,7 +322,7 @@ class VRouterRestAPIClientMixin(object):
322 322
         return client
323 323
 
324 324
 
325
-class TestVRouterRestAPIClient(base.BaseTestCase,
325
+class TestVRouterRestAPIClient(n_base.BaseTestCase,
326 326
                                VRouterRestAPIClientMixin):
327 327
 
328 328
     def setUp(self):
@@ -626,7 +626,7 @@ class TestVRouterRestAPIClient(base.BaseTestCase,
626 626
         return response
627 627
 
628 628
 
629
-class TestLowLevelRestAPIClient(base.BaseTestCase,
629
+class TestLowLevelRestAPIClient(n_base.BaseTestCase,
630 630
                                 VRouterRestAPIClientMixin):
631 631
     def test_get_admin_state(self):
632 632
 

+ 6
- 4
networking_brocade/vyatta/tests/test_vrouter_neutron_plugin.py View File

@@ -22,10 +22,12 @@ from neutron.db import external_net_db
22 22
 from neutron.db import models_v2
23 23
 from neutron.extensions import l3
24 24
 from neutron.openstack.common import uuidutils
25
-from neutron.tests.unit import test_l3_plugin
25
+from neutron.tests.unit.db import test_db_base_plugin_v2 as test_db_plugin
26
+from neutron.tests.unit.extensions import test_l3 as test_l3_plugin
27
+from neutron.tests.unit import testlib_api
28
+
26 29
 
27 30
 from networking_brocade.vyatta.common import utils as vyatta_utils
28
-from networking_brocade.vyatta.tests import base
29 31
 from networking_brocade.vyatta.vrouter import neutron_plugin as vrouter_plugin
30 32
 
31 33
 _uuid = uuidutils.generate_uuid
@@ -44,7 +46,7 @@ class VRouterTestPlugin(vrouter_plugin.VyattaVRouterMixin,
44 46
         super(VRouterTestPlugin, self).delete_port(context, port_id)
45 47
 
46 48
 
47
-class TestVyattaVRouterPlugin(base.SqlTestCase):
49
+class TestVyattaVRouterPlugin(testlib_api.SqlTestCase):
48 50
     def setUp(self):
49 51
         super(TestVyattaVRouterPlugin, self).setUp()
50 52
 
@@ -323,7 +325,7 @@ class TestVRouterNatPlugin(test_l3_plugin.TestL3NatBasePlugin):
323 325
     supported_extension_aliases = ["external-net"]
324 326
 
325 327
 
326
-class VRouterTestCase(base.NeutronDbPluginV2TestCase,
328
+class VRouterTestCase(test_db_plugin.NeutronDbPluginV2TestCase,
327 329
                       test_l3_plugin.L3NatTestCaseBase):
328 330
     def setUp(self, core_plugin=None, l3_plugin=None, ext_mgr=None):
329 331
 

Loading…
Cancel
Save