Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

tests: Use get_account_data_dict helper in some github tests.

Clara Dantasd2da9827acde
diff --git a/zerver/tests/test_auth_backends.py b/zerver/tests/test_auth_backends.py
index 6c21aca4412..11007b01c4c 100644
--- a/zerver/tests/test_auth_backends.py
+++ b/zerver/tests/test_auth_backends.py
@@ -2392,8 +2392,8 @@ class GitHubAuthBackendTest(SocialAuthBase):
self.email_data = email_data
- def get_account_data_dict(self, email: str, name: str) -> Dict[str, Any]:
- return dict(email=email, name=name)
+ def get_account_data_dict(self, email: str, name: str, user_avatar_url: str='') -> Dict[str, Any]:
+ return dict(email=email, name=name, user_avatar_url=user_avatar_url)
def test_social_auth_email_not_verified(self) -> None:
account_data_dict = self.get_account_data_dict(email=self.email, name=self.name)
@@ -2472,7 +2472,7 @@ class GitHubAuthBackendTest(SocialAuthBase):
self.assertTrue(github_auth_enabled())
def test_github_oauth2_success_non_primary(self) -> None:
- account_data_dict = dict(email='[email protected]', name="Non Primary")
+ account_data_dict = self.get_account_data_dict(email='[email protected]', name="Non Primary")
email_data = [
dict(email=account_data_dict["email"],
verified=True),
@@ -2502,7 +2502,7 @@ class GitHubAuthBackendTest(SocialAuthBase):
# If the user has a single email associated with its GitHub account,
# the choose email screen should not be shown and the first email
# should be used for user's signup/login.
- account_data_dict = dict(email='[email protected]', name=self.name)
+ account_data_dict = self.get_account_data_dict(email='[email protected]', name=self.name)
email_data = [
dict(email='[email protected]',
verified=True,
@@ -2558,7 +2558,7 @@ class GitHubAuthBackendTest(SocialAuthBase):
# are associated with existing accounts, we expect the choose
# email screen to select which account to use.
hamlet = self.example_user("hamlet")
- account_data_dict = dict(email='[email protected]', name="Hamlet")
+ account_data_dict = self.get_account_data_dict(email='[email protected]', name="Hamlet")
email_data = [
dict(email=account_data_dict["email"],
verified=True),
@@ -2589,7 +2589,7 @@ class GitHubAuthBackendTest(SocialAuthBase):
# none of which are associated with an existing account, the
# choose email screen should be shown (which will lead to a
# "continue to registration" choice).
- account_data_dict = dict(email="[email protected]", name="Not Hamlet")
+ account_data_dict = self.get_account_data_dict(email="[email protected]", name="Not Hamlet")
email_data = [
dict(email=account_data_dict["email"],
verified=True),
@@ -2668,7 +2668,7 @@ class GitHubAuthBackendTest(SocialAuthBase):
# As emails ending with `noreply.github.com` are excluded from
# verified_emails, choosing it as an email should raise a `email
# not associated` warning.
- account_data_dict = dict(email="[email protected]", name=self.name)
+ account_data_dict = self.get_account_data_dict(email="[email protected]", name=self.name)
email_data = [
dict(email="[email protected]",
verified=True),
@@ -2694,7 +2694,7 @@ class GitHubAuthBackendTest(SocialAuthBase):
)])
def test_github_oauth2_email_not_associated(self) -> None:
- account_data_dict = dict(email='[email protected]', name=self.name)
+ account_data_dict = self.get_account_data_dict(email='[email protected]', name=self.name)
email_data = [
dict(email='[email protected]',
verified=True),
@@ -2721,7 +2721,7 @@ class GitHubAuthBackendTest(SocialAuthBase):
# check if a user is denied to login if the user manages to
# send an unverified email that has an existing account in
# organisation through `email` GET parameter.
- account_data_dict = dict(email='[email protected]', name=self.name)
+ account_data_dict = self.get_account_data_dict(email='[email protected]', name=self.name)
email_data = [
dict(email='[email protected]',
verified=True),