redhat_subscription: Add support for Red Hat API token (#5725)

Add support for Red Hat API token

fix mixed up

fix version
This commit is contained in:
Eric C Chong 2023-01-05 15:36:07 -05:00 committed by GitHub
parent 84ebda65f1
commit 4dc897d559
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 6 deletions

View file

@ -102,6 +102,37 @@ TEST_CASES = [
'msg': "System successfully registered to 'satellite.company.com'."
}
],
# Test simple registration using token
[
{
'state': 'present',
'server_hostname': 'satellite.company.com',
'token': 'fake_token',
},
{
'id': 'test_registeration_token',
'run_command.calls': [
(
['/testbin/subscription-manager', 'identity'],
{'check_rc': False},
(1, '', '')
),
(
['/testbin/subscription-manager', 'config', '--server.hostname=satellite.company.com'],
{'check_rc': True},
(0, '', '')
),
(
['/testbin/subscription-manager', 'register',
'--token', 'fake_token'],
{'check_rc': True, 'expand_user_and_vars': False},
(0, '', '')
)
],
'changed': True,
'msg': "System successfully registered to 'satellite.company.com'."
}
],
# Test unregistration, when system is unregistered
[
{