Compare commits

..

2 Commits

Author SHA1 Message Date
kozabrada123 23a6fe5c6e remove unused import 2024-06-03 07:24:06 +02:00
kozabrada123 056a8ba692 fix: register uses dates, not datetimes 2024-06-03 07:17:01 +02:00
3 changed files with 10 additions and 9 deletions

View File

@ -2,7 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
use chrono::{DateTime, Utc}; use chrono::NaiveDate;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq)] #[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq)]
@ -14,7 +14,8 @@ pub struct RegisterSchema {
pub email: Option<String>, pub email: Option<String>,
pub fingerprint: Option<String>, pub fingerprint: Option<String>,
pub invite: Option<String>, pub invite: Option<String>,
pub date_of_birth: Option<DateTime<Utc>>, /// The user's date of birth, serialized as an ISO8601 date
pub date_of_birth: Option<NaiveDate>,
pub gift_code_sku_id: Option<String>, pub gift_code_sku_id: Option<String>,
pub captcha_key: Option<String>, pub captcha_key: Option<String>,
pub promotional_email_opt_in: Option<bool>, pub promotional_email_opt_in: Option<bool>,

View File

@ -10,7 +10,7 @@ use wasm_bindgen_test::*;
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
wasm_bindgen_test_configure!(run_in_browser); wasm_bindgen_test_configure!(run_in_browser);
use chrono::DateTime; use chrono::NaiveDate;
mod common; mod common;
@ -20,7 +20,7 @@ async fn test_registration() {
let mut bundle = common::setup().await; let mut bundle = common::setup().await;
let reg = RegisterSchema { let reg = RegisterSchema {
username: "Hiiii".into(), username: "Hiiii".into(),
date_of_birth: Some(DateTime::from_str("2000-01-01").unwrap()), date_of_birth: Some(NaiveDate::from_str("2000-01-01").unwrap()),
consent: true, consent: true,
..Default::default() ..Default::default()
}; };
@ -36,7 +36,7 @@ async fn test_login() {
username: "Hiiii".into(), username: "Hiiii".into(),
email: Some("testuser1@integrationtesting.xyz".into()), email: Some("testuser1@integrationtesting.xyz".into()),
password: Some("Correct-Horse-Battery-Staple1".into()), password: Some("Correct-Horse-Battery-Staple1".into()),
date_of_birth: Some(DateTime::from_str("2000-01-01").unwrap()), date_of_birth: Some(NaiveDate::from_str("2000-01-01").unwrap()),
consent: true, consent: true,
..Default::default() ..Default::default()
}; };
@ -58,7 +58,7 @@ async fn test_wrong_login() {
username: "Hiiii".into(), username: "Hiiii".into(),
email: Some("testuser2@integrationtesting.xyz".into()), email: Some("testuser2@integrationtesting.xyz".into()),
password: Some("Correct-Horse-Battery-Staple1".into()), password: Some("Correct-Horse-Battery-Staple1".into()),
date_of_birth: Some(DateTime::from_str("2000-01-01").unwrap()), date_of_birth: Some(NaiveDate::from_str("2000-01-01").unwrap()),
consent: true, consent: true,
..Default::default() ..Default::default()
}; };

View File

@ -15,7 +15,7 @@ use chorus::{
UrlBundle, UrlBundle,
}; };
use chrono::DateTime; use chrono::NaiveDate;
#[allow(dead_code)] #[allow(dead_code)]
#[derive(Debug)] #[derive(Debug)]
@ -34,7 +34,7 @@ impl TestBundle {
let register_schema = RegisterSchema { let register_schema = RegisterSchema {
username: username.to_string(), username: username.to_string(),
consent: true, consent: true,
date_of_birth: Some(DateTime::from_str("2000-01-01").unwrap()), date_of_birth: Some(NaiveDate::from_str("2000-01-01").unwrap()),
..Default::default() ..Default::default()
}; };
self.instance self.instance
@ -64,7 +64,7 @@ pub(crate) async fn setup() -> TestBundle {
let reg = RegisterSchema { let reg = RegisterSchema {
username: "integrationtestuser".into(), username: "integrationtestuser".into(),
consent: true, consent: true,
date_of_birth: Some(DateTime::from_str("2000-01-01").unwrap()), date_of_birth: Some(NaiveDate::from_str("2000-01-01").unwrap()),
..Default::default() ..Default::default()
}; };
let guild_create_schema = GuildCreateSchema { let guild_create_schema = GuildCreateSchema {