def test__get_address_unit_network_get_fails(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'

    def raise_(*args):
        raise subprocess.CalledProcessError(cmd='bang', returncode=1)
    self.mock_check_output.side_effect = raise_
    with self.assertRaises(subprocess.CalledProcessError):
        self.c._get_address_unit('a-space', 'a-cidr')
def test__get_address_unit_network_get_fails(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'

    def raise_(*args):
        raise subprocess.CalledProcessError(cmd='bang', returncode=1)
    self.mock_check_output.side_effect = raise_
    with self.assertRaises(subprocess.CalledProcessError):
        self.c._get_address_unit('a-space', 'a-cidr')