#NEWLINE# def test_doesnt_have_all_scope( self ) : #NEWLINE# #INDENT# @ scope_required ( 'test' , 'invalid' ) #NEWLINE# def doesnt_have_all_scope( request ) : #NEWLINE# #INDENT# return HttpResponse ( 'success' ) #NEWLINE# #UNINDENT# response = doesnt_have_all_scope ( self . request ) #NEWLINE# self . assertEqual ( response . status_code , 400 ) #NEWLINE# self . assertEqual ( response [ 'WWW-Authenticate' ] , request_error_header ( CredentialsNotProvided ) ) #NEWLINE# request = self . request #NEWLINE# request . META [ 'HTTP_AUTHORIZATION' ] = ( 'Bearer %s' % ( self . access_token . token , ) ) #NEWLINE# self . mw . process_request ( request ) #NEWLINE# response = doesnt_have_all_scope ( self . request ) #NEWLINE# self . assertEqual ( response . status_code , 403 ) #NEWLINE# self . assertEqual ( response [ 'WWW-Authenticate' ] , request_error_header ( ScopeNotEnough ) )