Extend the get_url integration tests to include file schemas. (#15532)
Addresses https://github.com/ansible/ansible-modules-core/issues/3511
This commit is contained in:
parent
30a38f94ce
commit
4d36b3f7b6
1 changed files with 34 additions and 0 deletions
|
@ -31,6 +31,40 @@
|
|||
python_has_ssl_context: False
|
||||
when: python_test.rc != 0
|
||||
|
||||
- name: Define test files for file schema
|
||||
set_fact:
|
||||
geturl_srcfile: "{{ output_dir | expanduser }}/aurlfile.txt"
|
||||
geturl_dstfile: "{{ output_dir | expanduser }}/aurlfile_copy.txt"
|
||||
|
||||
- name: Create source file
|
||||
copy:
|
||||
dest: "{{ geturl_srcfile }}"
|
||||
content: "foobar"
|
||||
|
||||
- name: test file fetch
|
||||
get_url:
|
||||
url: "{{ 'file://' + geturl_srcfile }}"
|
||||
dest: "{{ geturl_dstfile }}"
|
||||
register: result
|
||||
|
||||
- name: assert success and change
|
||||
assert:
|
||||
that:
|
||||
- result.changed
|
||||
- '"OK" in result.msg'
|
||||
|
||||
- name: test nonexisting file fetch
|
||||
get_url:
|
||||
url: "{{ 'file://' + geturl_srcfile + 'NOFILE' }}"
|
||||
dest: "{{ geturl_dstfile + 'NOFILE' }}"
|
||||
register: result
|
||||
ignore_errors: True
|
||||
|
||||
- name: assert success and change
|
||||
assert:
|
||||
that:
|
||||
- result.failed
|
||||
|
||||
- name: test https fetch
|
||||
get_url: url="https://raw.githubusercontent.com/ansible/ansible/devel/README.md" dest={{output_dir}}/get_url.txt force=yes
|
||||
register: result
|
||||
|
|
Loading…
Reference in a new issue