#NEWLINE# def test_create_instance_with_bdm_delete_on_termination( self ) : #NEWLINE# #INDENT# bdm = [ { #NEWLINE# #INDENT# 'device_name' : 'foo1' , #NEWLINE# 'volume_id' : fakes . FAKE_UUID , #NEWLINE# 'delete_on_termination' : 'True' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'device_name' : 'foo2' , #NEWLINE# 'volume_id' : fakes . FAKE_UUID , #NEWLINE# 'delete_on_termination' : True , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'device_name' : 'foo3' , #NEWLINE# 'volume_id' : fakes . FAKE_UUID , #NEWLINE# 'delete_on_termination' : 'invalid' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'device_name' : 'foo4' , #NEWLINE# 'volume_id' : fakes . FAKE_UUID , #NEWLINE# 'delete_on_termination' : False , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'device_name' : 'foo5' , #NEWLINE# 'volume_id' : fakes . FAKE_UUID , #NEWLINE# 'delete_on_termination' : False , #NEWLINE# #UNINDENT# } ] #NEWLINE# expected_bdm = [ { #NEWLINE# #INDENT# 'device_name' : 'foo1' , #NEWLINE# 'volume_id' : fakes . FAKE_UUID , #NEWLINE# 'delete_on_termination' : True , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'device_name' : 'foo2' , #NEWLINE# 'volume_id' : fakes . FAKE_UUID , #NEWLINE# 'delete_on_termination' : True , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'device_name' : 'foo3' , #NEWLINE# 'volume_id' : fakes . FAKE_UUID , #NEWLINE# 'delete_on_termination' : False , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'device_name' : 'foo4' , #NEWLINE# 'volume_id' : fakes . FAKE_UUID , #NEWLINE# 'delete_on_termination' : False , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'device_name' : 'foo5' , #NEWLINE# 'volume_id' : fakes . FAKE_UUID , #NEWLINE# 'delete_on_termination' : False , #NEWLINE# #UNINDENT# } ] #NEWLINE# params = { #NEWLINE# #INDENT# 'block_device_mapping' : bdm , #NEWLINE# #UNINDENT# } #NEWLINE# old_create = compute_api . API . create #NEWLINE# def create( * args , **kwargs ) : #NEWLINE# #INDENT# self . assertEqual ( expected_bdm , kwargs [ 'block_device_mapping' ] ) #NEWLINE# return old_create ( * args , ** kwargs ) #NEWLINE# #UNINDENT# def _validate_bdm( * args , **kwargs ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# self . stubs . Set ( compute_api . API , 'create' , create ) #NEWLINE# self . stubs . Set ( compute_api . API , '_validate_bdm' , _validate_bdm ) #NEWLINE# self . _test_create ( params )