From 07629f0f612af7b1838d9a84e0dbadf6b388dc4f Mon Sep 17 00:00:00 2001 From: Adar Nimrod Date: Sun, 16 Apr 2017 10:12:52 +0300 Subject: [PATCH] - Correct test, use users_sudo_group instead of sudoers. --- defaults/main.yml | 2 +- tests/playbook.yml | 2 +- tests/test_users.py | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 800a431..fd9cc2a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -10,7 +10,7 @@ users: comment: '{{ ansible_hostname }} root' #shell: /bin/bash #uid: 0 - #groups: sudoers + #groups: '{{ users_sudo_group }}' #pubkeys: #- '{{ lookup("file", "id_rsa.pub") }}' #email: none@nowhere.com diff --git a/tests/playbook.yml b/tests/playbook.yml index d01ab05..ab1997a 100644 --- a/tests/playbook.yml +++ b/tests/playbook.yml @@ -27,7 +27,7 @@ - name: dummy groups: - people - - sudoers + - '{{ users_sudo_group }}' pubkeys: - '{{ lookup("file", "id_rsa.pub") }}' - name: person diff --git a/tests/test_users.py b/tests/test_users.py index 3bb16f9..4a1f8cf 100644 --- a/tests/test_users.py +++ b/tests/test_users.py @@ -3,8 +3,9 @@ from testinfra.utils.ansible_runner import AnsibleRunner testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all') -def test_users(Command, Ansible): - assert Command('''ssh dummy@localhost sudo whoami''').stdout == 'root' +def test_users(Command, Ansible, Sudo): + with Sudo(): + assert Command('''ssh dummy@localhost sudo whoami''').stdout == 'root' def test_users_prune(Command): -- GitLab