#NEWLINE# def test_call( self , monkeypatch ) : #NEWLINE# #INDENT# request = pretend . stub ( ) #NEWLINE# registry = pretend . stub ( ) #NEWLINE# result = pretend . stub ( ) #NEWLINE# prepared = { #NEWLINE# #INDENT# 'registry' : registry , #NEWLINE# 'request' : request , #NEWLINE# 'closer' : pretend . call_recorder ( ( lambda : None ) ) , #NEWLINE# #UNINDENT# } #NEWLINE# prepare = pretend . call_recorder ( ( lambda * a , **kw : prepared ) ) #NEWLINE# monkeypatch . setattr ( scripting , 'prepare' , prepare ) #NEWLINE# @ pretend . call_recorder #NEWLINE# def runner( irequest ) : #NEWLINE# #INDENT# assert ( irequest is request ) #NEWLINE# return result #NEWLINE# #UNINDENT# task = celery . WarehouseTask ( ) #NEWLINE# task . app = Celery ( ) #NEWLINE# task . app . pyramid_config = pretend . stub ( registry = registry ) #NEWLINE# task . run = runner #NEWLINE# assert ( task ( ) is result ) #NEWLINE# assert ( prepare . calls == [ pretend . call ( registry = registry ) ] ) #NEWLINE# assert ( prepared [ 'closer' ] . calls == [ pretend . call ( ) ] ) #NEWLINE# assert ( runner . calls == [ pretend . call ( request ) ] )