From 238ba2d486ecbe2ec895361b9cfb855044bc2c45 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 4 Jun 2018 21:50:54 -0700 Subject: [PATCH] auth: Move some simple GitHub tests to the long-term test class. --- zerver/tests/test_auth_backends.py | 46 +++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/zerver/tests/test_auth_backends.py b/zerver/tests/test_auth_backends.py index 05444568e7..c591c558c2 100644 --- a/zerver/tests/test_auth_backends.py +++ b/zerver/tests/test_auth_backends.py @@ -619,6 +619,29 @@ class GitHubAuthBackendTest(ZulipTestCase): with self.settings(AUTHENTICATION_BACKENDS=('zproject.backends.GitHubAuthBackend',)): self.assertTrue(github_auth_enabled()) + def test_login_url(self) -> None: + result = self.client_get('/accounts/login/social/github') + self.assertIn(reverse('social:begin', args=['github']), result.url) + self.assertIn('is_signup=0', result.url) + + def test_login_url_with_next_param(self) -> None: + result = self.client_get('/accounts/login/social/github', + {'next': "/image_path"}) + self.assertIn(reverse('social:begin', args=['github']), result.url) + self.assertIn('is_signup=0', result.url) + self.assertIn('image_path', result.url) + + result = self.client_get('/accounts/login/social/github', + {'next': '/#narrow/stream/7-test-here'}) + self.assertIn(reverse('social:begin', args=['github']), result.url) + self.assertIn('is_signup=0', result.url) + self.assertIn('narrow', result.url) + + def test_signup_url(self) -> None: + result = self.client_get('/accounts/register/social/github') + self.assertIn(reverse('social:begin', args=['github']), result.url) + self.assertIn('is_signup=1', result.url) + class GitHubAuthBackendLegacyTest(ZulipTestCase): def setUp(self) -> None: self.user_profile = self.example_user('hamlet') @@ -903,29 +926,6 @@ class GitHubAuthBackendLegacyTest(ZulipTestCase): 'that are allowed to register for accounts in this organization.', result) - def test_login_url(self) -> None: - result = self.client_get('/accounts/login/social/github') - self.assertIn(reverse('social:begin', args=['github']), result.url) - self.assertIn('is_signup=0', result.url) - - def test_login_url_with_next_param(self) -> None: - result = self.client_get('/accounts/login/social/github', - {'next': "/image_path"}) - self.assertIn(reverse('social:begin', args=['github']), result.url) - self.assertIn('is_signup=0', result.url) - self.assertIn('image_path', result.url) - - result = self.client_get('/accounts/login/social/github', - {'next': '/#narrow/stream/7-test-here'}) - self.assertIn(reverse('social:begin', args=['github']), result.url) - self.assertIn('is_signup=0', result.url) - self.assertIn('narrow', result.url) - - def test_signup_url(self) -> None: - result = self.client_get('/accounts/register/social/github') - self.assertIn(reverse('social:begin', args=['github']), result.url) - self.assertIn('is_signup=1', result.url) - def test_github_complete(self) -> None: from social_django import utils utils.BACKENDS = ('zproject.backends.GitHubAuthBackend',)