diff --git a/core/src/mutation.rs b/core/src/mutation.rs index c759322..c71bf1d 100644 --- a/core/src/mutation.rs +++ b/core/src/mutation.rs @@ -73,7 +73,6 @@ impl Mutation { #[cfg(test)] mod tests { use sea_orm::{Database, DbConn}; - use serde_json::json; use crate::{Mutation, crypto}; @@ -97,15 +96,12 @@ mod tests { async fn test_encrypt_decrypt_private_key_with_passphrase() { let db = get_memory_sqlite_connection().await; - let form = serde_json::from_value(json!({ - "application_id": 5555555, - })).unwrap(); let plain_text_password = "test".to_string(); let secret_message = "trnka".to_string(); - let candidate = Mutation::create_candidate(&db, form, &plain_text_password, "".to_string()).await.unwrap(); + let candidate = Mutation::create_candidate(&db, 5555555, &plain_text_password, "".to_string()).await.unwrap(); let encrypted_message = crypto::encrypt_password_with_recipients(&secret_message, vec![&candidate.public_key]).await.unwrap(); diff --git a/core/src/query.rs b/core/src/query.rs index 35f0883..0c0c440 100644 --- a/core/src/query.rs +++ b/core/src/query.rs @@ -50,6 +50,7 @@ mod tests { code: Set("test".to_string()), public_key: Set("test".to_string()), private_key: Set("test".to_string()), + personal_identification_number: Set("test".to_string()), created_at: Set(chrono::offset::Local::now().naive_local()), updated_at: Set(chrono::offset::Local::now().naive_local()), ..Default::default() diff --git a/core/src/services/candidate_service.rs b/core/src/services/candidate_service.rs index 79140f5..91bdd83 100644 --- a/core/src/services/candidate_service.rs +++ b/core/src/services/candidate_service.rs @@ -92,7 +92,6 @@ impl CandidateService { mod tests { use entity::candidate; use sea_orm::{DbConn, Database, sea_query::TableCreateStatement, DbBackend, Schema, ConnectionTrait, prelude::Uuid}; - use serde_json::json; use crate::{crypto, Mutation, services::candidate_service::CandidateService}; @@ -117,11 +116,7 @@ mod tests { let db = get_memory_sqlite_connection().await; - let form = serde_json::from_value(json!({ - "application_id": 5555555, - })).unwrap(); - - let candidate = Mutation::create_candidate(&db, form, &SECRET.to_string(), "".to_string()).await.unwrap(); + let candidate = Mutation::create_candidate(&db, 5555555, &SECRET.to_string(), "".to_string()).await.unwrap(); assert_eq!(candidate.application, 5555555); assert_ne!(candidate.code, SECRET.to_string()); @@ -132,11 +127,7 @@ mod tests { async fn test_candidate_session_correct_password() { let db = &get_memory_sqlite_connection().await; - let form = serde_json::from_value(json!({ - "application_id": 5555555, - })).unwrap(); - - Mutation::create_candidate(&db, form, &"Tajny_kod".to_string(), "".to_string()).await.unwrap(); + Mutation::create_candidate(&db, 5555555, &"Tajny_kod".to_string(), "".to_string()).await.unwrap(); // correct password let session = CandidateService::new_session( @@ -159,11 +150,7 @@ mod tests { async fn test_candidate_session_incorrect_password() { let db = &get_memory_sqlite_connection().await; - let form = serde_json::from_value(json!({ - "application_id": 5555555, - })).unwrap(); - - let candidate_form = Mutation::create_candidate(&db, form, &"Tajny_kod".to_string(), "".to_string()).await.unwrap(); + let candidate_form = Mutation::create_candidate(&db, 5555555, &"Tajny_kod".to_string(), "".to_string()).await.unwrap(); // incorrect password assert!(