@@ -66,7 +66,8 @@ impl StdcmSearchEnvironmentChangeset {
66
66
67
67
#[ cfg( test) ]
68
68
pub mod tests {
69
- use chrono:: NaiveDate ;
69
+ use chrono:: TimeZone ;
70
+ use chrono:: Utc ;
70
71
use pretty_assertions:: assert_eq;
71
72
use rstest:: rstest;
72
73
@@ -128,31 +129,11 @@ pub mod tests {
128
129
. work_schedule_group_id ( Some ( work_schedule_group. id ) )
129
130
. temporary_speed_limit_group_id ( Some ( temporary_speed_limit_group. id ) )
130
131
. timetable_id ( timetable. id )
131
- . search_window_begin (
132
- NaiveDate :: from_ymd_opt ( 2024 , 1 , 1 )
133
- . unwrap ( )
134
- . and_hms_opt ( 0 , 0 , 0 )
135
- . unwrap ( )
136
- . and_utc ( ) ,
137
- )
138
- . search_window_end (
139
- NaiveDate :: from_ymd_opt ( 2024 , 1 , 15 )
140
- . unwrap ( )
141
- . and_hms_opt ( 0 , 0 , 0 )
142
- . unwrap ( )
143
- . and_utc ( ) ,
144
- ) ;
132
+ . search_window_begin ( Utc . with_ymd_and_hms ( 2024 , 1 , 1 , 0 , 0 , 0 ) . unwrap ( ) )
133
+ . search_window_end ( Utc . with_ymd_and_hms ( 2024 , 1 , 15 , 0 , 0 , 0 ) . unwrap ( ) ) ;
145
134
146
- let begin = NaiveDate :: from_ymd_opt ( 2024 , 1 , 16 )
147
- . unwrap ( )
148
- . and_hms_opt ( 0 , 0 , 0 )
149
- . unwrap ( )
150
- . and_utc ( ) ;
151
- let end = NaiveDate :: from_ymd_opt ( 2024 , 1 , 31 )
152
- . unwrap ( )
153
- . and_hms_opt ( 0 , 0 , 0 )
154
- . unwrap ( )
155
- . and_utc ( ) ;
135
+ let begin = Utc . with_ymd_and_hms ( 2024 , 1 , 16 , 0 , 0 , 0 ) . unwrap ( ) ;
136
+ let end = Utc . with_ymd_and_hms ( 2024 , 1 , 13 , 0 , 0 , 0 ) . unwrap ( ) ;
156
137
157
138
let changeset_2 = changeset_1
158
139
. clone ( )
@@ -211,48 +192,16 @@ pub mod tests {
211
192
. work_schedule_group_id ( Some ( work_schedule_group. id ) )
212
193
. temporary_speed_limit_group_id ( Some ( temporary_speed_limit_group. id ) )
213
194
. timetable_id ( timetable. id )
214
- . search_window_begin (
215
- NaiveDate :: from_ymd_opt ( 2024 , 1 , 1 )
216
- . unwrap ( )
217
- . and_hms_opt ( 0 , 0 , 0 )
218
- . unwrap ( )
219
- . and_utc ( ) ,
220
- )
221
- . search_window_end (
222
- NaiveDate :: from_ymd_opt ( 2024 , 1 , 15 )
223
- . unwrap ( )
224
- . and_hms_opt ( 0 , 0 , 0 )
225
- . unwrap ( )
226
- . and_utc ( ) ,
227
- ) ;
195
+ . search_window_begin ( Utc . with_ymd_and_hms ( 2024 , 1 , 1 , 0 , 0 , 0 ) . unwrap ( ) )
196
+ . search_window_end ( Utc . with_ymd_and_hms ( 2024 , 1 , 15 , 0 , 0 , 0 ) . unwrap ( ) ) ;
228
197
229
198
let too_young = too_old
230
199
. clone ( )
231
- . search_window_begin (
232
- NaiveDate :: from_ymd_opt ( 2024 , 1 , 16 )
233
- . unwrap ( )
234
- . and_hms_opt ( 0 , 0 , 0 )
235
- . unwrap ( )
236
- . and_utc ( ) ,
237
- )
238
- . search_window_end (
239
- NaiveDate :: from_ymd_opt ( 2024 , 1 , 31 )
240
- . unwrap ( )
241
- . and_hms_opt ( 0 , 0 , 0 )
242
- . unwrap ( )
243
- . and_utc ( ) ,
244
- ) ;
200
+ . search_window_begin ( Utc . with_ymd_and_hms ( 2024 , 1 , 16 , 0 , 0 , 0 ) . unwrap ( ) )
201
+ . search_window_end ( Utc . with_ymd_and_hms ( 2024 , 1 , 31 , 0 , 0 , 0 ) . unwrap ( ) ) ;
245
202
246
- let begin = NaiveDate :: from_ymd_opt ( 2024 , 1 , 7 )
247
- . unwrap ( )
248
- . and_hms_opt ( 0 , 0 , 0 )
249
- . unwrap ( )
250
- . and_utc ( ) ;
251
- let end = NaiveDate :: from_ymd_opt ( 2024 , 1 , 31 )
252
- . unwrap ( )
253
- . and_hms_opt ( 0 , 0 , 0 )
254
- . unwrap ( )
255
- . and_utc ( ) ;
203
+ let begin = Utc . with_ymd_and_hms ( 2024 , 1 , 7 , 0 , 0 , 0 ) . unwrap ( ) ;
204
+ let end = Utc . with_ymd_and_hms ( 2024 , 1 , 31 , 0 , 0 , 0 ) . unwrap ( ) ;
256
205
257
206
let the_best = too_old
258
207
. clone ( )
0 commit comments