#NEWLINE# @ mock . patch ( 'raven.transport.http.HTTPTransport.send' ) #NEWLINE# @ mock . patch ( 'raven.base.ClientState.should_try' ) #NEWLINE# def test_send_remote_failover_with_retry_after( self , should_try , send ) : #NEWLINE# #INDENT# should_try . return_value = True #NEWLINE# client = Client ( dsn = 'sync+http://public:secret@example.com/1' ) #NEWLINE# send . side_effect = RateLimited ( 'foo' , 5 ) #NEWLINE# client . send_remote ( 'sync+http://example.com/api/1/store/' , client . encode ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) #NEWLINE# self . assertEquals ( client . state . status , client . state . ERROR ) #NEWLINE# self . assertEqual ( client . state . retry_after , 5 ) #NEWLINE# send . side_effect = None #NEWLINE# client . send_remote ( 'sync+http://example.com/api/1/store/' , client . encode ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) #NEWLINE# self . assertEquals ( client . state . status , client . state . ONLINE ) #NEWLINE# self . assertEqual ( client . state . retry_after , 0 )