]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Move test_extend_port_dict_no_port_security to where it belongs to
authorYAMAMOTO Takashi <yamamoto@midokura.com>
Thu, 22 Oct 2015 04:48:20 +0000 (13:48 +0900)
committerYAMAMOTO Takashi <yamamoto@midokura.com>
Thu, 22 Oct 2015 04:50:56 +0000 (13:50 +0900)
extensions/test_portsecurity doesn't seem like an appropriate
place for tests which examine details of ML2 extension driver.

Change-Id: I56c38a334cba45e204184e5d7d9284dacc29a2e1

neutron/tests/unit/extensions/test_portsecurity.py
neutron/tests/unit/plugins/ml2/extensions/test_port_security.py [new file with mode: 0644]

index 353477b6cd30fec68f6da33b33f3ef42b41695e0..c307d771e00588717cc2ac989ed2ce48faeaa0b7 100644 (file)
@@ -23,7 +23,6 @@ from neutron.db import securitygroups_db
 from neutron.extensions import portsecurity as psec
 from neutron.extensions import securitygroup as ext_sg
 from neutron import manager
-from neutron.plugins.ml2.extensions import port_security
 from neutron.tests.unit.db import test_db_base_plugin_v2
 from neutron.tests.unit.extensions import test_securitygroup
 
@@ -400,15 +399,3 @@ class TestPortSecurity(PortSecurityDBTestCase):
                     '', 'not_network_owner')
                 res = req.get_response(self.api)
                 self.assertEqual(res.status_int, exc.HTTPForbidden.code)
-
-    def test_extend_port_dict_no_port_security(self):
-        """Test _extend_port_security_dict won't crash
-        if port_security item is None
-        """
-        for db_data in ({'port_security': None, 'name': 'net1'}, {}):
-            response_data = {}
-
-            driver = port_security.PortSecurityExtensionDriver()
-            driver._extend_port_security_dict(response_data, db_data)
-
-            self.assertTrue(response_data[psec.PORTSECURITY])
diff --git a/neutron/tests/unit/plugins/ml2/extensions/test_port_security.py b/neutron/tests/unit/plugins/ml2/extensions/test_port_security.py
new file mode 100644 (file)
index 0000000..06ebd5b
--- /dev/null
@@ -0,0 +1,32 @@
+# Copyright (c) 2015 OpenStack Foundation.
+# All Rights Reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#    License for the specific language governing permissions and limitations
+#    under the License.
+
+from neutron.extensions import portsecurity as psec
+from neutron.plugins.ml2.extensions import port_security
+from neutron.tests.unit.plugins.ml2 import test_plugin
+
+
+class TestML2ExtensionPortSecurity(test_plugin.Ml2PluginV2TestCase):
+    def test_extend_port_dict_no_port_security(self):
+        """Test _extend_port_security_dict won't crash
+        if port_security item is None
+        """
+        for db_data in ({'port_security': None, 'name': 'net1'}, {}):
+            response_data = {}
+
+            driver = port_security.PortSecurityExtensionDriver()
+            driver._extend_port_security_dict(response_data, db_data)
+
+            self.assertTrue(response_data[psec.PORTSECURITY])