Write unit tests for validation methods #55994
Labels
affects_2.9
This issue/PR affects Ansible v2.9
feature
This issue/PR relates to a feature request.
has_pr
This issue has an associated PR.
support:core
This issue/PR relates to code supported by the Ansible Engineering Team.
SUMMARY
The argument spec validation methods were moved out of
basic.py
in Ansible 2.8 to make them available for user outside ofAnsibleModule
. I got several of the unit tests written but not all of them. I'm mainly documenting this here so we can work on them during PyCon 2019 sprints.check_mutually_exclusive()
check_required_one_of()
check_required_together()
check_required_by()
check_required_arguments()
check_required_if()
fail_on_missing_params()
ISSUE TYPE
COMPONENT NAME
lib/ansible/module_utils/common/validation.py
ADDITIONAL INFORMATION
There may be a bug in
check _type_int()
that needs fixing and updating the test. If anbool
it returns abool
. This is because Python considersTrue
andFalse
integer_types
. It seems wrong to me thatcheck_type_int(False)
returnsFalse
. This has been the behaviour of this method for quite some time, so changing this could have negative effects.The text was updated successfully, but these errors were encountered: