refactor: from_ymd_opt

This commit is contained in:
Sebastian Pravda 2022-12-25 22:25:33 +01:00
parent 28940e46af
commit 7e42d984f4
No known key found for this signature in database
GPG key ID: F3BC84F08EFA3F57
3 changed files with 6 additions and 6 deletions

View file

@ -1,6 +1,6 @@
use sea_orm::*;
use ::entity::{candidate, candidate::Entity as Candidate, parent};
use ::entity::{candidate, candidate::Entity as Candidate};
use crate::Query;

View file

@ -335,12 +335,12 @@ pub async fn decrypt_if_exists(
pub mod tests {
use std::sync::Mutex;
use chrono::{Local};
use chrono::Local;
use entity::admin;
use once_cell::sync::Lazy;
use sea_orm::{DbConn, Set, ActiveModelTrait};
use crate::{crypto, models::candidate::{CandidateDetails, ParentDetails}, utils::db::get_memory_sqlite_connection, Query, services::candidate_service::tests::put_user_data};
use crate::{crypto, models::candidate::{CandidateDetails, ParentDetails}, utils::db::get_memory_sqlite_connection, services::candidate_service::tests::put_user_data};
use super::{ApplicationDetails, EncryptedApplicationDetails, EncryptedString};
@ -353,7 +353,7 @@ pub mod tests {
name: "name".to_string(),
surname: "surname".to_string(),
birthplace: "birthplace".to_string(),
birthdate: chrono::NaiveDate::from_ymd(2000, 1, 1),
birthdate: chrono::NaiveDate::from_ymd_opt(2000, 1, 1).unwrap(),
address: "address".to_string(),
telephone: "telephone".to_string(),
citizenship: "citizenship".to_string(),
@ -375,7 +375,7 @@ pub mod tests {
assert_eq!(details.candidate.name, "name");
assert_eq!(details.candidate.surname, "surname");
assert_eq!(details.candidate.birthplace, "birthplace");
assert_eq!(details.candidate.birthdate, chrono::NaiveDate::from_ymd(2000, 1, 1));
assert_eq!(details.candidate.birthdate, chrono::NaiveDate::from_ymd_opt(2000, 1, 1).unwrap());
assert_eq!(details.candidate.address, "address");
assert_eq!(details.candidate.telephone, "telephone");
assert_eq!(details.candidate.citizenship, "citizenship");

View file

@ -58,7 +58,7 @@ mod tests {
name: "name".to_string(),
surname: "surname".to_string(),
birthplace: "birthplace".to_string(),
birthdate: chrono::NaiveDate::from_ymd(2000, 1, 1),
birthdate: chrono::NaiveDate::from_ymd_opt(2000, 1, 1).unwrap(),
address: "address".to_string(),
telephone: "telephone".to_string(),
citizenship: "citizenship".to_string(),