~junaidali/charms/trusty/plumgrid-gateway/oil_bug

« back to all changes in this revision

Viewing changes to unit_tests/test_pg_gw_context.py

  • Committer: Hassaan Pasha
  • Date: 2015-08-10 16:45:08 UTC
  • Revision ID: hassaanp@plumgrid.com-20150810164508-7h25vzubijofikid
Updated unit tests for HA

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from test_utils import CharmTestCase
2
2
from mock import patch
3
3
import pg_gw_context as context
 
4
import pg_gw_utils as utils
4
5
import charmhelpers
5
6
 
6
7
TO_PATCH = [
7
 
    #'_pg_dir_settings',
8
8
    'config',
9
9
    'get_unit_hostname',
10
10
]
38
38
    @patch.object(context.PGGwContext, '_save_flag_file')
39
39
    @patch.object(context, '_pg_dir_settings')
40
40
    @patch.object(charmhelpers.contrib.openstack.context, 'neutron_plugin_attribute')
41
 
    def test_neutroncc_context_api_rel(self, _npa, _pg_dir_settings, _save_flag_file,
 
41
    @patch.object(utils, 'check_interface_type')
 
42
    def test_neutroncc_context_api_rel(self, _int_type, _npa, _pg_dir_settings, _save_flag_file,
42
43
                                       _config_flag, _unit_get, _unit_priv_ip, _config,
43
44
                                       _is_clus, _https, _ens_pkgs):
44
45
        def mock_npa(plugin, section, manager):
63
64
        _is_clus.return_value = False
64
65
        _config_flag.return_value = False
65
66
        _pg_dir_settings.return_value = {'pg_dir_ip': '192.168.100.201'}
 
67
        _int_type.return_value = 'juju-br0'
66
68
        napi_ctxt = context.PGGwContext()
67
69
        expect = {
68
70
            'ext_interface': "eth1",
69
71
            'config': 'neutron.randomconfig',
70
72
            'core_plugin': 'neutron.randomdriver',
71
 
            'local_ip': '192.168.100.201',
 
73
            'local_ip': 'pg_dir_ip',
72
74
            'network_manager': 'neutron',
73
75
            'neutron_plugin': 'plumgrid',
74
76
            'neutron_security_groups': None,