Add tests for GitHubAuthBackend.

This commit is contained in:
Umair Khan 2016-10-26 16:57:17 +05:00 committed by Tim Abbott
parent b6046bc77e
commit 839cab3434
1 changed files with 10 additions and 1 deletions

View File

@ -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):