tests: Clean up the subdomain argument to social_auth_test.

subdomain=None didn't make much sense as a value, and wasn't actually in
use anywhere, except one test where it was accidental. All tests specify
the subdomain explicitly, so we should change the type to str, and make
it an obligatory kwarg.
This commit is contained in:
Mateusz Mandera 2020-06-20 13:55:12 +02:00 committed by Tim Abbott
parent 30eaed0378
commit 7fe52bbb9e
1 changed files with 12 additions and 12 deletions

View File

@ -722,7 +722,7 @@ class SocialAuthBase(DesktopFlowTestingLib, ZulipTestCase):
def prepare_login_url_and_headers( def prepare_login_url_and_headers(
self, self,
subdomain: Optional[str]=None, subdomain: str,
mobile_flow_otp: Optional[str]=None, mobile_flow_otp: Optional[str]=None,
desktop_flow_otp: Optional[str]=None, desktop_flow_otp: Optional[str]=None,
is_signup: bool=False, is_signup: bool=False,
@ -738,7 +738,6 @@ class SocialAuthBase(DesktopFlowTestingLib, ZulipTestCase):
params = {} params = {}
headers = {} headers = {}
if subdomain is not None:
if subdomain == '': if subdomain == '':
# "testserver" may trip up some libraries' URL validation, # "testserver" may trip up some libraries' URL validation,
# so let's use the equivalent www. version. # so let's use the equivalent www. version.
@ -778,7 +777,7 @@ class SocialAuthBase(DesktopFlowTestingLib, ZulipTestCase):
}) })
def social_auth_test(self, account_data_dict: Dict[str, str], def social_auth_test(self, account_data_dict: Dict[str, str],
*, subdomain: Optional[str]=None, *, subdomain: str,
mobile_flow_otp: Optional[str]=None, mobile_flow_otp: Optional[str]=None,
desktop_flow_otp: Optional[str]=None, desktop_flow_otp: Optional[str]=None,
is_signup: bool=False, is_signup: bool=False,
@ -1456,7 +1455,7 @@ class SAMLAuthBackendTest(SocialAuthBase):
# We have to define our own social_auth_test as the flow of SAML authentication # We have to define our own social_auth_test as the flow of SAML authentication
# is different from the other social backends. # is different from the other social backends.
def social_auth_test(self, account_data_dict: Dict[str, str], def social_auth_test(self, account_data_dict: Dict[str, str],
*, subdomain: Optional[str]=None, *, subdomain: str,
mobile_flow_otp: Optional[str]=None, mobile_flow_otp: Optional[str]=None,
desktop_flow_otp: Optional[str]=None, desktop_flow_otp: Optional[str]=None,
is_signup: bool=False, is_signup: bool=False,
@ -2161,7 +2160,7 @@ class AppleAuthBackendNativeFlowTest(AppleAuthMixin, SocialAuthBase):
def prepare_login_url_and_headers( def prepare_login_url_and_headers(
self, self,
subdomain: Optional[str]=None, subdomain: str,
mobile_flow_otp: Optional[str]=None, mobile_flow_otp: Optional[str]=None,
desktop_flow_otp: Optional[str]=None, desktop_flow_otp: Optional[str]=None,
is_signup: bool=False, is_signup: bool=False,
@ -2193,7 +2192,7 @@ class AppleAuthBackendNativeFlowTest(AppleAuthMixin, SocialAuthBase):
return url, headers return url, headers
def social_auth_test(self, account_data_dict: Dict[str, str], def social_auth_test(self, account_data_dict: Dict[str, str],
*, subdomain: Optional[str]=None, *, subdomain: str,
mobile_flow_otp: Optional[str]=None, mobile_flow_otp: Optional[str]=None,
desktop_flow_otp: Optional[str]=None, desktop_flow_otp: Optional[str]=None,
is_signup: bool=False, is_signup: bool=False,
@ -2625,6 +2624,7 @@ class GitHubAuthBackendTest(SocialAuthBase):
result = self.social_auth_test(account_data_dict, result = self.social_auth_test(account_data_dict,
email_data=email_data, email_data=email_data,
is_signup=True, is_signup=True,
subdomain='zulip',
expect_choose_email_screen=True, expect_choose_email_screen=True,
next='/user_uploads/image') next='/user_uploads/image')
data = load_subdomain_token(result) data = load_subdomain_token(result)