def test_host_IP_context_ipv6(self, _call, mock_get_ipv6_addr):
     self.log = fake_log
     self.test_config.set('prefer-ipv6', True)
     mock_get_ipv6_addr.return_value = ['2001:db8:0:1::2']
     host_ip = context.HostIPContext()
     self.assertEqual({'host_ip': '2001:db8:0:1::2'}, host_ip())
     self.assertTrue(mock_get_ipv6_addr.called)
示例#2
0
 def test_host_IP_context_ipv6(self, _call):
     self.log = fake_log
     self.test_config.set('prefer-ipv6', True)
     self.get_relation_ip.return_value = '2001:db8:0:1::2'
     host_ip = context.HostIPContext()
     self.assertEqual({'host_ip': '2001:db8:0:1::2'}, host_ip())
     self.assertTrue(self.get_relation_ip.called)
示例#3
0
 def test_host_IP_context(self, _call):
     self.log = fake_log
     self.get_relation_ip.return_value = '172.24.0.79'
     host_ip = context.HostIPContext()
     self.assertEqual({'host_ip': '172.24.0.79'}, host_ip())
     self.get_relation_ip.assert_called_with('cloud-compute',
                                             cidr_network=None)
 def test_host_IP_context(self, _call, _getfqdn):
     self.log = fake_log
     self.get_relation_ip.return_value = '172.24.0.79'
     self.kv.return_value = FakeUnitdata()
     host_ip = context.HostIPContext()
     self.assertEqual({'host_ip': '172.24.0.79'}, host_ip())
     self.get_relation_ip.assert_called_with('cloud-compute',
                                             cidr_network=None)
     self.kv.return_value = FakeUnitdata(install_version=1910)
     _getfqdn.return_value = 'some'
     host_ip = context.HostIPContext()
     self.assertEqual({'host_ip': '172.24.0.79'}, host_ip())
     _getfqdn.return_value = 'some.hostname'
     host_ip = context.HostIPContext()
     self.assertDictEqual(
         {
             'host': 'some.hostname',
             'host_ip': '172.24.0.79'
         }, host_ip())
 def test_host_IP_context(self, _call):
     self.log = fake_log
     self.unit_get.return_value = '172.24.0.79'
     host_ip = context.HostIPContext()
     self.assertEqual({'host_ip': '172.24.0.79'}, host_ip())
     self.unit_get.assert_called_with('private-address')