88from oauthlib .oauth2 import Server
99
1010from ..views .mixins import OAuthLibMixin , ScopedResourceMixin , ProtectedResourceMixin
11+ from ..oauth2_backends import OAuthLibCore
1112from ..oauth2_validators import OAuth2Validator
1213
1314
@@ -18,9 +19,19 @@ def setUpClass(cls):
1819
1920
2021class TestOAuthLibMixin (BaseTest ):
22+ def test_missing_oauthlib_backend_class (self ):
23+ class TestView (OAuthLibMixin , View ):
24+ server_class = Server
25+ validator_class = OAuth2Validator
26+
27+ test_view = TestView ()
28+
29+ self .assertRaises (ImproperlyConfigured , test_view .get_oauthlib_backend_class )
30+
2131 def test_missing_server_class (self ):
2232 class TestView (OAuthLibMixin , View ):
2333 validator_class = OAuth2Validator
34+ oauthlib_backend_class = OAuthLibCore
2435
2536 test_view = TestView ()
2637
@@ -29,6 +40,7 @@ class TestView(OAuthLibMixin, View):
2940 def test_missing_validator_class (self ):
3041 class TestView (OAuthLibMixin , View ):
3142 server_class = Server
43+ oauthlib_backend_class = OAuthLibCore
3244
3345 test_view = TestView ()
3446
@@ -38,6 +50,7 @@ def test_correct_server(self):
3850 class TestView (OAuthLibMixin , View ):
3951 server_class = Server
4052 validator_class = OAuth2Validator
53+ oauthlib_backend_class = OAuthLibCore
4154
4255 request = self .request_factory .get ("/fake-req" )
4356 request .user = "fake"
0 commit comments