Fixed lint

This commit is contained in:
Liam Young 2015-03-25 10:31:44 +00:00
parent 7f32b61062
commit 0f1309df41
3 changed files with 11 additions and 9 deletions

View File

@ -16,6 +16,7 @@ TO_PATCH = [
'get_host_ip',
]
def fake_context(settings):
def outer():
def inner():
@ -23,6 +24,7 @@ def fake_context(settings):
return inner
return outer
class OVSPluginContextTest(CharmTestCase):
def setUp(self):
@ -262,7 +264,6 @@ class DVRSharedSecretContext(CharmTestCase):
TO_PATCH)
self.config.side_effect = self.test_config.get
@patch('os.path')
@patch('uuid.uuid4')
def test_secret_created_stored(self, _uuid4, _path):
@ -287,7 +288,8 @@ class DVRSharedSecretContext(CharmTestCase):
@patch.object(context, 'NeutronAPIContext')
@patch.object(context, 'get_shared_secret')
def test_shared_secretcontext_dvr(self, _shared_secret, _NeutronAPIContext):
def test_shared_secretcontext_dvr(self, _shared_secret,
_NeutronAPIContext):
_NeutronAPIContext.side_effect = fake_context({'enable_dvr': True})
_shared_secret.return_value = 'secret_thing'
#_use_dvr.return_value = True
@ -298,7 +300,8 @@ class DVRSharedSecretContext(CharmTestCase):
@patch.object(context, 'NeutronAPIContext')
@patch.object(context, 'get_shared_secret')
def test_shared_secretcontext_nodvr(self, _shared_secret, _NeutronAPIContext):
def test_shared_secretcontext_nodvr(self, _shared_secret,
_NeutronAPIContext):
_NeutronAPIContext.side_effect = fake_context({'enable_dvr': False})
_shared_secret.return_value = 'secret_thing'
self.resolve_address.return_value = '10.0.0.10'

View File

@ -1,7 +1,6 @@
from mock import MagicMock, patch, call
from test_utils import CharmTestCase
import neutron_ovs_context
with patch('charmhelpers.core.hookenv.config') as config:
config.return_value = 'neutron'

View File

@ -61,7 +61,7 @@ class TestNeutronOVSUtils(CharmTestCase):
# Reset cached cache
hookenv.cache = {}
@patch.object(nutils, 'use_dvr')
@patch.object(nutils, 'use_dvr')
@patch.object(charmhelpers.contrib.openstack.neutron, 'os_release')
@patch.object(charmhelpers.contrib.openstack.neutron, 'headers_package')
def test_determine_packages(self, _head_pkgs, _os_rel, _use_dvr):
@ -72,7 +72,7 @@ class TestNeutronOVSUtils(CharmTestCase):
expect = [['neutron-plugin-openvswitch-agent'], [head_pkg]]
self.assertItemsEqual(pkg_list, expect)
@patch.object(nutils, 'use_dvr')
@patch.object(nutils, 'use_dvr')
def test_register_configs(self, _use_dvr):
class _mock_OSConfigRenderer():
def __init__(self, templates_dir=None, openstack_release=None):
@ -92,7 +92,7 @@ class TestNeutronOVSUtils(CharmTestCase):
'/etc/init/os-charm-phy-nic-mtu.conf']
self.assertItemsEqual(_regconfs.configs, confs)
@patch.object(nutils, 'use_dvr')
@patch.object(nutils, 'use_dvr')
def test_resource_map(self, _use_dvr):
_use_dvr.return_value = False
_map = nutils.resource_map()
@ -101,7 +101,7 @@ class TestNeutronOVSUtils(CharmTestCase):
[self.assertIn(q_conf, _map.keys()) for q_conf in confs]
self.assertEqual(_map[nutils.NEUTRON_CONF]['services'], svcs)
@patch.object(nutils, 'use_dvr')
@patch.object(nutils, 'use_dvr')
def test_resource_map_dvr(self, _use_dvr):
_use_dvr.return_value = True
_map = nutils.resource_map()
@ -111,7 +111,7 @@ class TestNeutronOVSUtils(CharmTestCase):
[self.assertIn(q_conf, _map.keys()) for q_conf in confs]
self.assertEqual(_map[nutils.NEUTRON_CONF]['services'], svcs)
@patch.object(nutils, 'use_dvr')
@patch.object(nutils, 'use_dvr')
def test_restart_map(self, _use_dvr):
_use_dvr.return_value = False
_restart_map = nutils.restart_map()