#NEWLINE# def _execute_adventure( self , name , node_id , expect_code = 202 , exceptions = None , solve = True , expect_backend_fail = False ) : #NEWLINE# #INDENT# adv = self . _model_find_by_name ( 'adventures' , solve ) #NEWLINE# if ( solve is True ) : #NEWLINE# #INDENT# resp = self . client . post ( ( '/adventures/%s/execute' % ( adv [ 'id' ] , ) ) , content_type = 'application/json' , data = json . dumps ( { #NEWLINE# #INDENT# 'node' : node_id , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# self . assertEqual ( expect_code , resp . status_code ) #NEWLINE# data = json . loads ( resp . data ) #NEWLINE# self . assertTrue ( ( expect_code in [ 202 , 403 , 409 ] ) ) #NEWLINE# self . assertTrue ( ( 'plan' in data ) ) #NEWLINE# plan = data [ 'plan' ] #NEWLINE# if ( resp . status_code == 409 ) : #NEWLINE# #INDENT# plan = self . _default_plan ( plan , exceptions ) #NEWLINE# #UNINDENT# self . _post_and_run_plan ( plan , node_id , expect_backend_fail = expect_backend_fail ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# plan = adv [ 'dsl' ] #NEWLINE# plan = self . _default_by_analysis ( node_id , plan , exceptions ) #NEWLINE# self . _safely_run_plan ( plan , node_id , expect_backend_fail = expect_backend_fail )