From ca0479aae2505af880668da02b44857bdb585312 Mon Sep 17 00:00:00 2001 From: Veiko Aasa Date: Fri, 8 Mar 2024 13:15:36 +0200 Subject: [PATCH] users: tests: Do not remove LDAP user when testing views Fixes an issue where the LDAP user 'tester' was removed after testing test_views.py. It happened when there were two admin users present. Tested with both stable and testing containers that all the users module tests pass and a user 'tester' is not removed when two admin users exists. Signed-off-by: Veiko Aasa Reviewed-by: Sunil Mohan Adapa --- plinth/modules/users/tests/test_views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plinth/modules/users/tests/test_views.py b/plinth/modules/users/tests/test_views.py index ec4751beb..c0672b053 100644 --- a/plinth/modules/users/tests/test_views.py +++ b/plinth/modules/users/tests/test_views.py @@ -52,7 +52,8 @@ def module_patch(): patch(f'{privileged}.get_group_users') as get_group_users, \ patch('plinth.modules.ssh.privileged.set_keys'), \ patch('plinth.modules.ssh.privileged.get_keys') as get_keys, \ - patch(f'{privileged}.get_user_groups') as get_user_groups: + patch(f'{privileged}.get_user_groups') as get_user_groups, \ + patch(f'{privileged}.remove_user'): get_group_users.return_value = ['admin'] get_keys.return_value = [] get_user_groups.return_value = []