diff options
Diffstat (limited to 'tests/integration/targets/vyos_banner')
6 files changed, 37 insertions, 64 deletions
diff --git a/tests/integration/targets/vyos_banner/defaults/main.yaml b/tests/integration/targets/vyos_banner/defaults/main.yaml index 9ef5ba5..a845c24 100644 --- a/tests/integration/targets/vyos_banner/defaults/main.yaml +++ b/tests/integration/targets/vyos_banner/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: "*" +testcase: '*' test_items: [] diff --git a/tests/integration/targets/vyos_banner/tasks/cli.yaml b/tests/integration/targets/vyos_banner/tasks/cli.yaml index 890d3ac..90f265f 100644 --- a/tests/integration/targets/vyos_banner/tasks/cli.yaml +++ b/tests/integration/targets/vyos_banner/tasks/cli.yaml @@ -1,22 +1,22 @@ --- - name: collect all cli test cases find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' register: test_cases delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" +- name: run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' + with_items: '{{ test_items }}' loop_control: loop_var: test_case_to_run - name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" - with_first_found: "{{ test_items }}" + include: '{{ test_case_to_run }} ansible_connection=local' + with_first_found: '{{ test_items }}' loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_banner/tasks/main.yaml b/tests/integration/targets/vyos_banner/tasks/main.yaml index d4cf26f..a3db933 100644 --- a/tests/integration/targets/vyos_banner/tasks/main.yaml +++ b/tests/integration/targets/vyos_banner/tasks/main.yaml @@ -1,2 +1,4 @@ --- -- {include: cli.yaml, tags: ['cli']} +- include: cli.yaml + tags: + - cli diff --git a/tests/integration/targets/vyos_banner/tests/cli/basic-no-login.yaml b/tests/integration/targets/vyos_banner/tests/cli/basic-no-login.yaml index 5efdf8e..1ade232 100644 --- a/tests/integration/targets/vyos_banner/tests/cli/basic-no-login.yaml +++ b/tests/integration/targets/vyos_banner/tests/cli/basic-no-login.yaml @@ -1,41 +1,34 @@ --- - debug: - msg: "cli/basic-no-login.yaml on connection={{ ansible_connection }}" + msg: cli/basic-no-login.yaml on connection={{ ansible_connection }} - name: Setup vyos.vyos.vyos_banner: banner: pre-login - text: | - Junk pre-login banner - over multiple lines + text: "Junk pre-login banner\nover multiple lines\n" state: present - name: remove pre-login + register: result vyos.vyos.vyos_banner: banner: pre-login state: absent - register: result - debug: - msg: "{{ result }}" + msg: '{{ result }}' - assert: that: - - "result.changed == true" + - result.changed == true - "'delete system login banner pre-login' in result.commands" - name: remove pre-login (idempotent) + register: result vyos.vyos.vyos_banner: banner: pre-login state: absent - register: result - assert: that: - - "result.changed == false" - - "result.commands | length == 0" - - -# FIXME add in tests for everything defined in docs -# FIXME Test state:absent + test: -# FIXME Without powers ensure "privileged mode required" + - result.changed == false + - result.commands | length == 0 diff --git a/tests/integration/targets/vyos_banner/tests/cli/basic-post-login.yaml b/tests/integration/targets/vyos_banner/tests/cli/basic-post-login.yaml index ff6cbad..17cc07d 100644 --- a/tests/integration/targets/vyos_banner/tests/cli/basic-post-login.yaml +++ b/tests/integration/targets/vyos_banner/tests/cli/basic-post-login.yaml @@ -1,6 +1,6 @@ --- - debug: - msg: "cli/basic-post-login.yaml on connection={{ ansible_connection }}" + msg: cli/basic-post-login.yaml on connection={{ ansible_connection }} - name: setup - remove post-login vyos.vyos.vyos_banner: @@ -8,40 +8,29 @@ state: absent - name: Set post-login + register: result vyos.vyos.vyos_banner: banner: post-login - text: | - this is my post-login banner - that has a multiline - string + text: "this is my post-login banner\nthat has a multiline\nstring\n" state: present - register: result - debug: - msg: "{{ result }}" + msg: '{{ result }}' - assert: that: - - "result.changed == true" + - result.changed == true - "'this is my post-login banner' in result.commands[0]" - "'that has a multiline' in result.commands[0]" - name: Set post-login again (idempotent) + register: result vyos.vyos.vyos_banner: banner: post-login - text: | - this is my post-login banner - that has a multiline - string + text: "this is my post-login banner\nthat has a multiline\nstring\n" state: present - register: result - assert: that: - - "result.changed == false" - - "result.commands | length == 0" - - -# FIXME add in tests for everything defined in docs -# FIXME Test state:absent + test: -# FIXME Without powers ensure "privileged mode required" + - result.changed == false + - result.commands | length == 0 diff --git a/tests/integration/targets/vyos_banner/tests/cli/basic-pre-login.yaml b/tests/integration/targets/vyos_banner/tests/cli/basic-pre-login.yaml index 8489d87..526c657 100644 --- a/tests/integration/targets/vyos_banner/tests/cli/basic-pre-login.yaml +++ b/tests/integration/targets/vyos_banner/tests/cli/basic-pre-login.yaml @@ -1,6 +1,6 @@ --- - debug: - msg: "cli/basic-pre-login.yaml on connection={{ ansible_connection }}" + msg: cli/basic-pre-login.yaml on connection={{ ansible_connection }} - name: setup - remove pre-login vyos.vyos.vyos_banner: @@ -8,40 +8,29 @@ state: absent - name: Set pre-login + register: result vyos.vyos.vyos_banner: banner: pre-login - text: | - this is my pre-login banner - that has a multiline - string + text: "this is my pre-login banner\nthat has a multiline\nstring\n" state: present - register: result - debug: - msg: "{{ result }}" + msg: '{{ result }}' - assert: that: - - "result.changed == true" + - result.changed == true - "'this is my pre-login banner' in result.commands[0]" - "'that has a multiline' in result.commands[0]" - name: Set pre-login again (idempotent) + register: result vyos.vyos.vyos_banner: banner: pre-login - text: | - this is my pre-login banner - that has a multiline - string + text: "this is my pre-login banner\nthat has a multiline\nstring\n" state: present - register: result - assert: that: - - "result.changed == false" - - "result.commands | length == 0" - - -# FIXME add in tests for everything defined in docs -# FIXME Test state:absent + test: -# FIXME Without powers ensure "privileged mode required" + - result.changed == false + - result.commands | length == 0 |