From cbd93b6ad30deb4a49e7fff144848cfee0a83d1d Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Sun, 20 Mar 2016 07:58:23 -0700 Subject: [PATCH] Add integration test for #11821 --- .../roles/test_get_url/tasks/main.yml | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/test/integration/roles/test_get_url/tasks/main.yml b/test/integration/roles/test_get_url/tasks/main.yml index 46d9ee275d..2038f28f81 100644 --- a/test/integration/roles/test_get_url/tasks/main.yml +++ b/test/integration/roles/test_get_url/tasks/main.yml @@ -150,3 +150,37 @@ get_url: url: 'http://httpbin.org/redirect/6' dest: "{{ output_dir }}/redirect.json" + +- name: Test that setting file modes work + get_url: + url: 'http://www.ansible.com/' + dest: '{{ output_dir }}/test' + mode: '0707' + register: result + +- stat: + path: "{{ output_dir }}/test" + register: stat_result + +- name: Assert that the file has the right permissions + assert: + that: + - "result.changed == true" + - "stat_result.stat.mode == '0707'" + +- name: Test that setting file modes on an already downlaoded file work + get_url: + url: 'http://www.ansible.com/' + dest: '{{ output_dir }}/test' + mode: '0070' + register: result + +- stat: + path: "{{ output_dir }}/test" + register: stat_result + +- name: Assert that the file has the right permissions + assert: + that: + - "result.changed == true" + - "stat_result.stat.mode == '0070'"