Skip to content

Commit f4d27ca

Browse files
committed
Added test for pluggable serverclass
1 parent 07df6f6 commit f4d27ca

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

oauth2_provider/tests/test_oauth2_backends.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
import json
2+
import mock
23

34
from django.test import TestCase, RequestFactory
5+
from django.test.utils import override_settings
46

57
from ..backends import get_oauthlib_core
68
from ..oauth2_backends import OAuthLibCore, JSONOAuthLibCore
79

810

911
class TestOAuthLibCoreBackend(TestCase):
12+
1013
def setUp(self):
1114
self.factory = RequestFactory()
1215
self.oauthlib_core = OAuthLibCore()
1316

17+
def test_swappable_serer_class(self):
18+
with mock.patch('oauth2_provider.oauth2_backends.oauth2_settings.OAUTH2_SERVER_CLASS'):
19+
oauthlib_core = OAuthLibCore()
20+
self.assertTrue(isinstance(oauthlib_core.server, mock.MagicMock))
21+
1422
def test_form_urlencoded_extract_params(self):
1523
payload = "grant_type=password&username=john&password=123456"
1624
request = self.factory.post("/o/token/", payload, content_type="application/x-www-form-urlencoded")

0 commit comments

Comments
 (0)