1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests
patchback[bot] 47b8df8019
[PR #5664/bbd68e26 backport][stable-6] redhat_subscription: require credentials only when needed (#6222)
redhat_subscription: require credentials only when needed (#5664)

The module currently has a static 'required_if' statement for its
parameters that forces any of 'username' or 'activationkey' or 'token'
in case state=present; while this is generally a good idea, it can be
an extra requirements in some cases. In particular, if the system is
already registered, there is no need for credentials -- some of the
operations of the module, such as manipulating pools, can be done
perfectly without credentials.

Hence:
- change the static 'required_if' to require credentials only when
  forcing the registration
- check for credentials manually when a registration is needed, i.e.
  on an unregistered system; the fail message is the same as the one
  shown by 'required_if'

Adapt the tests to this new situation:
- test_without_required_parameters now needs to mock an unregistered
  system
- add a new version of test_without_required_parameters to test an
  already registered system
- add a simple test case for only state=present usable on an already
  registered system
- remove the credentials from a test case for pool attachment that
  mocks an already registered system

(cherry picked from commit bbd68e26a2)

Co-authored-by: Pino Toscano <ptoscano@redhat.com>
2023-03-22 20:56:22 +01:00
..
integration/targets [PR #6175/1ddcdc63 backport][stable-6] Mark monit integration tests as unstable (#6178) 2023-03-12 15:50:18 +01:00
sanity [PR #5829/4c4ef80c backport][stable-6] yarn: Fix state=latest not working with global=true (#5992) 2023-02-13 22:07:12 +01:00
unit [PR #5664/bbd68e26 backport][stable-6] redhat_subscription: require credentials only when needed (#6222) 2023-03-22 20:56:22 +01:00
utils [stable-6] Run tests with EOL ansible-core versions in GHA (#6069) 2023-02-24 12:50:57 +01:00
.gitignore Add more default license and copyright notices (#5087) 2022-08-08 08:44:19 +02:00
config.yml Add default license header to files which have no copyright or license header yet (#5074) 2022-08-05 14:03:38 +02:00
requirements.yml Add default license header to files which have no copyright or license header yet (#5074) 2022-08-05 14:03:38 +02:00