Skip to content

Commit

Permalink
relocate SOCIALACCOUNT_PROVIDERS to constants.py and fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
RuthShryock committed Jul 25, 2024
1 parent 24d90bd commit a320ea7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 37 deletions.
15 changes: 15 additions & 0 deletions kobo/apps/accounts/tests/constants.py
Original file line number Diff line number Diff line change
@@ -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',
},
}
]
}
}
20 changes: 1 addition & 19 deletions kobo/apps/accounts/tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
21 changes: 3 additions & 18 deletions kobo/apps/accounts/tests/test_templatetags.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit a320ea7

Please sign in to comment.