From 839cab34343dd5e2875a4c72c235c6142ba5395f Mon Sep 17 00:00:00 2001 From: Umair Khan Date: Wed, 26 Oct 2016 16:57:17 +0500 Subject: [PATCH] Add tests for GitHubAuthBackend. --- zerver/tests/test_auth_backends.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/zerver/tests/test_auth_backends.py b/zerver/tests/test_auth_backends.py index d77ef4ac98..4b536f3fae 100644 --- a/zerver/tests/test_auth_backends.py +++ b/zerver/tests/test_auth_backends.py @@ -26,7 +26,7 @@ from zerver.models import \ from zproject.backends import ZulipDummyBackend, EmailAuthBackend, \ GoogleMobileOauth2Backend, ZulipRemoteUserBackend, ZulipLDAPAuthBackend, \ ZulipLDAPUserPopulator, DevAuthBackend, GitHubAuthBackend, ZulipAuthMixin, \ - password_auth_enabled + password_auth_enabled, github_auth_enabled from social.exceptions import AuthFailed from social.strategies.django_strategy import DjangoStrategy @@ -302,6 +302,15 @@ class GitHubAuthBackendTest(ZulipTestCase): request.user = self.user_profile self.backend.strategy.request = request + def test_github_auth_enabled(self): + # type: () -> None + with self.settings(AUTHENTICATION_BACKENDS=('zproject.backends.GitHubAuthBackend',)): + self.assertTrue(github_auth_enabled()) + + def test_full_name_with_missing_key(self): + # type: () -> None + self.assertEqual(self.backend.get_full_name(), '') + def test_github_backend_do_auth_without_subdomains(self): # type: () -> None def do_auth(*args, **kwargs):