summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_system_login.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-04-04 22:29:26 +0200
committerChristian Poessinger <christian@poessinger.com>2022-04-04 22:32:27 +0200
commit68917f8107ad016f02de41ce24b3d001facd33ec (patch)
tree4ba97ee48a8245160e509a1f97d6ca5575927b28 /smoketest/scripts/cli/test_system_login.py
parent187ae2cdb841e578c36473c59724c7c1237c0fe6 (diff)
downloadvyos-1x-68917f8107ad016f02de41ce24b3d001facd33ec.tar.gz
vyos-1x-68917f8107ad016f02de41ce24b3d001facd33ec.zip
smoketest: login: verify test accounts are properly deleted
(cherry picked from commit 6a04ff2840dfcfcad7a1cb93baf210370fa8871e)
Diffstat (limited to 'smoketest/scripts/cli/test_system_login.py')
-rwxr-xr-xsmoketest/scripts/cli/test_system_login.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/smoketest/scripts/cli/test_system_login.py b/smoketest/scripts/cli/test_system_login.py
index 69a06eeac..bc76de0ad 100755
--- a/smoketest/scripts/cli/test_system_login.py
+++ b/smoketest/scripts/cli/test_system_login.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2019-2020 VyOS maintainers and contributors
+# Copyright (C) 2019-2022 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -23,6 +23,7 @@ from base_vyostest_shim import VyOSUnitTestSHIM
from distutils.version import LooseVersion
from platform import release as kernel_version
from subprocess import Popen, PIPE
+from pwd import getpwall
from vyos.configsession import ConfigSessionError
from vyos.util import cmd
@@ -52,6 +53,11 @@ class TestSystemLogin(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
+ # After deletion, a user is not allowed to remain in /etc/passwd
+ usernames = [x[0] for x in getpwall()]
+ for user in users:
+ self.assertNotIn(user, usernames)
+
def test_add_linux_system_user(self):
# We are not allowed to re-use a username already taken by the Linux
# base system