Add test that url lookup checks tls certificates

This commit is contained in:
Toshio Kuratomi 2015-06-15 16:41:57 -07:00
parent 2829d0f6ca
commit 968070729a

View file

@ -129,3 +129,33 @@
debug: msg={{item}}
with_items: things2
# URL Lookups
- 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://kennethreitz.org/') }}"
ignore_errors: True
register: url_invalid_cert
- assert:
that:
- "url_invalid_cert.failed"
- "'Error validating the server' in url_invalid_cert.msg"
- name: Test that retrieving a url with invalid cert with validate_certs=False works
set_fact:
web_data: "{{ lookup('url', 'https://kennethreitz.org/', validate_certs=False) }}"
register: url_no_validate_cert
- assert:
that:
- "'kennethreitz.org' in web_data"