Skip to content

Commit 34bd0a0

Browse files
committed
refactor(user): offboard command uses alumni command
1 parent a01e05c commit 34bd0a0

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

compiler_admin/commands/user/offboard.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from tempfile import NamedTemporaryFile
33

44
from compiler_admin import RESULT_SUCCESS, RESULT_FAILURE
5+
from compiler_admin.commands.user.alumni import alumni
56
from compiler_admin.commands.user.delete import delete
6-
from compiler_admin.commands.user.signout import signout
77
from compiler_admin.services.google import (
88
USER_ARCHIVE,
99
CallGAMCommand,
@@ -48,8 +48,7 @@ def offboard(args: Namespace) -> int:
4848
print(f"User exists, offboarding: {account}")
4949
res = RESULT_SUCCESS
5050

51-
print("Removing from groups")
52-
res += CallGAMCommand(("user", account, "delete", "groups"))
51+
res += alumni(args)
5352

5453
print("Backing up email")
5554
res += CallGYBCommand(("--service-account", "--email", account, "--action", "backup"))
@@ -67,8 +66,6 @@ def offboard(args: Namespace) -> int:
6766

6867
res += CallGAMCommand(("user", account, "deprovision", "popimap"))
6968

70-
res += signout(args)
71-
7269
res += delete(args)
7370

7471
if alias_account:

tests/commands/user/test_offboard.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def mock_NamedTemporaryFile(mock_NamedTemporaryFile_with_readlines):
2525

2626

2727
@pytest.fixture
28-
def mock_commands_signout(mock_commands_signout):
29-
return mock_commands_signout(MODULE)
28+
def mock_commands_alumni(mock_commands_alumni):
29+
return mock_commands_alumni(MODULE)
3030

3131

3232
@pytest.fixture
@@ -62,7 +62,7 @@ def test_offboard_confirm_yes(
6262
mock_google_CallGAMCommand,
6363
mock_google_CallGYBCommand,
6464
mock_NamedTemporaryFile,
65-
mock_commands_signout,
65+
mock_commands_alumni,
6666
mock_commands_delete,
6767
):
6868
mock_google_user_exists.return_value = True
@@ -75,8 +75,8 @@ def test_offboard_confirm_yes(
7575
mock_google_CallGYBCommand.assert_called_once()
7676
mock_NamedTemporaryFile.assert_called_once()
7777

78-
mock_commands_signout.assert_called_once()
79-
assert args in mock_commands_signout.call_args.args
78+
mock_commands_alumni.assert_called_once()
79+
assert args in mock_commands_alumni.call_args.args
8080

8181
mock_commands_delete.assert_called_once()
8282
assert args in mock_commands_delete.call_args.args
@@ -87,7 +87,7 @@ def test_offboard_confirm_no(
8787
mock_google_user_exists,
8888
mock_google_CallGAMCommand,
8989
mock_google_CallGYBCommand,
90-
mock_commands_signout,
90+
mock_commands_alumni,
9191
mock_commands_delete,
9292
):
9393
mock_google_user_exists.return_value = True
@@ -99,7 +99,7 @@ def test_offboard_confirm_no(
9999
mock_google_CallGAMCommand.assert_not_called()
100100
mock_google_CallGYBCommand.assert_not_called()
101101

102-
mock_commands_signout.assert_not_called()
102+
mock_commands_alumni.assert_not_called()
103103
mock_commands_delete.assert_not_called()
104104

105105

0 commit comments

Comments
 (0)