File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 1
1
import json
2
+ import mock
2
3
3
4
from django .test import TestCase , RequestFactory
5
+ from django .test .utils import override_settings
4
6
5
7
from ..backends import get_oauthlib_core
6
8
from ..oauth2_backends import OAuthLibCore , JSONOAuthLibCore
7
9
8
10
9
11
class TestOAuthLibCoreBackend (TestCase ):
12
+
10
13
def setUp (self ):
11
14
self .factory = RequestFactory ()
12
15
self .oauthlib_core = OAuthLibCore ()
13
16
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
+
14
22
def test_form_urlencoded_extract_params (self ):
15
23
payload = "grant_type=password&username=john&password=123456"
16
24
request = self .factory .post ("/o/token/" , payload , content_type = "application/x-www-form-urlencoded" )
You can’t perform that action at this time.
0 commit comments