#NEWLINE# def test_oauth_errors( self ) : #NEWLINE# #INDENT# expires_response = '{\n          "error": {\n            "type": "OAuthException",\n            "message": "Session has expired at unix time SOME_TIME. The current unix time is SOME_TIME."\n          }\n        } ' #NEWLINE# changed_password_response = '\n        {\n          "error": {\n            "type": "OAuthException",\n            "message": "The session has been invalidated because the user has changed the password."\n          }\n        }\n        ' #NEWLINE# deauthorized_response = '\n        {\n          "error": {\n            "type": "OAuthException",\n            "message": "Error validating access token: USER_ID has not authorized application APP_ID"\n          }\n        }\n        ' #NEWLINE# loggedout_response = '\n        {\n          "error": {\n            "type": "OAuthException",\n            "message": "Error validating access token: The session is invalid because the user logged out."\n           }\n        }\n        ' #NEWLINE# responses = [ expires_response , changed_password_response , deauthorized_response , loggedout_response ] #NEWLINE# response_objects = [ ] #NEWLINE# for response_string in responses : #NEWLINE# #INDENT# response = json . loads ( response_string ) #NEWLINE# response_objects . append ( response ) #NEWLINE# #UNINDENT# from open_facebook import exceptions as open_facebook_exceptions #NEWLINE# for response in response_objects : #NEWLINE# #INDENT# oauth = False #NEWLINE# try : #NEWLINE# #INDENT# FacebookConnection . raise_error ( response [ 'error' ] [ 'type' ] , response [ 'error' ] [ 'message' ] ) #NEWLINE# #UNINDENT# except open_facebook_exceptions . OAuthException as e : #NEWLINE# #INDENT# oauth = True #NEWLINE# #UNINDENT# assert oauth , ( 'response %s didnt raise oauth error' % self )