More lint fixes

This commit is contained in:
Liam Young 2014-06-19 11:01:12 +01:00
parent 3c85d2249a
commit a600002f41
3 changed files with 17 additions and 18 deletions

View File

@ -35,9 +35,12 @@ class OVSPluginContextTest(CharmTestCase):
@patch.object(charmhelpers.contrib.openstack.context, 'https')
@patch.object(context.OVSPluginContext, '_save_flag_file')
@patch.object(context.OVSPluginContext, '_ensure_packages')
@patch.object(charmhelpers.contrib.openstack.context, 'neutron_plugin_attribute')
@patch.object(charmhelpers.contrib.openstack.context,
'neutron_plugin_attribute')
@patch.object(charmhelpers.contrib.openstack.context, 'unit_private_ip')
def test_neutroncc_context_api_rel(self, _unit_priv_ip, _npa, _ens_pkgs, _save_ff, _https, _is_clus, _unit_get, _config):
def test_neutroncc_context_api_rel(self, _unit_priv_ip, _npa, _ens_pkgs,
_save_ff, _https, _is_clus, _unit_get,
_config):
def mock_npa(plugin, section, manager):
if section == "driver":
return "neutron.randomdriver"

View File

@ -31,6 +31,7 @@ NEUTRON_CONF_DIR = "/etc/neutron"
NEUTRON_CONF = '%s/neutron.conf' % NEUTRON_CONF_DIR
class NeutronOVSHooksTests(CharmTestCase):
def setUp(self):
@ -61,7 +62,7 @@ class NeutronOVSHooksTests(CharmTestCase):
username='neutron',
vhost='openstack',
relation_id=None
)
)
def test_amqp_changed(self):
self.CONFIGS.complete_contexts.return_value = ['amqp']
@ -71,5 +72,3 @@ class NeutronOVSHooksTests(CharmTestCase):
def test_amqp_departed(self):
self._call_hook('amqp-relation-departed')
self.assertTrue(self.CONFIGS.write.called_with(NEUTRON_CONF))

View File

@ -1,5 +1,5 @@
from mock import MagicMock, call, patch
from mock import MagicMock, patch
from collections import OrderedDict
import charmhelpers.contrib.openstack.templating as templating
@ -9,7 +9,6 @@ import neutron_ovs_utils as nutils
from test_utils import (
CharmTestCase,
patch_open,
)
import charmhelpers
import charmhelpers.core.hookenv as hookenv
@ -21,6 +20,8 @@ TO_PATCH = [
]
head_pkg = 'linux-headers-3.15.0-5-generic'
def _mock_npa(plugin, attr, net_manager=None):
plugins = {
'ovs': {
@ -36,8 +37,8 @@ def _mock_npa(plugin, attr, net_manager=None):
}
return plugins[plugin][attr]
class TestNeutronOVSUtils(CharmTestCase):
class TestNeutronOVSUtils(CharmTestCase):
def setUp(self):
super(TestNeutronOVSUtils, self).setUp(nutils, TO_PATCH)
@ -47,8 +48,8 @@ class TestNeutronOVSUtils(CharmTestCase):
# Reset cached cache
hookenv.cache = {}
@patch.object(charmhelpers.contrib.openstack.neutron,'os_release')
@patch.object(charmhelpers.contrib.openstack.neutron,'headers_package')
@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):
_os_rel.return_value = 'trusty'
_head_pkgs.return_value = head_pkg
@ -56,7 +57,7 @@ class TestNeutronOVSUtils(CharmTestCase):
expect = ['neutron-plugin-openvswitch-agent', head_pkg]
self.assertItemsEqual(pkg_list, expect)
def test_register_configs(self):
def test_register_configs(self):
class _mock_OSConfigRenderer():
def __init__(self, templates_dir=None, openstack_release=None):
self.configs = []
@ -82,13 +83,9 @@ class TestNeutronOVSUtils(CharmTestCase):
_restart_map = nutils.restart_map()
ML2CONF = "/etc/neutron/plugins/ml2/ml2_conf.ini"
expect = OrderedDict([
(nutils.NEUTRON_CONF,
['neutron-plugin-openvswitch-agent'],
),
(ML2CONF,
['neutron-plugin-openvswitch-agent'],
),
])
(nutils.NEUTRON_CONF, ['neutron-plugin-openvswitch-agent']),
(ML2CONF, ['neutron-plugin-openvswitch-agent']),
])
self.assertTrue(len(expect) == len(_restart_map))
for item in _restart_map:
self.assertTrue(item in _restart_map)