#NEWLINE# @ mock . patch ( ( HEAT_STACKS + '.generate_random_name' ) ) #NEWLINE# @ mock . patch ( ( HEAT_STACKS + '._delete_stack' ) ) #NEWLINE# @ mock . patch ( ( HEAT_STACKS + '._create_stack' ) ) #NEWLINE# def test_create_and_delete_stack( self , mock__create_stack , mock__delete_stack , mock_generate_random_name ) : #NEWLINE# #INDENT# heat_scenario = stacks . HeatStacks ( self . context ) #NEWLINE# fake_stack = object ( ) #NEWLINE# mock__create_stack . return_value = fake_stack #NEWLINE# mock_generate_random_name . return_value = 'test-rally-stack' #NEWLINE# heat_scenario . create_and_delete_stack ( template_path = self . default_template , parameters = self . default_parameters , files = self . default_files , environment = self . default_environment ) #NEWLINE# mock__create_stack . assert_called_once_with ( self . default_template , self . default_parameters , self . default_files , self . default_environment ) #NEWLINE# mock__delete_stack . assert_called_once_with ( fake_stack )