From 1f0b78f2fe3ed1448b64ecbbe61b1635f574aceb Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Sun, 15 Mar 2020 19:41:09 +0530 Subject: [PATCH] chore: update tests with updated sudoers conf --- bench/tests/test_setup_production.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bench/tests/test_setup_production.py b/bench/tests/test_setup_production.py index 8d0bbc7a..e0a60b17 100644 --- a/bench/tests/test_setup_production.py +++ b/bench/tests/test_setup_production.py @@ -61,6 +61,9 @@ class TestSetupProduction(TestBenchBase): def assert_sudoers(self, user): sudoers_file = '/etc/sudoers.d/frappe' + service = bench.utils.which("service") + nginx = bench.utils.which("nginx") + self.assertTrue(self.file_exists(sudoers_file)) if os.environ.get("CI"): @@ -69,9 +72,8 @@ class TestSetupProduction(TestBenchBase): with open(sudoers_file, 'r') as f: sudoers = f.read() - self.assertTrue('{user} ALL = (root) NOPASSWD: /usr/sbin/service nginx *'.format(user=user) in sudoers) - self.assertTrue('{user} ALL = (root) NOPASSWD: /usr/bin/supervisorctl'.format(user=user) in sudoers) - self.assertTrue('{user} ALL = (root) NOPASSWD: /usr/sbin/nginx'.format(user=user) in sudoers) + self.assertTrue('{user} ALL = (root) NOPASSWD: {service} nginx *'.format(service=service, user=user) in sudoers) + self.assertTrue('{user} ALL = (root) NOPASSWD: {nginx}'.format(nginx=nginx, user=user) in sudoers) def assert_supervisor_config(self, bench_name, use_rq=True):