#NEWLINE# def test_post_form_with_expired_access_token_failing_auth( self ) : #NEWLINE# #INDENT# "Ensure POSTing with expired access token fails with an 'Invalid token' error" #NEWLINE# self . access_token . expires = ( datetime . datetime . now ( ) - datetime . timedelta ( seconds = 10 ) ) #NEWLINE# self . access_token . save ( ) #NEWLINE# auth = self . _create_authorization_header ( ) #NEWLINE# response = self . csrf_client . post ( '/oauth2-test/' , HTTP_AUTHORIZATION = auth ) #NEWLINE# self . assertIn ( self . status_code , ( status . HTTP_401_UNAUTHORIZED , status . HTTP_403_FORBIDDEN ) ) #NEWLINE# self . assertIn ( 'Invalid token' , response . content )