mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add/improve tests for the uri module
This commit is contained in:
parent
0e57c577f4
commit
97e0f29a5b
1 changed files with 43 additions and 1 deletions
|
@ -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
|
||||
|
@ -140,3 +140,45 @@
|
|||
that:
|
||||
- "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: 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"'
|
||||
|
|
Loading…
Reference in a new issue