#NEWLINE# def test_request_middleware_exception( self ) : #NEWLINE# #INDENT# with Settings ( MIDDLEWARE_CLASSES = [ 'tests.contrib.django.middleware.BrokenRequestMiddleware' ] ) : #NEWLINE# #INDENT# self . assertRaises ( ImportError , self . client . get , reverse ( 'sentry-raise-exc' ) ) #NEWLINE# assert ( len ( self . raven . events ) == 1 ) #NEWLINE# event = self . raven . events . pop ( 0 ) #NEWLINE# assert ( 'exception' in event ) #NEWLINE# exc = event [ 'exception' ] [ 'values' ] [ 0 ] #NEWLINE# assert ( exc [ 'type' ] == 'ImportError' ) #NEWLINE# assert ( exc [ 'value' ] == 'request' ) #NEWLINE# assert ( event [ 'level' ] == logging . ERROR ) #NEWLINE# assert ( self [ 'message' ] == 'ImportError: request' ) #NEWLINE# assert ( event [ 'culprit' ] == 'tests.contrib.django.middleware in process_request' )