Skip to content

Commit

Permalink
fixup: allow Applid to include special chars
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhughes101 committed Oct 28, 2024
1 parent 8555928 commit 4bf0f7c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugins/modules/region_jcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def get_arg_defs(self): # type: () -> dict
defs[STEPLIB]["options"][DATA_SETS].update({"elements": "data_set_base"})
defs[DFHRPL]["options"][TOP_DATA_SETS].update({"elements": "data_set_base"})
defs[DFHRPL]["options"][DATA_SETS].update({"elements": "data_set_base"})
self.update_arg_def(defs[APPLID], "qualifier")
self.update_arg_def(defs[APPLID], "dd")
if defs.get(JOB_PARAMETERS) and defs[JOB_PARAMETERS]["options"].get(JOB_NAME):
# If they've provided a job_name we need to validate this too
self.update_arg_def(defs[JOB_PARAMETERS]["options"][JOB_NAME], "qualifier")
Expand Down
19 changes: 18 additions & 1 deletion tests/unit/modules/test_region_jcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,24 @@ def test_validate_parameters_applid_too_long():
with pytest.raises(AnsibleFailJson) as exec_info:
module = setup_and_update_parms({"applid": applid})
assert module.result["failed"]
assert exec_info.value.args[0]['msg'] == 'Invalid argument "{0}" for type "qualifier".'.format(applid)
assert exec_info.value.args[0]['msg'] == 'Invalid argument "{0}" for type "dd".'.format(applid)


def test_validate_parameters_applid_with_special_chars():
prepare_for_exit()
applid = "APP$@#"
module = setup_and_update_parms({"applid": applid})
module._exit()
assert not module.result["failed"]


def test_validate_parameters_applid_with_unacceptable_special_chars():
prepare_for_fail()
applid = "AP$@#!£%"
with pytest.raises(AnsibleFailJson) as exec_info:
module = setup_and_update_parms({"applid": applid})
assert module.result["failed"]
assert exec_info.value.args[0]['msg'] == 'Invalid argument "{0}" for type "dd".'.format(applid)


def test_validate_parameters_steplib_library_too_long():
Expand Down

0 comments on commit 4bf0f7c

Please sign in to comment.