#NEWLINE# def test_request_without_tm( self , monkeypatch ) : #NEWLINE# #INDENT# async_result = pretend . stub ( ) #NEWLINE# super_class = pretend . stub ( apply_async = pretend . call_recorder ( ( lambda * a , **kw : async_result ) ) ) #NEWLINE# real_super = __builtins__ [ 'super' ] #NEWLINE# inner_super = pretend . call_recorder ( ( lambda * a , **kw : super_class ) ) #NEWLINE# def fake_super( * args , **kwargs ) : #NEWLINE# #INDENT# if ( ( not args ) and ( not kwargs ) ) : #NEWLINE# #INDENT# return inner_super ( * args , ** kwargs ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return real_super ( * args , ** kwargs ) #NEWLINE# #UNINDENT# #UNINDENT# monkeypatch . setitem ( __builtins__ , 'super' , fake_super ) #NEWLINE# request = pretend . stub ( ) #NEWLINE# get_current_request = pretend . call_recorder ( ( lambda : request ) ) #NEWLINE# monkeypatch . setattr ( celery , 'get_current_request' , get_current_request ) #NEWLINE# task = celery . WarehouseTask ( ) #NEWLINE# task . app = Celery ( ) #NEWLINE# assert ( task . apply_async ( ) is async_result ) #NEWLINE# assert ( super_class . apply_async . calls == [ pretend . call ( ) ] ) #NEWLINE# assert ( fake_super . calls == [ pretend . call ( ) ] ) #NEWLINE# assert ( inner_super . calls == [ pretend . call ( ) ] )