Skip to content

Commit

Permalink
fixup! editoast: change stdcm environment date type
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahBellaha committed Dec 17, 2024
1 parent a4621b4 commit 98c105b
Showing 1 changed file with 12 additions and 63 deletions.
75 changes: 12 additions & 63 deletions editoast/src/models/stdcm_search_environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ impl StdcmSearchEnvironmentChangeset {

#[cfg(test)]
pub mod tests {
use chrono::NaiveDate;
use chrono::TimeZone;
use chrono::Utc;
use pretty_assertions::assert_eq;
use rstest::rstest;

Expand Down Expand Up @@ -128,31 +129,11 @@ pub mod tests {
.work_schedule_group_id(Some(work_schedule_group.id))
.temporary_speed_limit_group_id(Some(temporary_speed_limit_group.id))
.timetable_id(timetable.id)
.search_window_begin(
NaiveDate::from_ymd_opt(2024, 1, 1)
.unwrap()
.and_hms_opt(0, 0, 0)
.unwrap()
.and_utc(),
)
.search_window_end(
NaiveDate::from_ymd_opt(2024, 1, 15)
.unwrap()
.and_hms_opt(0, 0, 0)
.unwrap()
.and_utc(),
);
.search_window_begin(Utc.with_ymd_and_hms(2024, 1, 1, 0, 0, 0).unwrap())
.search_window_end(Utc.with_ymd_and_hms(2024, 1, 15, 0, 0, 0).unwrap());

let begin = NaiveDate::from_ymd_opt(2024, 1, 16)
.unwrap()
.and_hms_opt(0, 0, 0)
.unwrap()
.and_utc();
let end = NaiveDate::from_ymd_opt(2024, 1, 31)
.unwrap()
.and_hms_opt(0, 0, 0)
.unwrap()
.and_utc();
let begin = Utc.with_ymd_and_hms(2024, 1, 16, 0, 0, 0).unwrap();
let end = Utc.with_ymd_and_hms(2024, 1, 13, 0, 0, 0).unwrap();

let changeset_2 = changeset_1
.clone()
Expand Down Expand Up @@ -211,48 +192,16 @@ pub mod tests {
.work_schedule_group_id(Some(work_schedule_group.id))
.temporary_speed_limit_group_id(Some(temporary_speed_limit_group.id))
.timetable_id(timetable.id)
.search_window_begin(
NaiveDate::from_ymd_opt(2024, 1, 1)
.unwrap()
.and_hms_opt(0, 0, 0)
.unwrap()
.and_utc(),
)
.search_window_end(
NaiveDate::from_ymd_opt(2024, 1, 15)
.unwrap()
.and_hms_opt(0, 0, 0)
.unwrap()
.and_utc(),
);
.search_window_begin(Utc.with_ymd_and_hms(2024, 1, 1, 0, 0, 0).unwrap())
.search_window_end(Utc.with_ymd_and_hms(2024, 1, 15, 0, 0, 0).unwrap());

let too_young = too_old
.clone()
.search_window_begin(
NaiveDate::from_ymd_opt(2024, 1, 16)
.unwrap()
.and_hms_opt(0, 0, 0)
.unwrap()
.and_utc(),
)
.search_window_end(
NaiveDate::from_ymd_opt(2024, 1, 31)
.unwrap()
.and_hms_opt(0, 0, 0)
.unwrap()
.and_utc(),
);
.search_window_begin(Utc.with_ymd_and_hms(2024, 1, 16, 0, 0, 0).unwrap())
.search_window_end(Utc.with_ymd_and_hms(2024, 1, 31, 0, 0, 0).unwrap());

let begin = NaiveDate::from_ymd_opt(2024, 1, 7)
.unwrap()
.and_hms_opt(0, 0, 0)
.unwrap()
.and_utc();
let end = NaiveDate::from_ymd_opt(2024, 1, 31)
.unwrap()
.and_hms_opt(0, 0, 0)
.unwrap()
.and_utc();
let begin = Utc.with_ymd_and_hms(2024, 1, 7, 0, 0, 0).unwrap();
let end = Utc.with_ymd_and_hms(2024, 1, 31, 0, 0, 0).unwrap();

let the_best = too_old
.clone()
Expand Down

0 comments on commit 98c105b

Please sign in to comment.