Browse code

Add test that validate_certs=no works

Toshio Kuratomi authored on 2015/05/29 07:35:25
Showing 1 changed files
... ...
@@ -26,7 +26,7 @@
26 26
     - result.changed 
27 27
     - '"OK" in result.msg'
28 28
 
29
-- name: test https fetch to a site with invalid domain
29
+- name: test https fetch to a site with mismatched hostname and certificate
30 30
   get_url:
31 31
     url: "https://kennethreitz.org/"
32 32
     dest: "{{ output_dir }}/shouldnotexist.html"
... ...
@@ -37,11 +37,26 @@
37 37
     path: "{{ output_dir }}/shouldnotexist.html"
38 38
   register: stat_result
39 39
 
40
-- debug: var=result
41
-
42 40
 - name: Assert that the file was not downloaded
43 41
   assert:
44 42
     that:
45 43
       - "result.failed == true"
46 44
       - "'Certificate does not belong to ' in result.msg"
47 45
       - "stat_result.stat.exists == false"
46
+
47
+- name: test https fetch to a site with mismatched hostname and certificate and validate_certs=no
48
+  get_url:
49
+    url: "https://kennethreitz.org/"
50
+    dest: "{{ output_dir }}/kreitz.html"
51
+    validate_certs: no
52
+  register: result
53
+
54
+- stat:
55
+    path: "{{ output_dir }}/kreitz.html"
56
+  register: stat_result
57
+
58
+- name: Assert that the file was not downloaded
59
+  assert:
60
+    that:
61
+      - "result.failed == false"
62
+      - "stat_result.stat.exists == true"