      urlpatterns += patterns('',
          url(r'^oauth2/', include('provider.oauth2.urls', namespace='oauth2')),
          url(r'^oauth2-test/$', MockView.as_view(authentication_classes=[OAuth2Authentication])),
      )
  
  
  class BasicAuthTests(TestCase):
      """Basic authentication"""
      urls = 'rest_framework.tests.authentication'
 
</s> remove from rest_framework.compat import oauth2_provider, oauth2_provider_models
 </s> add from rest_framework.compat import oauth2_provider, oauth2_provider_models, oauth2_provider_scope
        url(r'^oauth2-with-scope-test/$', MockView.as_view(authentication_classes=[OAuth2Authentication], 
            permission_classes=[permissions.TokenHasReadWriteScope])),
      urlpatterns += patterns('',
          url(r'^oauth2/', include('provider.oauth2.urls', namespace='oauth2')),
          url(r'^oauth2-test/$', MockView.as_view(authentication_classes=[OAuth2Authentication])),
        url(r'^oauth2-with-scope-test/$', MockView.as_view(authentication_classes=[OAuth2Authentication], 
            permission_classes=[permissions.TokenHasReadWriteScope])),
      )
  
  
  class BasicAuthTests(TestCase):
      """Basic authentication"""
      urls = 'rest_framework.tests.authentication'
keep keep add keep keep keep keep keep keep
 Add TokenHasReadWriteScope class for permissions based on scopes 
rest_framework/tests/authentication.py