Skip to content

Commit

Permalink
test_auth_backends: Move ResponseMock earlier in the file.
Browse files Browse the repository at this point in the history
We're going to be using this in the GitHub auth backend as well.
  • Loading branch information
timabbott committed May 21, 2018
1 parent 9b8331c commit 86ec78e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions zerver/tests/test_auth_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,18 @@ def test_github_backend(self) -> None:
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()
Expand Down Expand Up @@ -787,18 +799,6 @@ def test_github_complete_when_base_exc_is_raised(self) -> None:

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,
Expand Down

0 comments on commit 86ec78e

Please sign in to comment.