Seed a parent user row so sessions satisfy the `user_id` foreign key.
(db: &DatabaseConnection, id: &str)
| 76 | |
| 77 | /// Seed a parent user row so sessions satisfy the `user_id` foreign key. |
| 78 | async fn insert_test_user(db: &DatabaseConnection, id: &str) { |
| 79 | let now = Utc.with_ymd_and_hms(2026, 1, 1, 0, 0, 0).unwrap(); |
| 80 | user::ActiveModel { |
| 81 | id: Set(id.to_string()), |
| 82 | username: Set(format!("user-{id}")), |
| 83 | password_hash: Set("hash".to_string()), |
| 84 | role: Set("admin".to_string()), |
| 85 | totp_secret: Set(None), |
| 86 | must_change_password: Set(false), |
| 87 | password_changed_at: Set(None), |
| 88 | created_at: Set(now), |
| 89 | updated_at: Set(now), |
| 90 | } |
| 91 | .insert(db) |
| 92 | .await |
| 93 | .expect("insert test user should succeed"); |
| 94 | } |
| 95 | |
| 96 | async fn insert_test_session( |
| 97 | db: &DatabaseConnection, |
no outgoing calls
no test coverage detected