diff --git a/kobo/apps/accounts/tests/constants.py b/kobo/apps/accounts/tests/constants.py new file mode 100644 index 0000000000..bf0a40325a --- /dev/null +++ b/kobo/apps/accounts/tests/constants.py @@ -0,0 +1,15 @@ +SOCIALACCOUNT_PROVIDERS = { + 'openid_connect': { + 'SERVERS': [ + { + 'id': 'test-app', + 'name': 'Test App', + 'server_url': 'http://testserver/oauth', + 'APP': { + 'client_id': 'test.service.id', + 'secret': 'test.service.secret', + }, + } + ] + } +} diff --git a/kobo/apps/accounts/tests/test_backend.py b/kobo/apps/accounts/tests/test_backend.py index 759684d52a..e4394389a7 100644 --- a/kobo/apps/accounts/tests/test_backend.py +++ b/kobo/apps/accounts/tests/test_backend.py @@ -16,25 +16,7 @@ # from kobo.apps.openrosa.apps.main.models import UserProfile # from kobo.apps.kobo_auth.shortcuts import User - -# TODO refactor this and use `SOCIALACCOUNT_PROVIDERS` at only one place -# see test_templatetags.py - -SOCIALACCOUNT_PROVIDERS = { - 'openid_connect': { - 'SERVERS': [ - { - 'id': 'test-app', - 'name': 'Test App', - 'server_url': 'http://testserver/oauth', - 'APP': { - 'client_id': 'test.service.id', - 'secret': 'test.service.secret', - }, - } - ] - } -} +from .constants import SOCIALACCOUNT_PROVIDERS class SSOLoginTest(TestCase): diff --git a/kobo/apps/accounts/tests/test_templatetags.py b/kobo/apps/accounts/tests/test_templatetags.py index bdc6aa8b79..96ba41c663 100644 --- a/kobo/apps/accounts/tests/test_templatetags.py +++ b/kobo/apps/accounts/tests/test_templatetags.py @@ -1,24 +1,9 @@ -from django.test import TestCase, override_settings from allauth.socialaccount.models import SocialApp +from django.test import TestCase, override_settings + from kobo.apps.accounts.models import SocialAppCustomData from kobo.apps.accounts.templatetags.get_provider_appname import get_social_apps - -# example app setup for testing -SOCIALACCOUNT_PROVIDERS = { - "openid_connect": { - "SERVERS": [ - { - "id": "test-app", - "name": "Test App", - "server_url": "https://example.org/oauth", - "APP": { - "client_id": "test.service.id", - "secret": "test.service.secret", - }, - } - ] - } -} +from .constants import SOCIALACCOUNT_PROVIDERS @override_settings(SOCIALACCOUNT_PROVIDERS=SOCIALACCOUNT_PROVIDERS)