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