'Unregister a unregistered host (systemid missing)
locally, check that result is unchanged'

@patch('os.unlink')
def test_unregister_not_registered(self, mock_unlink):

    mock_unlink.return_value = True
    set_module_args({'activationkey': 'key', 'username': 'user', 'password': 'pass', 'state': 'absent'})
    with patch.object(basic.AnsibleModule, 'run_command') as run_command:
        with patch.object(rhn_register.Rhn, 'is_registered', PropertyMock(return_value=False)) as mock_is_registered:
            with patch('ansible.modules.packaging.os.rhn_register.xmlrpc_client.Transport.request') as req:
                with self.assertRaises(AnsibleExitJson) as result:
                    self.module.main()
                self.assertFalse(result.exception.args[0]['changed'])
            self.assertFalse(req.called)
        self.assertEqual(mock_is_registered.call_count, 1)
    self.assertFalse(run_command.called)
    self.assertFalse(mock_unlink.called)
