mirror of https://github.com/zulip/zulip.git
test_auth_backends: Move ResponseMock earlier in the file.
We're going to be using this in the GitHub auth backend as well.
This commit is contained in:
parent
9b8331cf88
commit
86ec78eaa9
|
@ -340,6 +340,18 @@ class AuthBackendTest(ZulipTestCase):
|
|||
good_kwargs=good_kwargs,
|
||||
bad_kwargs=bad_kwargs)
|
||||
|
||||
class ResponseMock:
|
||||
def __init__(self, status_code: int, data: Any) -> None:
|
||||
self.status_code = status_code
|
||||
self.data = data
|
||||
|
||||
def json(self) -> str:
|
||||
return self.data
|
||||
|
||||
@property
|
||||
def text(self) -> str:
|
||||
return "Response text"
|
||||
|
||||
class SocialAuthMixinTest(ZulipTestCase):
|
||||
def test_social_auth_mixing(self) -> None:
|
||||
mixin = SocialAuthMixin()
|
||||
|
@ -787,18 +799,6 @@ class GitHubAuthBackendTest(ZulipTestCase):
|
|||
|
||||
utils.BACKENDS = settings.AUTHENTICATION_BACKENDS
|
||||
|
||||
class ResponseMock:
|
||||
def __init__(self, status_code: int, data: Any) -> None:
|
||||
self.status_code = status_code
|
||||
self.data = data
|
||||
|
||||
def json(self) -> str:
|
||||
return self.data
|
||||
|
||||
@property
|
||||
def text(self) -> str:
|
||||
return "Response text"
|
||||
|
||||
class GoogleOAuthTest(ZulipTestCase):
|
||||
def google_oauth2_test(self, token_response: ResponseMock, account_response: ResponseMock,
|
||||
*, subdomain: Optional[str]=None,
|
||||
|
|
Loading…
Reference in New Issue