~zhhuabj/charms/trusty/neutron-api/lp74646

« back to all changes in this revision

Viewing changes to unit_tests/test_neutron_api_context.py

  • Committer: james.page at ubuntu
  • Date: 2014-10-06 21:21:00 UTC
  • mfrom: (39.4.14 neutron-api)
  • Revision ID: james.page@ubuntu.com-20141006212100-we15tqpeci66qgr5
[james-page,r=gnuoy] Add HTTPS+HA support with network split configurations

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 
14
14
 
15
15
class IdentityServiceContext(CharmTestCase):
 
16
 
16
17
    def setUp(self):
17
18
        super(IdentityServiceContext, self).setUp(context, TO_PATCH)
18
19
        self.relation_get.side_effect = self.test_relation.get
71
72
        with patch('__builtin__.__import__'):
72
73
            self.assertTrue('units' not in hap_ctxt())
73
74
 
 
75
    @patch.object(
 
76
        charmhelpers.contrib.openstack.context, 'get_netmask_for_address')
 
77
    @patch.object(
 
78
        charmhelpers.contrib.openstack.context, 'get_address_in_network')
74
79
    @patch.object(charmhelpers.contrib.openstack.context, 'config')
75
80
    @patch.object(charmhelpers.contrib.openstack.context, 'local_unit')
76
81
    @patch.object(charmhelpers.contrib.openstack.context, 'unit_get')
81
86
    @patch('__builtin__.__import__')
82
87
    @patch('__builtin__.open')
83
88
    def test_context_peers(self, _open, _import, _log, _rids, _runits, _rget,
84
 
                           _uget, _lunit, _config):
 
89
                           _uget, _lunit, _config,  _get_address_in_network,
 
90
                           _get_netmask_for_address):
85
91
        unit_addresses = {
86
92
            'neutron-api-0': '10.10.10.10',
87
93
            'neutron-api-1': '10.10.10.11',
92
98
        _lunit.return_value = "neutron-api/1"
93
99
        _uget.return_value = unit_addresses['neutron-api-1']
94
100
        _config.return_value = None
 
101
        _get_address_in_network.return_value = None
 
102
        _get_netmask_for_address.return_value = '255.255.255.0'
95
103
        service_ports = {'neutron-server': [9696, 9686]}
96
 
 
 
104
        self.maxDiff = None
97
105
        ctxt_data = {
98
106
            'local_host': '127.0.0.1',
99
107
            'haproxy_host': '0.0.0.0',
 
108
            'local_host': '127.0.0.1',
100
109
            'stat_port': ':8888',
101
 
            'units': unit_addresses,
 
110
            'frontends': {
 
111
                '10.10.10.11': {
 
112
                    'network': '10.10.10.11/255.255.255.0',
 
113
                    'backends': unit_addresses,
 
114
                }
 
115
            },
102
116
            'service_ports': service_ports,
103
117
            'neutron_bind_port': 9686,
104
118
        }