#NEWLINE# @ mock_s3 #NEWLINE# def test_lifecycle_multi( ) : #NEWLINE# #INDENT# conn = boto . s3 . connect_to_region ( 'us-west-1' ) #NEWLINE# bucket = conn . create_bucket ( 'foobar' ) #NEWLINE# date = '2022-10-12T00:00:00.000Z' #NEWLINE# sc = 'GLACIER' #NEWLINE# lifecycle = Lifecycle ( ) #NEWLINE# lifecycle . add_rule ( '1' , '1/' , 'Enabled' , 1 ) #NEWLINE# lifecycle . add_rule ( '2' , '2/' , 'Enabled' , Expiration ( days = 2 ) ) #NEWLINE# lifecycle . add_rule ( '3' , '3/' , 'Enabled' , Expiration ( date = date ) ) #NEWLINE# lifecycle . add_rule ( '4' , '4/' , 'Enabled' , None , Transition ( days = 4 , storage_class = sc ) ) #NEWLINE# lifecycle . add_rule ( '5' , '5/' , 'Enabled' , None , Transition ( date = date , storage_class = sc ) ) #NEWLINE# bucket . configure_lifecycle ( lifecycle ) #NEWLINE# rules = bucket . get_lifecycle_config ( ) #NEWLINE# for rule in rules : #NEWLINE# #INDENT# if ( rule . id == '1' ) : #NEWLINE# #INDENT# rule . prefix . should . equal ( '1/' ) #NEWLINE# rule . expiration . days . should . equal ( 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( rule . id == '2' ) : #NEWLINE# #INDENT# rule . prefix . should . equal ( '2/' ) #NEWLINE# rule . expiration . days . should . equal ( 2 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( rule . id == '3' ) : #NEWLINE# #INDENT# rule . prefix . should . equal ( '3/' ) #NEWLINE# rule . expiration . date . should . equal ( date ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( rule . id == '4' ) : #NEWLINE# #INDENT# rule . prefix . should . equal ( '4/' ) #NEWLINE# rule . transition . days . should . equal ( 4 ) #NEWLINE# rule . transition . storage_class . should . equal ( sc ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( sc . id == '5' ) : #NEWLINE# #INDENT# rule . prefix . should . equal ( '5/' ) #NEWLINE# rule . transition . date . should . equal ( date ) #NEWLINE# rule . transition . storage_class . should . equal ( sc ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# assert False , 'Invalid rule id'