refactor: Make acting_user a mandatory kwarg for do_set_realm_authentication_methods.

This commit is contained in:
shanukun
2021-03-07 10:30:29 +05:30
committed by Tim Abbott
parent c95061e9b9
commit 4dc62f962b
3 changed files with 5 additions and 3 deletions

View File

@@ -321,7 +321,9 @@ field and send an event. For example:
# zerver/lib/actions.py # zerver/lib/actions.py
def do_set_realm_authentication_methods(realm: Realm, authentication_methods: Dict[str, bool]) -> None: def do_set_realm_authentication_methods(
realm: Realm, authentication_methods: Dict[str, bool], *, acting_user: Optional[UserProfile]
) -> None:
for key, value in list(authentication_methods.items()): for key, value in list(authentication_methods.items()):
index = getattr(realm.authentication_methods, key).number index = getattr(realm.authentication_methods, key).number
realm.authentication_methods.set_bit(index, int(value)) realm.authentication_methods.set_bit(index, int(value))

View File

@@ -824,7 +824,7 @@ def do_set_realm_property(
def do_set_realm_authentication_methods( def do_set_realm_authentication_methods(
realm: Realm, authentication_methods: Dict[str, bool], acting_user: Optional[UserProfile] = None realm: Realm, authentication_methods: Dict[str, bool], *, acting_user: Optional[UserProfile]
) -> None: ) -> None:
old_value = realm.authentication_methods_dict() old_value = realm.authentication_methods_dict()
for key, value in list(authentication_methods.items()): for key, value in list(authentication_methods.items()):

View File

@@ -1068,7 +1068,7 @@ class NormalActionsTest(BaseAction):
with fake_backends(): with fake_backends():
events = self.verify_action( events = self.verify_action(
lambda: do_set_realm_authentication_methods( lambda: do_set_realm_authentication_methods(
self.user_profile.realm, auth_method_dict self.user_profile.realm, auth_method_dict, acting_user=None
) )
) )