From 199f593ed3e2d2ee2d2a44d23c2504f474cbbd6a Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Mon, 21 Mar 2016 20:57:33 -0500 Subject: [PATCH] Revert "Cleaning up tests for uri module which doesn't use fetch_url in 2.0" This reverts commit bc607127ef1d97a4c40255b75c25993b87b3baa7. --- .../integration/roles/test_uri/tasks/main.yml | 65 ++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/test/integration/roles/test_uri/tasks/main.yml b/test/integration/roles/test_uri/tasks/main.yml index 2c9443952b8..4c06ea1ad7c 100644 --- a/test/integration/roles/test_uri/tasks/main.yml +++ b/test/integration/roles/test_uri/tasks/main.yml @@ -113,7 +113,7 @@ assert: that: - "result.failed == true" - - "'certificate does not match ' in result.msg" + - "'SSL Certificate does not belong' in result.msg" - "stat_result.stat.exists == false" - name: Clean up any cruft from the results directory @@ -141,3 +141,66 @@ - "stat_result.stat.exists == true" - "result.changed == true" +- name: test redirect without follow_redirects + uri: + url: 'http://httpbin.org/redirect/2' + follow_redirects: 'none' + status_code: 302 + register: result + +- name: Assert location header + assert: + that: + - 'result.location|default("") == "http://httpbin.org/relative-redirect/1"' + +- name: Check SSL with redirect + uri: + url: 'https://httpbin.org/redirect/2' + register: result + +- name: Assert SSL with redirect + assert: + that: + - 'result.url|default("") == "https://httpbin.org/get"' + +- name: redirect to bad SSL site + uri: + url: 'http://wrong.host.badssl.com' + register: result + ignore_errors: true + +- name: Ensure bad SSL site reidrect fails + assert: + that: + - result|failed + - '"wrong.host.badssl.com" in result.msg' + +- name: test basic auth + uri: + url: 'http://httpbin.org/basic-auth/user/passwd' + user: user + password: passwd + +- name: test basic forced auth + uri: + url: 'http://httpbin.org/hidden-basic-auth/user/passwd' + force_basic_auth: true + user: user + password: passwd + +- name: test PUT + uri: + url: 'http://httpbin.org/put' + method: PUT + body: 'foo=bar' + +- name: test OPTIONS + uri: + url: 'http://httpbin.org/' + method: OPTIONS + register: result + +- name: Assert we got an allow header + assert: + that: + - 'result.allow|default("") == "HEAD, OPTIONS, GET"'