Add missing integration test for eos_user (#25463)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
pull/24204/merge
Trishna Guha 8 years ago committed by GitHub
parent 20bddde669
commit b1b68840be

@ -16,3 +16,4 @@
- { role: eos_eapi, debug: yes, when: "limit_to in ['*', 'eos_eapi']" }
- { role: eos_system, debug: yes, when: "limit_to in ['*', 'eos_system']" }
- { role: eos_vlan, debug: yes, when: "limit_to in ['*', 'eos_vlan']" }
- { role: eos_user, when: "limit_to in ['*', eos_user']" }

@ -0,0 +1,2 @@
dependencies:
- prepare_eos_tests

@ -0,0 +1,15 @@
---
- name: collect all cli test cases
find:
paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml"
register: test_cases
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

@ -0,0 +1,15 @@
---
- name: collect all eapi test cases
find:
paths: "{{ role_path }}/tests/eapi"
patterns: "{{ testcase }}.yaml"
register: test_cases
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

@ -0,0 +1,3 @@
---
- { include: cli.yaml, tags: ['cli'] }
- { include: eapi.yaml, tags: ['eapi'] }

@ -0,0 +1,43 @@
---
- name: Create user
eos_user:
username: netend
privilege: 15
role: network-operator
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["username netend role network-operator", "username netend privilege 15"]'
- name: Collection of users
eos_user:
users:
- username: test1
- username: test2
authorize: yes
state: present
role: network-admin
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["username test1 role network-admin", "username test2 role network-admin"]'
- name: tearDown
eos_user:
purge: yes
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["no username netend", "no username test1", "no username test2"]'

@ -0,0 +1,43 @@
---
- name: Create user
eos_user:
username: netend
privilege: 15
role: network-operator
state: present
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["username netend role network-operator", "username netend privilege 15"]'
- name: Collection of users
eos_user:
users:
- username: test1
- username: test2
authorize: yes
state: present
role: network-admin
provider: "{{ eapi }}"
register: result
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["username test1 role network-admin", "username test2 role network-admin"]'
- name: tearDown
eos_user:
purge: yes
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- 'result.changed == true'
- 'result.commands == ["no username netend", "no username test1", "no username test2"]'
Loading…
Cancel
Save