#NEWLINE# def test_cleanup_containers( self ) : #NEWLINE# #INDENT# container_test_sets = [ { #NEWLINE# #INDENT# 'delete_containers' : [ 'ssbench_001_default_policy' ] , #NEWLINE# 'other_containers' : [ 'foo' , 'bar' , 'ssbench_001_ec_policy' , 'ssbench_002_stuff' ] , #NEWLINE# 'base' : 'ssbench' , #NEWLINE# 'policy' : 'default_policy' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'delete_containers' : [ 'ssbench_001_ec_policy' ] , #NEWLINE# 'other_containers' : [ 'foo' , 'bar' , 'ssbench_001_default_policy' , 'ssbench_002_stuff' ] , #NEWLINE# 'base' : 'ssbench' , #NEWLINE# 'policy' : 'ec_policy' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'delete_containers' : [ 'ssbench_002_stuff' ] , #NEWLINE# 'other_containers' : [ 'foo' , 'bar' , 'ssbench_001_ec_policy' , 'ssbench_001_ec_policy' ] , #NEWLINE# 'base' : 'ssbench' , #NEWLINE# 'policy' : 'stuff' , #NEWLINE# #UNINDENT# } ] #NEWLINE# for test_input in container_test_sets : #NEWLINE# #INDENT# client = mock . Mock ( ) #NEWLINE# policy = test_input [ 'policy' ] #NEWLINE# base_name = test_input [ 'base' ] #NEWLINE# delete_containers = test_input [ 'delete_containers' ] #NEWLINE# other_containers = test_input [ 'other_containers' ] #NEWLINE# all_containers = ( delete_containers + other_containers ) #NEWLINE# container_info = [ { #NEWLINE# #INDENT# 'name' : container , #NEWLINE# 'count' : 0 , #NEWLINE# #UNINDENT# } for container in all_containers ] #NEWLINE# client . get_account . return_value = ( None , container_info ) #NEWLINE# client . get_container . return_value = ( None , [ ] ) #NEWLINE# client . http_connection . return_value = None #NEWLINE# auth_args = { #NEWLINE# #INDENT# 'token' : 'auth_token' , #NEWLINE# 'storage_urls' : [ 'http://storageUrl' ] , #NEWLINE# #UNINDENT# } #NEWLINE# with mock . patch ( 'ssbench.master.client' , new = client ) : #NEWLINE# #INDENT# self . master . cleanup_containers ( auth_args , base_name , 1 , policy ) #NEWLINE# #UNINDENT# expected_calls = [ ] #NEWLINE# for container in delete_containers : #NEWLINE# #INDENT# expected_calls . append ( mock . call ( auth_args [ 'storage_urls' ] [ 0 ] , auth_args [ 'token' ] , container , http_conn = None ) ) #NEWLINE# #UNINDENT# client . delete_container . assert_has_calls ( expected_calls , any_order = True )