#NEWLINE# def test_includeme( monkeypatch ) : #NEWLINE# #INDENT# class Registry ( dict ) : #NEWLINE# #INDENT# def __init__( self ) : #NEWLINE# #INDENT# self . settings = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# #UNINDENT# client_obj = pretend . stub ( ) #NEWLINE# client_cls = pretend . call_recorder ( ( lambda **kw : client_obj ) ) #NEWLINE# monkeypatch . setattr ( real_raven , 'Client' , client_cls ) #NEWLINE# config = pretend . stub ( registry = Registry ( ) , add_request_method = pretend . call_recorder ( ( lambda * a , **kw : None ) ) , add_wsgi_middleware = pretend . call_recorder ( ( lambda * a , **kw : None ) ) , add_tween = pretend . call_recorder ( ( lambda * a , **kw : None ) ) ) #NEWLINE# config . registry . settings . update ( { #NEWLINE# #INDENT# 'warehouse.commit' : 'blargh' , #NEWLINE# 'sentry.dsn' : 'the dsn' , #NEWLINE# 'sentry.transport' : 'the transport' , #NEWLINE# #UNINDENT# } ) #NEWLINE# raven . includeme ( config ) #NEWLINE# assert ( client_cls . calls == [ pretend . call ( dsn = 'the dsn' , include_paths = [ 'warehouse' ] , release = 'blargh' , transport = 'the transport' ) ] ) #NEWLINE# assert ( config . registry [ 'raven.client' ] is client_obj ) #NEWLINE# assert ( config . add_request_method . calls == [ pretend . call ( raven . _raven , name = 'raven' , reify = True ) ] ) #NEWLINE# assert ( config . add_tween . calls == [ pretend . call ( 'warehouse.raven.raven_tween_factory' , over = EXCVIEW , under = [ 'pyramid_debugtoolbar.toolbar_tween_factory' , INGRESS ] ) ] ) #NEWLINE# assert ( config . add_wsgi_middleware . calls == [ pretend . call ( SentryMiddleware , client = monkeypatch ) ] )