      @unittest.skipUnless(oauth, 'oauth2 not installed')
      def test_post_form_with_readonly_resource_failing_auth(self):
          """Ensure POSTing with a readonly resource instead of a write scope fails"""
          read_only_access_token = self.token
          read_only_access_token.resource.is_readonly = True
          read_only_access_token.resource.save()
          params = self._create_authorization_url_parameters()
          response = self.csrf_client.post('/oauth-with-scope/', params)
          self.assertIn(response.status_code, (status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN))
  
      @unittest.skipUnless(oauth_provider, 'django-oauth-plus not installed')
 
</s> remove         """Ensure POSTing with a readonly resource instead of a write scope fails"""
 </s> add         """Ensure POSTing with a readonly scope instead of a write scope fails""" </s> remove         read_only_access_token.resource.is_readonly = True
        read_only_access_token.resource.save()
 </s> add         read_only_access_token.scope.is_readonly = True
        read_only_access_token.scope.save() </s> remove         read_write_access_token.resource.is_readonly = False
        read_write_access_token.resource.save()
 </s> add         read_write_access_token.scope.is_readonly = False
        read_write_access_token.scope.save() </s> remove         self.resource = Resource.objects.create(name="resource name", url="api/")
        self.token = OAuthToken.objects.create(user=self.user, consumer=self.consumer, resource=self.resource,
 </s> add         self.scope = Scope.objects.create(name="resource name", url="api/")
        self.token = OAuthToken.objects.create(user=self.user, consumer=self.consumer, scope=self.scope, </s> remove         return oauth_provider_store.check_nonce(request, oauth_request,
            oauth_request['oauth_nonce'], oauth_request['oauth_timestamp'])
 </s> add         oauth_nonce = oauth_request['oauth_nonce']
        oauth_timestamp = oauth_request['oauth_timestamp']
        return check_nonce(request, oauth_request, oauth_nonce, oauth_timestamp)
        read_only_access_token.scope.is_readonly = True
        read_only_access_token.scope.save()
      @unittest.skipUnless(oauth, 'oauth2 not installed')
      def test_post_form_with_readonly_resource_failing_auth(self):
          """Ensure POSTing with a readonly resource instead of a write scope fails"""
          read_only_access_token = self.token
        read_only_access_token.scope.is_readonly = True
        read_only_access_token.scope.save()
        read_only_access_token.scope.is_readonly = True
        read_only_access_token.scope.save()
          params = self._create_authorization_url_parameters()
          response = self.csrf_client.post('/oauth-with-scope/', params)
          self.assertIn(response.status_code, (status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN))
  
      @unittest.skipUnless(oauth_provider, 'django-oauth-plus not installed')
keep keep keep keep replace replace keep keep keep keep keep
 Compat fixes for django-oauth-plus versions 2.0-2.2.1 
rest_framework/tests/test_authentication.py