diff options
author | 2019-10-06 22:05:30 +0100 | |
---|---|---|
committer | 2019-10-06 22:05:30 +0100 | |
commit | 85d3b3f13a830a0bc9644736534b017c81a97383 (patch) | |
tree | d07a81e4941cde24e908b0a8e71092e95fb364f9 | |
parent | Re-lock Pipfile due to merge with master (diff) |
Register GH provider manually in tests
-rw-r--r-- | pydis_site/apps/home/tests/test_signal_listener.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pydis_site/apps/home/tests/test_signal_listener.py b/pydis_site/apps/home/tests/test_signal_listener.py index b7400558..c79a0294 100644 --- a/pydis_site/apps/home/tests/test_signal_listener.py +++ b/pydis_site/apps/home/tests/test_signal_listener.py @@ -2,6 +2,7 @@ from unittest import mock from allauth.account.signals import user_logged_in from allauth.socialaccount.models import SocialAccount, SocialLogin +from allauth.socialaccount.providers import registry from allauth.socialaccount.providers.discord.provider import DiscordProvider from allauth.socialaccount.providers.github.provider import GitHubProvider from allauth.socialaccount.signals import ( @@ -20,6 +21,14 @@ class SignalListenerTests(TestCase): @classmethod def setUpTestData(cls): """Executed when testing begins.""" + # This needs to be registered so we can test the role linking logic with a user that + # doesn't have a Discord account linked, but is logged in somehow with another account + # type anyway. The logic this is testing was designed so that the system would be + # robust enough to handle that case, but it's impossible to fully test (and therefore + # to have coverage of) those lines without an extra provider, and GH was the second + # provider it was built with in mind. + registry.register(GitHubProvider) + cls.admin_role = Role.objects.create( id=0, name="admin", |