diff options
author | Matt Martz <matt@sivel.net> | 2020-10-02 14:53:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-02 14:53:09 -0500 |
commit | ab2b339dd6d27c4b06001e88480eabe9a94a8e92 (patch) | |
tree | 1266060f33594477cb86dc2abf625505c2b54af8 /test/integration/targets/argspec | |
parent | a7170da851e2a3951311a3c78bcac5346b5edacd (diff) | |
download | ansible-ab2b339dd6d27c4b06001e88480eabe9a94a8e92.tar.gz |
More explicit argspec tests (#72064)
* Add more explicit coverage of argspec functionality
* fail_on_missing_params
* ci_complete ci_coverage
* Remove incidental_aws_step_functions_state_machine
* ci_complete ci_coverage
* Remove incidental_cs_service_offering
* ci_complete ci_coverage
Diffstat (limited to 'test/integration/targets/argspec')
-rw-r--r-- | test/integration/targets/argspec/library/argspec.py | 10 | ||||
-rw-r--r-- | test/integration/targets/argspec/tasks/main.yml | 35 |
2 files changed, 45 insertions, 0 deletions
diff --git a/test/integration/targets/argspec/library/argspec.py b/test/integration/targets/argspec/library/argspec.py index 077cd01c4e..e14df1eac9 100644 --- a/test/integration/targets/argspec/library/argspec.py +++ b/test/integration/targets/argspec/library/argspec.py @@ -42,6 +42,14 @@ def main(): 'another': {}, } }, + 'json': { + 'type': 'json', + }, + 'fail_on_missing_params': { + 'type': 'list', + 'default': [], + }, + 'needed_param': {}, }, required_if=( ('state', 'present', ('path', 'content'), True), @@ -51,6 +59,8 @@ def main(): ), ) + module.fail_on_missing_params(module.params['fail_on_missing_params']) + module.exit_json(**module.params) diff --git a/test/integration/targets/argspec/tasks/main.yml b/test/integration/targets/argspec/tasks/main.yml index f6672f4e0f..50c2855424 100644 --- a/test/integration/targets/argspec/tasks/main.yml +++ b/test/integration/targets/argspec/tasks/main.yml @@ -87,6 +87,31 @@ register: argpsec_required_if_fail ignore_errors: true +- argspec: + json: !!str '{"foo": "bar"}' + register: argspec_good_json_string + +- argspec: + json: + foo: bar + register: argspec_good_json_dict + +- argspec: + json: 1 + register: argspec_bad_json + ignore_errors: true + +- argspec: + fail_on_missing_params: + - needed_param + needed_param: whatever + +- argspec: + fail_on_missing_params: + - needed_param + register: argspec_fail_on_missing_params_bad + ignore_errors: true + - assert: that: - argspec_required_if_fail is failed @@ -109,3 +134,13 @@ - argspec_required_together_fail is failed - argpsec_required_if_fail is failed + + - argspec_good_json_string is successful + - > + argspec_good_json_string.json == '{"foo": "bar"}' + - argspec_good_json_dict is successful + - > + argspec_good_json_dict.json == '{"foo": "bar"}' + - argspec_bad_json is failed + + - argspec_fail_on_missing_params_bad is failed |