Set lock_path correctly.
[openstack-build/neutron-build.git] / neutron / tests / unit / plugins / ml2 / extensions / test_port_security.py
1 # Copyright (c) 2015 OpenStack Foundation.
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 from neutron.extensions import portsecurity as psec
17 from neutron.plugins.ml2.extensions import port_security
18 from neutron.tests.unit.plugins.ml2 import test_plugin
19
20
21 class TestML2ExtensionPortSecurity(test_plugin.Ml2PluginV2TestCase):
22     def test_extend_port_dict_no_port_security(self):
23         """Test _extend_port_security_dict won't crash
24         if port_security item is None
25         """
26         for db_data in ({'port_security': None, 'name': 'net1'}, {}):
27             response_data = {}
28
29             driver = port_security.PortSecurityExtensionDriver()
30             driver._extend_port_security_dict(response_data, db_data)
31
32             self.assertTrue(response_data[psec.PORTSECURITY])