Skip to content

Commit

Permalink
[irods#8047] Guarantee test users are removed if rc_switch_user test …
Browse files Browse the repository at this point in the history
…fails.
  • Loading branch information
korydraughn committed Dec 6, 2024
1 parent 9a7a55e commit 66808e5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions unit_tests/src/test_rc_switch_user.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,19 +388,17 @@ TEST_CASE("rc_switch_user can be called multiple times when KW_SWITCH_PROXY_USER
// Create a rodsuser.
const adm::user alice{"test_user_alice", env.rodsZone};
REQUIRE_NOTHROW(adm::client::add_user(conn, alice));
REQUIRE_NOTHROW(adm::client::modify_user(conn, alice, adm::user_password_property{"rods"}));

irods::at_scope_exit remove_test_user_alice{
[&conn, &alice] { REQUIRE_NOTHROW(adm::client::remove_user(conn, alice)); }};
REQUIRE_NOTHROW(adm::client::modify_user(conn, alice, adm::user_password_property{"rods"}));

// Create a groupadmin.
const adm::user bob{"test_user_bob", env.rodsZone};
REQUIRE_NOTHROW(adm::client::add_user(conn, bob));
irods::at_scope_exit remove_test_user_bob{[&conn, &bob] { REQUIRE_NOTHROW(adm::client::remove_user(conn, bob)); }};
REQUIRE_NOTHROW(adm::client::modify_user(conn, bob, adm::user_password_property{"rods"}));
REQUIRE_NOTHROW(adm::client::modify_user(conn, bob, adm::user_type_property{adm::user_type::groupadmin}));

irods::at_scope_exit remove_test_user_bob{[&conn, &bob] { REQUIRE_NOTHROW(adm::client::remove_user(conn, bob)); }};

//
// Call rc_switch_user multiple times and toggle between two rodsusers.
// It is important that the users being switched to not be rodsadmins because doing this
Expand Down

0 comments on commit 66808e5

Please sign in to comment.