def test__get_address_unit_single_address(self):
    self.patch('subprocess.check_output', name='mock_check_output')
    self.patch_object(conncheck, 'logger', name='mock_logger')
    self.patch('yaml.safe_load', name='mock_yaml_safe_load')
    self.mock_check_output.return_value = b'1.2.3.4'
    self.mock_yaml_safe_load.return_value = '1.2.3.4\n'
    self.assertEqual(self.c._get_address_unit('a-space', 'a-cidr'), '1.2.3.4')
    self.mock_check_output.assert_called_once_with(['juju', 'run', '-u', '0', '--', 'network-get', '--format', 'yaml', '--bind-address', 'a-space'])
    self.mock_yaml_safe_load.assert_called_once_with('1.2.3.4')
def test__get_address_unit_single_address(self):
    self.patch('subprocess.check_output', name='mock_check_output')
    self.patch_object(conncheck, 'logger', name='mock_logger')
    self.patch('yaml.safe_load', name='mock_yaml_safe_load')
    self.mock_check_output.return_value = b'1.2.3.4'
    self.mock_yaml_safe_load.return_value = '1.2.3.4\n'
    self.assertEqual(self.c._get_address_unit('a-space', 'a-cidr'), '1.2.3.4')
    self.mock_check_output.assert_called_once_with(['juju', 'run', '-u', '0', '--', 'network-get', '--format', 'yaml', '--bind-address', 'a-space'])
    self.mock_yaml_safe_load.assert_called_once_with('1.2.3.4')