mirror of
https://github.com/lldap/lldap.git
synced 2026-07-25 17:58:44 +00:00
Migrate datetimes to UTC
This commit is contained in:
committed by
nitnelave
parent
848cc86d73
commit
0ecd9ed263
@@ -120,7 +120,7 @@ pub async fn init_table(pool: &Pool) -> sqlx::Result<()> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use chrono::NaiveDateTime;
|
||||
use chrono::prelude::*;
|
||||
use sqlx::{Column, Row};
|
||||
|
||||
#[actix_rt::test]
|
||||
@@ -138,8 +138,8 @@ mod tests {
|
||||
assert_eq!(row.column(0).name(), "display_name");
|
||||
assert_eq!(row.get::<String, _>("display_name"), "Bob Bobbersön");
|
||||
assert_eq!(
|
||||
row.get::<NaiveDateTime, _>("creation_date"),
|
||||
NaiveDateTime::from_timestamp(0, 0)
|
||||
row.get::<DateTime<Utc>, _>("creation_date"),
|
||||
Utc.timestamp(0, 0),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ impl<Handler: BackendHandler + Sync> User<Handler> {
|
||||
self.user.last_name.as_ref()
|
||||
}
|
||||
|
||||
fn creation_date(&self) -> chrono::NaiveDateTime {
|
||||
fn creation_date(&self) -> chrono::DateTime<chrono::Utc> {
|
||||
self.user.creation_date
|
||||
}
|
||||
|
||||
|
||||
@@ -277,7 +277,6 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::domain::handler::BindRequest;
|
||||
use crate::domain::handler::MockTestBackendHandler;
|
||||
use chrono::NaiveDateTime;
|
||||
use mockall::predicate::eq;
|
||||
use tokio;
|
||||
|
||||
@@ -487,7 +486,7 @@ mod tests {
|
||||
display_name: Some("Bôb Böbberson".to_string()),
|
||||
first_name: Some("Bôb".to_string()),
|
||||
last_name: Some("Böbberson".to_string()),
|
||||
creation_date: NaiveDateTime::from_timestamp(1_000_000, 0),
|
||||
..Default::default()
|
||||
},
|
||||
User {
|
||||
user_id: "jim".to_string(),
|
||||
@@ -495,7 +494,7 @@ mod tests {
|
||||
display_name: Some("Jimminy Cricket".to_string()),
|
||||
first_name: Some("Jim".to_string()),
|
||||
last_name: Some("Cricket".to_string()),
|
||||
creation_date: NaiveDateTime::from_timestamp(1_500_000, 0),
|
||||
..Default::default()
|
||||
},
|
||||
])
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user