1
0
mirror of https://github.com/ansible-collections/community.general.git synced 2025-07-29 07:41:16 +03:00

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
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
[
{