fixing unit_test

This commit is contained in:
Junaid Ali 2016-05-04 03:26:19 -04:00
parent 66a8db2ae0
commit a8be08ad7e
1 changed files with 6 additions and 11 deletions

View File

@ -24,13 +24,10 @@ class NeutronPGContextTest(CharmTestCase):
self.relation_get.side_effect = self.test_relation.get
self.config.side_effect = self.test_config.get
self.test_config.set('enable-metadata', False)
self.test_config.set('plumgrid-username', 'plumgrid')
self.test_config.set('plumgrid-password', 'plumgrid')
self.test_config.set('plumgrid-virtual-ip', '192.168.100.250')
def tearDown(self):
super(NeutronPGContextTest, self).tearDown()
@patch.object(context, '_plumgrid_configs')
@patch.object(context, '_identity_context')
@patch.object(charmhelpers.contrib.openstack.context, 'config',
lambda *args: None)
@ -49,7 +46,7 @@ class NeutronPGContextTest(CharmTestCase):
def test_neutroncc_context_api_rel(self, _unit_priv_ip, _npa, _ens_pkgs,
_save_ff, _https, _is_clus, _unit_get,
_config, _runits, _rids, _rget,
_iden_context):
_iden_context, _plum_configs):
def mock_npa(plugin, section, manager):
if section == "driver":
return "neutron.randomdriver"
@ -58,9 +55,9 @@ class NeutronPGContextTest(CharmTestCase):
config = {
'enable-metadata': False,
'plumgrid-username': 'plumgrid',
'plumgrid-password': 'plumgrid',
'plumgrid-virtual-ip': '192.168.100.250',
#'plumgrid-username': 'plumgrid',
#'plumgrid-password': 'plumgrid',
#'plumgrid-virtual-ip': '192.168.100.250',
'hardware-vendor-name': 'vendor_name',
'switch-username': 'plumgrid',
'switch-password': 'plumgrid',
@ -76,14 +73,12 @@ class NeutronPGContextTest(CharmTestCase):
self.config.side_effect = mock_config
_npa.side_effect = mock_npa
_iden_context.return_value = None
_plum_configs.return_value = None
_unit_get.return_value = '192.168.100.201'
_unit_priv_ip.return_value = '192.168.100.201'
napi_ctxt = context.NeutronPGPluginContext()
expect = {
'enable_metadata': False,
'pg_username': 'plumgrid',
'pg_password': 'plumgrid',
'virtual_ip': '192.168.100.250',
'config': 'neutron.randomconfig',
'core_plugin': 'neutron.randomdriver',
'local_ip': '192.168.100.201',