Skip to content

Commit 4c5ec4a

Browse files
committed
refactor(google): constant for hello account
1 parent 3c64b6e commit 4c5ec4a

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

compiler_admin/commands/reset_password.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from argparse import Namespace
22

33
from compiler_admin.commands import RESULT_SUCCESS, RESULT_FAILURE
4-
from compiler_admin.services.google import CallGAMCommand, user_account_name, user_exists
4+
from compiler_admin.services.google import USER_HELLO, CallGAMCommand, user_account_name, user_exists
55

66

77
def reset_password(args: Namespace) -> int:
@@ -29,7 +29,7 @@ def reset_password(args: Namespace) -> int:
2929

3030
notify = getattr(args, "notify", None)
3131
if notify:
32-
command += ("notify", notify, "from", "[email protected]")
32+
command += ("notify", notify, "from", USER_HELLO)
3333

3434
print(f"User exists, resetting password: {account}")
3535

compiler_admin/services/google.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ def user_account_name(username: str) -> str:
3838
# Archive account
3939
USER_ARCHIVE = user_account_name("archive")
4040

41+
# Hello account
42+
USER_HELLO = user_account_name("hello")
43+
4144
# Groups
4245
GROUP_PARTNERS = user_account_name("partners")
4346
GROUP_STAFF = user_account_name("staff")

tests/commands/test_reset_password.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from compiler_admin.commands import RESULT_FAILURE, RESULT_SUCCESS
55
from compiler_admin.commands.reset_password import reset_password, __name__ as MODULE
6+
from compiler_admin.services.google import USER_HELLO
67

78

89
@pytest.fixture
@@ -57,4 +58,4 @@ def test_reset_password_notify(mock_google_user_exists, mock_google_CallGAMComma
5758
call_args = " ".join(mock_google_CallGAMCommand.call_args[0][0])
5859
assert "update user" in call_args
5960
assert "password random" in call_args
60-
assert "notify [email protected] from [email protected]" in call_args
61+
assert f"notify [email protected] from {USER_HELLO}" in call_args

0 commit comments

Comments
 (0)