#NEWLINE# @ mock . patch . object ( configdrive , 'required_by' ) #NEWLINE# @ mock . patch . object ( objects . Instance , 'save' ) #NEWLINE# @ mock . patch . object ( FAKE_CLIENT , 'node' ) #NEWLINE# @ mock . patch . object ( ironic_driver . IronicDriver , '_generate_configdrive' ) #NEWLINE# @ mock . patch . object ( ironic_driver . IronicDriver , '_start_firewall' ) #NEWLINE# @ mock . patch . object ( ironic_driver . IronicDriver , '_plug_vifs' ) #NEWLINE# @ mock . patch . object ( ironic_driver . IronicDriver , '_cleanup_deploy' ) #NEWLINE# def test_spawn_node_configdrive_fail( self , mock_cleanup_deploy , mock_pvifs , mock_sf , mock_configdrive , mock_node , mock_save , mock_required_by ) : #NEWLINE# #INDENT# mock_required_by . return_value = True #NEWLINE# node_uuid = 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee' #NEWLINE# node = ironic_utils . get_test_node ( driver = 'fake' , uuid = node_uuid ) #NEWLINE# flavor = ironic_utils . get_test_flavor ( ) #NEWLINE# instance = fake_instance . fake_instance_obj ( self . ctx , node = node_uuid ) #NEWLINE# instance . flavor = flavor #NEWLINE# mock_node . get . return_value = node #NEWLINE# mock_node . validate . return_value = ironic_utils . get_test_validation ( ) #NEWLINE# image_meta = ironic_utils . get_test_image_meta ( ) #NEWLINE# class TestException ( Exception ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# mock_configdrive . side_effect = TestException ( ) #NEWLINE# self . assertRaises ( TestException , self . driver . spawn , self . ctx , instance , image_meta , [ ] , None ) #NEWLINE# mock_node . get . assert_called_once_with ( node_uuid , fields = ironic_driver . _NODE_FIELDS ) #NEWLINE# mock_node . validate . assert_called_once_with ( node_uuid ) #NEWLINE# mock_cleanup_deploy . assert_called_with ( self . ctx , node , instance , None , flavor = mock_cleanup_deploy )