def test_invalid_check_pkg_version_format(hostvars, host, result): with pytest.raises(errors.AnsibleModuleError): task = FakeTask('sanity_checks', {'checks': []}) plugin = ActionModule(task, None, PlayContext(), None, Templar(None, None, None), None) plugin.current_hostvars = hostvars[host] plugin.check_pkg_version_format(host)
def test_valid_check_pkg_version_format(hostvars, host, result): task = FakeTask('sanity_checks', {'checks': []}) plugin = ActionModule(task, None, PlayContext(), None, Templar(None, None, None), None) plugin.current_hostvars = hostvars[host] check = plugin.check_pkg_version_format(host) assert check == result
def test_removed_vars(): task = FakeTask('sanity_checks', {'checks': []}) plugin = ActionModule(task, None, PlayContext(), None, Templar(None, None, None), None) plugin.current_hostvars = {'somevar': 'someval', 'openshift_hostname': '1'} with pytest.raises(errors.AnsibleModuleError): plugin.check_for_removed_vars()
def test_template_var(hostvars, host, varname, result): task = FakeTask('sanity_checks', {'checks': []}) plugin = ActionModule(task, None, PlayContext(), None, Templar(None, None, None), None) plugin.hostvars = hostvars plugin.current_hostvars = hostvars[host] check = plugin.template_var(host, varname) assert check == result
def test_valid_check_release_format(hostvars, host, result): task = FakeTask('sanity_checks', {'checks': []}) plugin = ActionModule(task, None, PlayContext(), None, Templar(None, None, None), None) check = plugin.check_release_format(hostvars, host) assert check == result
def test_invalid_valid_json_format_vars(hostvars, host, result): with pytest.raises(errors.AnsibleModuleError): task = FakeTask('sanity_checks', {'checks': []}) plugin = ActionModule(task, None, PlayContext(), None, Templar(None, None, None), None) plugin.validate_json_format_vars(hostvars, host)
def test_valid_valid_json_format_vars(hostvars, host, result): task = FakeTask('sanity_checks', {'checks': []}) plugin = ActionModule(task, None, PlayContext(), None, Templar(None, None, None), None) check = plugin.validate_json_format_vars(hostvars, host) assert check == result
def test_template_var(hostvars, host, varname, result): task = FakeTask('sanity_checks', {'checks': []}) plugin = ActionModule(task, None, PlayContext(), None, Templar(None, None, None), None) check = plugin.template_var(hostvars, host, varname) assert check == result