forge
Explore
Log in

Don't you dare go Hollow

Past-time rejection coverage across every surface

Browse files at this commit

e70e5f5e901f5fcf6f3aba4f961babe946680744Ahmet Kaan GümüşParent: bd67462
  • test
    • past-time rejection coverage across every surface
Show full message
✅ test(schedule): past-time rejection coverage across every surface

- create + PATCH × starts_at/ends_at × exam/session/event all reject
  past values; ends_at cases sit behind a future starts_at so the
  rejection can only come from the end being past
- kept-past exemption: title-only PATCH on a running exam and topic-only
  PATCH on an underway lesson stay 200
- grace is exercised both ways: create at now-30s and PATCH to now-20s
  pass; the already-closed-window fixture moved inside the grace
  (now-50s .. now-10s) so it stays constructible
- 1970-epoch fixtures (starts_at 1/2/1000/1.7e12) rewritten to
  now-relative future instants
tests/integration.rsmodified+225 -33
@@ -705,6 +705,9 @@ async fn deleting_event_cascades_attendance() {
705 async fn event_timestamps_echo_and_validate() {705 async fn event_timestamps_echo_and_validate() {
706 let (app, db) = app_and_db().await;706 let (app, db) = app_and_db().await;
707 let ali = login_as(&app, &db, "ali", "teacher").await;707 let ali = login_as(&app, &db, "ali", "teacher").await;
708+ let now = Timestamp::now().as_millis();
709+ let starts = now + 3_600_000;
710+ let ends = now + 7_200_000;
708 711
709 // Create with unix-millis times.712 // Create with unix-millis times.
710 let res = send(713 let res = send(
@@ -712,12 +715,12 @@ async fn event_timestamps_echo_and_validate() {
712 "POST",715 "POST",
713 "/events",716 "/events",
714 Some(&ali),717 Some(&ali),
715- Some(json!({ "title": "mtg", "starts_at": 1000, "ends_at": 2000 })),718+ Some(json!({ "title": "mtg", "starts_at": starts, "ends_at": ends })),
716 )719 )
717 .await;720 .await;
718 assert_eq!(res.status, StatusCode::CREATED);721 assert_eq!(res.status, StatusCode::CREATED);
719- assert_eq!(res.body["starts_at"], 1000);722+ assert_eq!(res.body["starts_at"], starts);
720- assert_eq!(res.body["ends_at"], 2000);723+ assert_eq!(res.body["ends_at"], ends);
721 let event_id = id_of(&res.body);724 let event_id = id_of(&res.body);
722 725
723 // Omitted times serialize as null.726 // Omitted times serialize as null.
@@ -738,23 +741,48 @@ async fn event_timestamps_echo_and_validate() {
738 "POST",741 "POST",
739 "/events",742 "/events",
740 Some(&ali),743 Some(&ali),
741- Some(json!({ "title": "bad", "starts_at": 5000, "ends_at": 1000 })),744+ Some(json!({ "title": "bad", "starts_at": now + 5_000_000, "ends_at": now + 1_000_000 })),
742 )745 )
743 .await;746 .await;
744 assert_eq!(bad.status, StatusCode::BAD_REQUEST);747 assert_eq!(bad.status, StatusCode::BAD_REQUEST);
745 748
749+ // Past times -> 400, whichever end carries them.
750+ for body in [
751+ json!({ "title": "old", "starts_at": now - 3_600_000 }),
752+ json!({ "title": "old", "ends_at": now - 3_600_000 }),
753+ ] {
754+ let res = send(&app, "POST", "/events", Some(&ali), Some(body)).await;
755+ assert_eq!(res.status, StatusCode::BAD_REQUEST, "{}", res.body);
756+ }
757+
746 // Updating only ends_at keeps starts_at.758 // Updating only ends_at keeps starts_at.
747 let updated = send(759 let updated = send(
748 &app,760 &app,
749 "PATCH",761 "PATCH",
750 &format!("/events/{event_id}"),762 &format!("/events/{event_id}"),
751 Some(&ali),763 Some(&ali),
752- Some(json!({ "ends_at": 3000 })),764+ Some(json!({ "ends_at": now + 10_800_000 })),
753 )765 )
754 .await;766 .await;
755 assert_eq!(updated.status, StatusCode::OK);767 assert_eq!(updated.status, StatusCode::OK);
756- assert_eq!(updated.body["starts_at"], 1000);768+ assert_eq!(updated.body["starts_at"], starts);
757- assert_eq!(updated.body["ends_at"], 3000);769+ assert_eq!(updated.body["ends_at"], now + 10_800_000);
770+
771+ // A PATCH may not move a time into the past either — whichever end.
772+ for body in [
773+ json!({ "starts_at": now - 3_600_000 }),
774+ json!({ "ends_at": now - 3_600_000 }),
775+ ] {
776+ let res = send(
777+ &app,
778+ "PATCH",
779+ &format!("/events/{event_id}"),
780+ Some(&ali),
781+ Some(body),
782+ )
783+ .await;
784+ assert_eq!(res.status, StatusCode::BAD_REQUEST, "{}", res.body);
785+ }
758 }786 }
759 787
760 // --- exams + results -----------------------------------------------------788 // --- exams + results -----------------------------------------------------
@@ -2913,13 +2941,16 @@ async fn session_cookie_secure_attribute_follows_config() {
2913 async fn patch_null_clears_event_times() {2941 async fn patch_null_clears_event_times() {
2914 let (app, db) = app_and_db().await;2942 let (app, db) = app_and_db().await;
2915 let ali = login_as(&app, &db, "ali", "teacher").await;2943 let ali = login_as(&app, &db, "ali", "teacher").await;
2944+ let now = Timestamp::now().as_millis();
2945+ let starts = now + 3_600_000;
2946+ let ends = now + 7_200_000;
2916 let event_id = id_of(2947 let event_id = id_of(
2917 &send(2948 &send(
2918 &app,2949 &app,
2919 "POST",2950 "POST",
2920 "/events",2951 "/events",
2921 Some(&ali),2952 Some(&ali),
2922- Some(json!({"title":"mtg","starts_at":1000,"ends_at":2000})),2953+ Some(json!({"title":"mtg","starts_at": starts,"ends_at": ends})),
2923 )2954 )
2924 .await2955 .await
2925 .body,2956 .body,
@@ -2934,8 +2965,8 @@ async fn patch_null_clears_event_times() {
2934 Some(json!({"title":"mtg2"})),2965 Some(json!({"title":"mtg2"})),
2935 )2966 )
2936 .await;2967 .await;
2937- assert_eq!(res.body["starts_at"], 1000);2968+ assert_eq!(res.body["starts_at"], starts);
2938- assert_eq!(res.body["ends_at"], 2000);2969+ assert_eq!(res.body["ends_at"], ends);
2939 2970
2940 // An explicit null clears just that field.2971 // An explicit null clears just that field.
2941 let res = send(2972 let res = send(
@@ -2947,7 +2978,7 @@ async fn patch_null_clears_event_times() {
2947 )2978 )
2948 .await;2979 .await;
2949 assert_eq!(res.status, StatusCode::OK);2980 assert_eq!(res.status, StatusCode::OK);
2950- assert_eq!(res.body["starts_at"], 1000);2981+ assert_eq!(res.body["starts_at"], starts);
2951 assert!(res.body["ends_at"].is_null());2982 assert!(res.body["ends_at"].is_null());
2952 2983
2953 // With ends_at cleared, moving starts_at past the old end is legal...2984 // With ends_at cleared, moving starts_at past the old end is legal...
@@ -2957,7 +2988,7 @@ async fn patch_null_clears_event_times() {
2957 "PATCH",2988 "PATCH",
2958 &format!("/events/{event_id}"),2989 &format!("/events/{event_id}"),
2959 Some(&ali),2990 Some(&ali),
2960- Some(json!({"starts_at": 5000}))2991+ Some(json!({"starts_at": now + 9_000_000}))
2961 )2992 )
2962 .await2993 .await
2963 .status,2994 .status,
@@ -2970,7 +3001,7 @@ async fn patch_null_clears_event_times() {
2970 "PATCH",3001 "PATCH",
2971 &format!("/events/{event_id}"),3002 &format!("/events/{event_id}"),
2972 Some(&ali),3003 Some(&ali),
2973- Some(json!({"ends_at": 1}))3004+ Some(json!({"ends_at": now + 1_000_000}))
2974 )3005 )
2975 .await3006 .await
2976 .status,3007 .status,
@@ -3203,12 +3234,104 @@ async fn exam_scheduling_validates_and_echoes() {
3203 json!({ "title": "x", "kind": "quiz", "weight": 1, "mode": "async",3234 json!({ "title": "x", "kind": "quiz", "weight": 1, "mode": "async",
3204 "starts_at": now, "ends_at": now + 90_000_000, "duration_ms": 86_400_001 }),3235 "starts_at": now, "ends_at": now + 90_000_000, "duration_ms": 86_400_001 }),
3205 ),3236 ),
3237+ (
3238+ "past starts_at",
3239+ json!({ "title": "x", "kind": "quiz", "weight": 1, "mode": "sync",
3240+ "starts_at": now - 3_600_000, "ends_at": now + 3_600_000 }),
3241+ ),
3242+ (
3243+ // starts_at is future so the rejection can only come from ends_at.
3244+ "past ends_at",
3245+ json!({ "title": "x", "kind": "quiz", "weight": 1, "mode": "sync",
3246+ "starts_at": now + 3_600_000, "ends_at": now - 3_600_000 }),
3247+ ),
3206 ] {3248 ] {
3207 let res = create_exam_with(&app, &teacher, &course, body).await;3249 let res = create_exam_with(&app, &teacher, &course, body).await;
3208 assert_eq!(res.status, StatusCode::BAD_REQUEST, "{label}: {}", res.body);3250 assert_eq!(res.status, StatusCode::BAD_REQUEST, "{label}: {}", res.body);
3209 }3251 }
3210 }3252 }
3211 3253
3254+/// Nothing can be scheduled to start (or end) in the past — on create and on
3255+/// any PATCH that sets a time. Values a PATCH merely keeps are exempt, so a
3256+/// running exam (its `starts_at` naturally behind the clock) stays editable.
3257+#[tokio::test]
3258+async fn schedule_times_cannot_be_backdated() {
3259+ let (app, db) = app_and_db().await;
3260+ let teacher = login_as(&app, &db, "past_t", "teacher").await;
3261+ let course = create_course(&app, &teacher, "history").await;
3262+ let now = Timestamp::now().as_millis();
3263+
3264+ // A running exam: started seconds ago (inside the clock-skew grace).
3265+ let exam = scheduled_exam(
3266+ &app,
3267+ &teacher,
3268+ &course,
3269+ json!({ "title": "running", "kind": "quiz", "weight": 1,
3270+ "mode": "sync", "starts_at": now - 1_000, "ends_at": now + 600_000 }),
3271+ )
3272+ .await;
3273+
3274+ // Setting either time to the past is rejected...
3275+ for body in [
3276+ json!({ "starts_at": now - 3_600_000 }),
3277+ json!({ "ends_at": now - 3_600_000 }),
3278+ ] {
3279+ let res = send(
3280+ &app,
3281+ "PATCH",
3282+ &format!("/exams/{exam}"),
3283+ Some(&teacher),
3284+ Some(body),
3285+ )
3286+ .await;
3287+ assert_eq!(res.status, StatusCode::BAD_REQUEST, "{}", res.body);
3288+ }
3289+
3290+ // ...while edits that only keep the stored (already past) start work:
3291+ // a rename, and a deadline extension.
3292+ let res = send(
3293+ &app,
3294+ "PATCH",
3295+ &format!("/exams/{exam}"),
3296+ Some(&teacher),
3297+ Some(json!({ "title": "renamed" })),
3298+ )
3299+ .await;
3300+ assert_eq!(res.status, StatusCode::OK, "{}", res.body);
3301+ let res = send(
3302+ &app,
3303+ "PATCH",
3304+ &format!("/exams/{exam}"),
3305+ Some(&teacher),
3306+ Some(json!({ "ends_at": now + 1_200_000 })),
3307+ )
3308+ .await;
3309+ assert_eq!(res.status, StatusCode::OK, "{}", res.body);
3310+ assert_eq!(res.body["ends_at"].as_i64(), Some(now + 1_200_000));
3311+
3312+ // The grace is real: times well inside it (30s < 60s) are accepted, on
3313+ // create and on PATCH alike.
3314+ let res = create_exam_with(
3315+ &app,
3316+ &teacher,
3317+ &course,
3318+ json!({ "title": "graced", "kind": "quiz", "weight": 1,
3319+ "mode": "sync", "starts_at": now - 30_000, "ends_at": now + 600_000 }),
3320+ )
3321+ .await;
3322+ assert_eq!(res.status, StatusCode::CREATED, "{}", res.body);
3323+ let graced = id_of(&res.body);
3324+ let res = send(
3325+ &app,
3326+ "PATCH",
3327+ &format!("/exams/{graced}"),
3328+ Some(&teacher),
3329+ Some(json!({ "starts_at": now - 20_000 })),
3330+ )
3331+ .await;
3332+ assert_eq!(res.status, StatusCode::OK, "{}", res.body);
3333+}
3334+
3212 #[tokio::test]3335 #[tokio::test]
3213 async fn sync_attempt_lifecycle_feeds_the_live_monitor() {3336 async fn sync_attempt_lifecycle_feeds_the_live_monitor() {
3214 let (app, db) = app_and_db().await;3337 let (app, db) = app_and_db().await;
@@ -3457,8 +3580,9 @@ async fn attempts_gate_on_schedule_enrollment_and_window() {
3457 &app,3580 &app,
3458 &teacher,3581 &teacher,
3459 &course,3582 &course,
3583+ // Inside the backdating grace, yet already closed by the clock.
3460 json!({ "title": "gone", "kind": "quiz", "weight": 1,3584 json!({ "title": "gone", "kind": "quiz", "weight": 1,
3461- "mode": "sync", "starts_at": now - 120_000, "ends_at": now - 60_000 }),3585+ "mode": "sync", "starts_at": now - 50_000, "ends_at": now - 10_000 }),
3462 )3586 )
3463 .await;3587 .await;
3464 let res = send(3588 let res = send(
@@ -5109,9 +5233,11 @@ async fn session_crud_follows_course_management() {
5109 let boss = login_as(&app, &db, "boss", "manager").await;5233 let boss = login_as(&app, &db, "boss", "manager").await;
5110 let student = login(&app, "ali").await;5234 let student = login(&app, "ali").await;
5111 let course = create_course(&app, &owner, "algebra").await;5235 let course = create_course(&app, &owner, "algebra").await;
5236+ let now = Timestamp::now().as_millis();
5237+ let start = now + 3_600_000;
5112 5238
5113 // Create: student 403, unrelated teacher 403, owner 201, manager+ 201.5239 // Create: student 403, unrelated teacher 403, owner 201, manager+ 201.
5114- let body = json!({ "topic": "limits", "starts_at": 1_700_000_000_000_i64 });5240+ let body = json!({ "topic": "limits", "starts_at": start });
5115 let res = send(5241 let res = send(
5116 &app,5242 &app,
5117 "POST",5243 "POST",
@@ -5143,7 +5269,7 @@ async fn session_crud_follows_course_management() {
5143 // The teacher defaults to the caller, rendered as a PersonRef.5269 // The teacher defaults to the caller, rendered as a PersonRef.
5144 assert_eq!(res.body["teacher"]["username"], "owner");5270 assert_eq!(res.body["teacher"]["username"], "owner");
5145 assert_eq!(res.body["topic"], "limits");5271 assert_eq!(res.body["topic"], "limits");
5146- assert_eq!(res.body["starts_at"], 1_700_000_000_000_i64);5272+ assert_eq!(res.body["starts_at"], start);
5147 assert!(res.body["ends_at"].is_null());5273 assert!(res.body["ends_at"].is_null());
5148 let res = send(5274 let res = send(
5149 &app,5275 &app,
@@ -5165,7 +5291,7 @@ async fn session_crud_follows_course_management() {
5165 "POST",5291 "POST",
5166 &format!("/courses/{course}/sessions"),5292 &format!("/courses/{course}/sessions"),
5167 Some(&owner),5293 Some(&owner),
5168- Some(json!({ "starts_at": 1, "teacher_id": "01UNKNOWN" })),5294+ Some(json!({ "starts_at": now + 60_000, "teacher_id": "01UNKNOWN" })),
5169 )5295 )
5170 .await;5296 .await;
5171 assert_eq!(res.status, StatusCode::BAD_REQUEST, "unknown teacher");5297 assert_eq!(res.status, StatusCode::BAD_REQUEST, "unknown teacher");
@@ -5175,7 +5301,7 @@ async fn session_crud_follows_course_management() {
5175 "POST",5301 "POST",
5176 &format!("/courses/{course}/sessions"),5302 &format!("/courses/{course}/sessions"),
5177 Some(&owner),5303 Some(&owner),
5178- Some(json!({ "starts_at": 1, "teacher_id": ali_id })),5304+ Some(json!({ "starts_at": now + 60_000, "teacher_id": ali_id })),
5179 )5305 )
5180 .await;5306 .await;
5181 assert_eq!(5307 assert_eq!(
@@ -5189,7 +5315,7 @@ async fn session_crud_follows_course_management() {
5189 "POST",5315 "POST",
5190 &format!("/courses/{course}/sessions"),5316 &format!("/courses/{course}/sessions"),
5191 Some(&owner),5317 Some(&owner),
5192- Some(json!({ "starts_at": 2, "teacher_id": rival_id })),5318+ Some(json!({ "starts_at": now + 120_000, "teacher_id": rival_id })),
5193 )5319 )
5194 .await;5320 .await;
5195 assert_eq!(res.status, StatusCode::CREATED);5321 assert_eq!(res.status, StatusCode::CREATED);
@@ -5202,11 +5328,32 @@ async fn session_crud_follows_course_management() {
5202 "POST",5328 "POST",
5203 &format!("/courses/{course}/sessions"),5329 &format!("/courses/{course}/sessions"),
5204 Some(&owner),5330 Some(&owner),
5205- Some(json!({ "starts_at": 10, "ends_at": 5 })),5331+ Some(json!({ "starts_at": now + 10_000, "ends_at": now + 5_000 })),
5206 )5332 )
5207 .await;5333 .await;
5208 assert_eq!(res.status, StatusCode::BAD_REQUEST);5334 assert_eq!(res.status, StatusCode::BAD_REQUEST);
5209 5335
5336+ // Past lessons cannot be scheduled — on create or by a later PATCH,
5337+ // whichever end carries the past value.
5338+ let res = send(
5339+ &app,
5340+ "POST",
5341+ &format!("/courses/{course}/sessions"),
5342+ Some(&owner),
5343+ Some(json!({ "starts_at": now - 3_600_000 })),
5344+ )
5345+ .await;
5346+ assert_eq!(res.status, StatusCode::BAD_REQUEST, "{}", res.body);
5347+ let res = send(
5348+ &app,
5349+ "POST",
5350+ &format!("/courses/{course}/sessions"),
5351+ Some(&owner),
5352+ Some(json!({ "starts_at": now + 3_600_000, "ends_at": now - 3_600_000 })),
5353+ )
5354+ .await;
5355+ assert_eq!(res.status, StatusCode::BAD_REQUEST, "past ends_at");
5356+
5210 // Reads are open to any logged-in user; parents must exist.5357 // Reads are open to any logged-in user; parents must exist.
5211 let res = send(5358 let res = send(
5212 &app,5359 &app,
@@ -5218,9 +5365,9 @@ async fn session_crud_follows_course_management() {
5218 .await;5365 .await;
5219 assert_eq!(res.status, StatusCode::OK);5366 assert_eq!(res.status, StatusCode::OK);
5220 // owner's, the manager's, and the one taught by `rival` — newest starts_at5367 // owner's, the manager's, and the one taught by `rival` — newest starts_at
5221- // first, so the two 1.7e12 lessons precede the starts_at=2 one.5368+ // first, so the two `start` lessons precede the earlier `rival` one.
5222 assert_eq!(res.body.as_array().unwrap().len(), 3);5369 assert_eq!(res.body.as_array().unwrap().len(), 3);
5223- assert_eq!(res.body[2]["starts_at"], 2);5370+ assert_eq!(res.body[2]["starts_at"], now + 120_000);
5224 let res = send(&app, "GET", "/courses/nope/sessions", Some(&student), None).await;5371 let res = send(&app, "GET", "/courses/nope/sessions", Some(&student), None).await;
5225 assert_eq!(res.status, StatusCode::NOT_FOUND);5372 assert_eq!(res.status, StatusCode::NOT_FOUND);
5226 let res = send(5373 let res = send(
@@ -5250,16 +5397,13 @@ async fn session_crud_follows_course_management() {
5250 "PATCH",5397 "PATCH",
5251 &format!("/sessions/{session}"),5398 &format!("/sessions/{session}"),
5252 Some(&owner),5399 Some(&owner),
5253- Some(json!({ "topic": "derivatives", "ends_at": 1_700_000_100_000_i64 })),5400+ Some(json!({ "topic": "derivatives", "ends_at": start + 100_000 })),
5254 )5401 )
5255 .await;5402 .await;
5256 assert_eq!(res.status, StatusCode::OK);5403 assert_eq!(res.status, StatusCode::OK);
5257 assert_eq!(res.body["topic"], "derivatives");5404 assert_eq!(res.body["topic"], "derivatives");
5258- assert_eq!(res.body["ends_at"], 1_700_000_100_000_i64);5405+ assert_eq!(res.body["ends_at"], start + 100_000);
5259- assert_eq!(5406+ assert_eq!(res.body["starts_at"], start, "omitted keeps");
5260- res.body["starts_at"], 1_700_000_000_000_i64,
5261- "omitted keeps"
5262- );
5263 let res = send(5407 let res = send(
5264 &app,5408 &app,
5265 "PATCH",5409 "PATCH",
@@ -5275,10 +5419,49 @@ async fn session_crud_follows_course_management() {
5275 "PATCH",5419 "PATCH",
5276 &format!("/sessions/{session}"),5420 &format!("/sessions/{session}"),
5277 Some(&owner),5421 Some(&owner),
5278- Some(json!({ "ends_at": 999 })),5422+ Some(json!({ "ends_at": now + 1_800_000 })),
5279 )5423 )
5280 .await;5424 .await;
5281 assert_eq!(res.status, StatusCode::BAD_REQUEST, "ends before starts");5425 assert_eq!(res.status, StatusCode::BAD_REQUEST, "ends before starts");
5426+ let res = send(
5427+ &app,
5428+ "PATCH",
5429+ &format!("/sessions/{session}"),
5430+ Some(&owner),
5431+ Some(json!({ "starts_at": now - 3_600_000 })),
5432+ )
5433+ .await;
5434+ assert_eq!(res.status, StatusCode::BAD_REQUEST, "backdated start");
5435+ let res = send(
5436+ &app,
5437+ "PATCH",
5438+ &format!("/sessions/{session}"),
5439+ Some(&owner),
5440+ Some(json!({ "ends_at": now - 3_600_000 })),
5441+ )
5442+ .await;
5443+ assert_eq!(res.status, StatusCode::BAD_REQUEST, "backdated end");
5444+ // A lesson already underway (start inside the grace) stays editable as
5445+ // long as the past time is only kept, not re-sent.
5446+ let res = send(
5447+ &app,
5448+ "POST",
5449+ &format!("/courses/{course}/sessions"),
5450+ Some(&owner),
5451+ Some(json!({ "topic": "underway", "starts_at": now - 1_000 })),
5452+ )
5453+ .await;
5454+ assert_eq!(res.status, StatusCode::CREATED, "{}", res.body);
5455+ let underway = id_of(&res.body);
5456+ let res = send(
5457+ &app,
5458+ "PATCH",
5459+ &format!("/sessions/{underway}"),
5460+ Some(&owner),
5461+ Some(json!({ "topic": "still editable" })),
5462+ )
5463+ .await;
5464+ assert_eq!(res.status, StatusCode::OK, "{}", res.body);
5282 // Reassigning the teacher revalidates the target.5465 // Reassigning the teacher revalidates the target.
5283 let res = send(5466 let res = send(
5284 &app,5467 &app,
@@ -5340,7 +5523,9 @@ async fn roll_call_rbac_and_upsert() {
5340 "POST",5523 "POST",
5341 &format!("/courses/{course}/sessions"),5524 &format!("/courses/{course}/sessions"),
5342 Some(&owner),5525 Some(&owner),
5343- Some(json!({ "starts_at": 1, "teacher_id": hoca_id })),5526+ Some(
5527+ json!({ "starts_at": Timestamp::now().as_millis() + 3_600_000, "teacher_id": hoca_id }),
5528+ ),
5344 )5529 )
5345 .await;5530 .await;
5346 assert_eq!(res.status, StatusCode::CREATED);5531 assert_eq!(res.status, StatusCode::CREATED);
@@ -5534,8 +5719,9 @@ async fn deleting_session_or_course_cascades_roll_call() {
5534 5719
5535 let course = create_course(&app, &owner, "algebra").await;5720 let course = create_course(&app, &owner, "algebra").await;
5536 enroll(&app, &owner, &course, &ali_id).await;5721 enroll(&app, &owner, &course, &ali_id).await;
5537- let s1 = create_session(&app, &owner, &course, 1).await;5722+ let now = Timestamp::now().as_millis();
5538- let s2 = create_session(&app, &owner, &course, 2).await;5723+ let s1 = create_session(&app, &owner, &course, now + 3_600_000).await;
5724+ let s2 = create_session(&app, &owner, &course, now + 7_200_000).await;
5539 for s in [&s1, &s2] {5725 for s in [&s1, &s2] {
5540 let res = send(5726 let res = send(
5541 &app,5727 &app,
@@ -5801,7 +5987,13 @@ async fn attendance_report_tallies_events_and_sessions_per_course() {
5801 ] {5987 ] {
5802 enroll(&app, &owner, course, &ali_id).await;5988 enroll(&app, &owner, course, &ali_id).await;
5803 for (n, status) in statuses.iter().enumerate() {5989 for (n, status) in statuses.iter().enumerate() {
5804- let session = create_session(&app, &owner, course, n as i64 + 1).await;5990+ let session = create_session(
5991+ &app,
5992+ &owner,
5993+ course,
5994+ Timestamp::now().as_millis() + (n as i64 + 1) * 3_600_000,
5995+ )
5996+ .await;
5805 let res = send(5997 let res = send(
5806 &app,5998 &app,
5807 "POST",5999 "POST",