#NEWLINE# def test_refuse_refreshable_tokens( self ) : #NEWLINE# #INDENT# api_key = self . create_api_key ( self . user ) #NEWLINE# payload = self . auth_token_payload ( ctx . user , api_key . key ) #NEWLINE# payload [ 'orig_iat' ] = timegm ( payload [ 'iat' ] . utctimetuple ( ) ) #NEWLINE# token = self . encode_token_payload ( payload , api_key . secret ) #NEWLINE# with self . assertRaises ( AuthenticationFailed ) as ctx : #NEWLINE# #INDENT# self . auth . authenticate ( self . request ( token ) ) #NEWLINE# #UNINDENT# assert ( ctx . exception . detail == "API key based tokens are not refreshable, don't include `orig_iat` in their payload." )