#NEWLINE# def test_send_api_fault_fresh_context( self ) : #NEWLINE# #INDENT# self . flags ( notify_api_faults = True ) #NEWLINE# exception = None #NEWLINE# try : #NEWLINE# #INDENT# raise test . TestingException ( 'junk' ) #NEWLINE# #UNINDENT# except test . TestingException as e : #NEWLINE# #INDENT# exception = e #NEWLINE# #UNINDENT# ctxt = context . RequestContext ( overwrite = True ) #NEWLINE# notifications . send_api_fault ( 'http://example.com/foo' , 500 , exception ) #NEWLINE# self . assertEqual ( 1 , len ( fake_notifier . NOTIFICATIONS ) ) #NEWLINE# n = fake_notifier . NOTIFICATIONS [ 0 ] #NEWLINE# self . assertEqual ( n . priority , 'ERROR' ) #NEWLINE# self . assertEqual ( n . event_type , 'api.fault' ) #NEWLINE# self . assertEqual ( n . payload [ 'url' ] , 'http://example.com/foo' ) #NEWLINE# self . assertEqual ( n . payload [ 'status' ] , 500 ) #NEWLINE# self . assertIsNotNone ( n . payload [ 'exception' ] ) #NEWLINE# self . assertEqual ( ctxt , n . context )