ansible/test/integration/targets/lookup_url/tasks/main.yml
Matt Clay 89c8eb5a08
Split up lookup integration tests. (#67294)
* Split up lookup integration tests.

* Rename lookup_paths integration test.

This will avoid confusing it for a test of the `paths` lookup plugin, which does not exist.

* Fix lookup_pipe integration test.

The test now verifies it receives the correct output.

Adding a second task also causes code coverage to be properly registered for the lookup plugin.

* Rename ini lookup test to match plugin name.

* Update sanity ignore path.
2020-02-10 16:41:45 -08:00

28 lines
1,013 B
YAML

- name: Test that retrieving a url works
set_fact:
web_data: "{{ lookup('url', 'https://gist.githubusercontent.com/abadger/9858c22712f62a8effff/raw/43dd47ea691c90a5fa7827892c70241913351963/test') }}"
- name: Assert that the url was retrieved
assert:
that:
- "'one' in web_data"
- name: Test that retrieving a url with invalid cert fails
set_fact:
web_data: "{{ lookup('url', 'https://{{ badssl_host }}/') }}"
ignore_errors: True
register: url_invalid_cert
- assert:
that:
- "url_invalid_cert.failed"
- "'Error validating the server' in url_invalid_cert.msg or 'Hostname mismatch' in url_invalid_cert.msg or ( url_invalid_cert.msg is search('hostname .* doesn.t match .*'))"
- name: Test that retrieving a url with invalid cert with validate_certs=False works
set_fact:
web_data: "{{ lookup('url', 'https://{{ badssl_host }}/', validate_certs=False) }}"
register: url_no_validate_cert
- assert:
that:
- "'{{ badssl_host_substring }}' in web_data"