From 1f0b9c94dba661cdc1692c3450dcd41600fc844a Mon Sep 17 00:00:00 2001 From: EETagent Date: Fri, 28 Oct 2022 18:21:11 +0200 Subject: [PATCH] fix: update candidate tests to new async implementations --- core/src/services/candidate_service.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/services/candidate_service.rs b/core/src/services/candidate_service.rs index 8adb2e4..cd72b45 100644 --- a/core/src/services/candidate_service.rs +++ b/core/src/services/candidate_service.rs @@ -65,17 +65,19 @@ mod tests { #[tokio::test] async fn test_create_candidate() { + const SECRET: &str = "Tajny_kod"; + let db = get_memory_sqlite_connection().await; let form = serde_json::from_value(json!({ "application": 5555555, })).unwrap(); - let candidate = Mutation::create_candidate(&db, form, &"Tajny_kod".to_string()).await.unwrap(); + let candidate = Mutation::create_candidate(&db, form, &SECRET.to_string()).await.unwrap(); assert_eq!(candidate.application, 5555555); - assert_ne!(candidate.code, "Tajny_kod".to_string()); - assert!(crypto::verify_password("Tajny_kod", &*candidate.code).ok().unwrap()); + assert_ne!(candidate.code, SECRET.to_string()); + assert!(crypto::verify_password(SECRET.to_string(), candidate.code).await.ok().unwrap()); }