@@ -77,6 +77,8 @@ def test_ctor_w_created_before_and_is_live(self):
7777 self .assertEqual (conditions .is_live , False )
7878 self .assertIsNone (conditions .matches_storage_class )
7979 self .assertIsNone (conditions .number_of_newer_versions )
80+ self .assertIsNone (conditions .days_since_custom_time )
81+ self .assertIsNone (conditions .custom_time_before )
8082 self .assertIsNone (conditions .noncurrent_time_before )
8183
8284 def test_ctor_w_number_of_newer_versions (self ):
@@ -89,6 +91,19 @@ def test_ctor_w_number_of_newer_versions(self):
8991 self .assertIsNone (conditions .matches_storage_class )
9092 self .assertEqual (conditions .number_of_newer_versions , 3 )
9193
94+ def test_ctor_w_days_since_custom_time (self ):
95+ conditions = self ._make_one (
96+ number_of_newer_versions = 3 , days_since_custom_time = 2
97+ )
98+ expected = {"numNewerVersions" : 3 , "daysSinceCustomTime" : 2 }
99+ self .assertEqual (dict (conditions ), expected )
100+ self .assertIsNone (conditions .age )
101+ self .assertIsNone (conditions .created_before )
102+ self .assertIsNone (conditions .is_live )
103+ self .assertIsNone (conditions .matches_storage_class )
104+ self .assertEqual (conditions .number_of_newer_versions , 3 )
105+ self .assertEqual (conditions .days_since_custom_time , 2 )
106+
92107 def test_ctor_w_days_since_noncurrent_time (self ):
93108 conditions = self ._make_one (
94109 number_of_newer_versions = 3 , days_since_noncurrent_time = 2
@@ -102,6 +117,25 @@ def test_ctor_w_days_since_noncurrent_time(self):
102117 self .assertEqual (conditions .number_of_newer_versions , 3 )
103118 self .assertEqual (conditions .days_since_noncurrent_time , 2 )
104119
120+ def test_ctor_w_custom_time_before (self ):
121+ import datetime
122+
123+ custom_time_before = datetime .date (2018 , 8 , 1 )
124+ conditions = self ._make_one (
125+ number_of_newer_versions = 3 , custom_time_before = custom_time_before
126+ )
127+ expected = {
128+ "numNewerVersions" : 3 ,
129+ "customTimeBefore" : custom_time_before .isoformat (),
130+ }
131+ self .assertEqual (dict (conditions ), expected )
132+ self .assertIsNone (conditions .age )
133+ self .assertIsNone (conditions .created_before )
134+ self .assertIsNone (conditions .is_live )
135+ self .assertIsNone (conditions .matches_storage_class )
136+ self .assertEqual (conditions .number_of_newer_versions , 3 )
137+ self .assertEqual (conditions .custom_time_before , custom_time_before )
138+
105139 def test_ctor_w_noncurrent_time_before (self ):
106140 import datetime
107141
@@ -125,16 +159,18 @@ def test_ctor_w_noncurrent_time_before(self):
125159 def test_from_api_repr (self ):
126160 import datetime
127161
162+ custom_time_before = datetime .date (2018 , 8 , 1 )
128163 noncurrent_before = datetime .date (2018 , 8 , 1 )
129164 before = datetime .date (2018 , 8 , 1 )
130165 klass = self ._get_target_class ()
131-
132166 resource = {
133167 "age" : 10 ,
134168 "createdBefore" : "2018-08-01" ,
135169 "isLive" : True ,
136170 "matchesStorageClass" : ["COLDLINE" ],
137171 "numNewerVersions" : 3 ,
172+ "daysSinceCustomTime" : 2 ,
173+ "customTimeBefore" : custom_time_before .isoformat (),
138174 "daysSinceNoncurrentTime" : 2 ,
139175 "noncurrentTimeBefore" : noncurrent_before .isoformat (),
140176 }
@@ -144,6 +180,8 @@ def test_from_api_repr(self):
144180 self .assertEqual (conditions .is_live , True )
145181 self .assertEqual (conditions .matches_storage_class , ["COLDLINE" ])
146182 self .assertEqual (conditions .number_of_newer_versions , 3 )
183+ self .assertEqual (conditions .days_since_custom_time , 2 )
184+ self .assertEqual (conditions .custom_time_before , custom_time_before )
147185 self .assertEqual (conditions .days_since_noncurrent_time , 2 )
148186 self .assertEqual (conditions .noncurrent_time_before , noncurrent_before )
149187
0 commit comments