@@ -77,6 +77,8 @@ def test_ctor_w_created_before_and_is_live(self):
77
77
self .assertEqual (conditions .is_live , False )
78
78
self .assertIsNone (conditions .matches_storage_class )
79
79
self .assertIsNone (conditions .number_of_newer_versions )
80
+ self .assertIsNone (conditions .days_since_custom_time )
81
+ self .assertIsNone (conditions .custom_time_before )
80
82
self .assertIsNone (conditions .noncurrent_time_before )
81
83
82
84
def test_ctor_w_number_of_newer_versions (self ):
@@ -89,6 +91,19 @@ def test_ctor_w_number_of_newer_versions(self):
89
91
self .assertIsNone (conditions .matches_storage_class )
90
92
self .assertEqual (conditions .number_of_newer_versions , 3 )
91
93
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
+
92
107
def test_ctor_w_days_since_noncurrent_time (self ):
93
108
conditions = self ._make_one (
94
109
number_of_newer_versions = 3 , days_since_noncurrent_time = 2
@@ -102,6 +117,25 @@ def test_ctor_w_days_since_noncurrent_time(self):
102
117
self .assertEqual (conditions .number_of_newer_versions , 3 )
103
118
self .assertEqual (conditions .days_since_noncurrent_time , 2 )
104
119
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
+
105
139
def test_ctor_w_noncurrent_time_before (self ):
106
140
import datetime
107
141
@@ -125,16 +159,18 @@ def test_ctor_w_noncurrent_time_before(self):
125
159
def test_from_api_repr (self ):
126
160
import datetime
127
161
162
+ custom_time_before = datetime .date (2018 , 8 , 1 )
128
163
noncurrent_before = datetime .date (2018 , 8 , 1 )
129
164
before = datetime .date (2018 , 8 , 1 )
130
165
klass = self ._get_target_class ()
131
-
132
166
resource = {
133
167
"age" : 10 ,
134
168
"createdBefore" : "2018-08-01" ,
135
169
"isLive" : True ,
136
170
"matchesStorageClass" : ["COLDLINE" ],
137
171
"numNewerVersions" : 3 ,
172
+ "daysSinceCustomTime" : 2 ,
173
+ "customTimeBefore" : custom_time_before .isoformat (),
138
174
"daysSinceNoncurrentTime" : 2 ,
139
175
"noncurrentTimeBefore" : noncurrent_before .isoformat (),
140
176
}
@@ -144,6 +180,8 @@ def test_from_api_repr(self):
144
180
self .assertEqual (conditions .is_live , True )
145
181
self .assertEqual (conditions .matches_storage_class , ["COLDLINE" ])
146
182
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 )
147
185
self .assertEqual (conditions .days_since_noncurrent_time , 2 )
148
186
self .assertEqual (conditions .noncurrent_time_before , noncurrent_before )
149
187
0 commit comments