Debian Codegraph @

test/integration/targets/uri/tasks/use_netrc.yml

raw
1 - name: Write out netrc
2 copy:
3 dest: "{{ remote_tmp_dir }}/netrc"
4 content: |
5 machine {{ httpbin_host }}
6 login foo
7 password bar
8
9 - name: Test with netrc forced Basic auth
10 uri:
11 url: https://{{ httpbin_host }}/basic-auth/foo/bar
12 return_content: yes
13 headers:
14 Authorization: Bearer foobar
15 environment:
16 NETRC: "{{ remote_tmp_dir }}/netrc"
17 register: response
18
19 - name: assert Test with netrc forced Basic auth
20 assert:
21 that:
22 - response.json.user == 'foo'
23
24 - name: Test Bearer authorization is successful with use_netrc=False
25 uri:
26 url: https://{{ httpbin_host }}/bearer
27 use_netrc: false
28 return_content: yes
29 headers:
30 Authorization: Bearer foobar
31 environment:
32 NETRC: "{{ remote_tmp_dir }}/netrc"
33 register: response
34
35 - name: assert Test Bearer authorization is successful with use_netrc=False
36 assert:
37 that:
38 - response.json.token == 'foobar'
39
40 - name: Clean up
41 file:
42 dest: "{{ remote_tmp_dir }}/netrc"
43 state: absent