From e2c07cd07a1f64e6c011bc32639f74163184530e Mon Sep 17 00:00:00 2001 From: Andrew Walker Date: Fri, 5 Jul 2024 04:28:15 -0700 Subject: [PATCH] Fix test cleanup after creating temporary admin user 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):