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 <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Veiko Aasa 2024-03-08 13:15:36 +02:00 committed by Sunil Mohan Adapa
parent b36d4419c4
commit ca0479aae2
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -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 = []