refactor: Make acting_user a mandatory kwarg for do_activate_user.

This commit is contained in:
shanukun 2021-02-06 21:32:03 +05:30 committed by Tim Abbott
parent 4b67946605
commit fafe1a31d7
3 changed files with 4 additions and 4 deletions

View File

@ -1325,7 +1325,7 @@ class TestLoggingCountStats(AnalyticsTestCase):
"value__sum"
],
)
do_activate_user(user)
do_activate_user(user, acting_user=None)
self.assertEqual(
1,
RealmCount.objects.filter(property=property, subgroup=False).aggregate(Sum("value"))[
@ -1659,7 +1659,7 @@ class TestActiveUsersAudit(AnalyticsTestCase):
"email4", "password", self.default_realm, "full_name", acting_user=None
)
do_deactivate_user(user2)
do_activate_user(user3)
do_activate_user(user3, acting_user=None)
do_reactivate_user(user4)
end_time = floor_to_day(timezone_now()) + self.DAY
do_fill_count_stat_at_hour(self.stat, end_time)

View File

@ -2714,7 +2714,7 @@ class LicenseLedgerTest(StripeTestCase):
do_deactivate_user(user)
do_reactivate_user(user)
# Not a proper use of do_activate_user, but fine for this test
do_activate_user(user)
do_activate_user(user, acting_user=None)
ledger_entries = list(
LicenseLedger.objects.values_list(
"is_renewal", "licenses", "licenses_at_next_renewal"

View File

@ -672,7 +672,7 @@ def do_create_user(
return user_profile
def do_activate_user(user_profile: UserProfile, acting_user: Optional[UserProfile] = None) -> None:
def do_activate_user(user_profile: UserProfile, *, acting_user: Optional[UserProfile]) -> None:
user_profile.is_active = True
user_profile.is_mirror_dummy = False
user_profile.set_unusable_password()