From d1530a23c8fbe1fbff4de1d7901c7b1dab0cb582 Mon Sep 17 00:00:00 2001 From: Andrew Walker Date: Fri, 5 Jul 2024 04:43:06 -0700 Subject: [PATCH] Fix test cleanup after creating temporary admin user (#13982) This fixes a test failure due to recent bugfix to prevent deletion of immutable users. The test in question manually edits the account.bsdusers table to allow testing logic related to case when root account is disabled, but then uses user.delete to remove the temporary admin account. The fix is to use datastore plugin to directly delete the new admin user. --- tests/api2/test_user_admin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/api2/test_user_admin.py b/tests/api2/test_user_admin.py index 0654faed839c2..5a011621f1410 100644 --- a/tests/api2/test_user_admin.py +++ b/tests/api2/test_user_admin.py @@ -29,7 +29,8 @@ def admin(): try: yield admin finally: - call("user.delete", admin["id"]) + call("datastore.delete", "account.bsdusers", admin["id"]) + call("etc.generate", "user") def test_installer_admin_has_local_administrator_privilege(admin):