diff options
-rw-r--r-- | src/handlers.rs | 1 | ||||
-rw-r--r-- | tests/route_tests.rs | 19 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/handlers.rs b/src/handlers.rs index b7b1007..e76e72f 100644 --- a/src/handlers.rs +++ b/src/handlers.rs | |||
@@ -139,6 +139,7 @@ pub async fn authenticate_user( | |||
139 | } | 139 | } |
140 | }; | 140 | }; |
141 | 141 | ||
142 | // TODO: request iv is coming with base64 encoding <16-04-21, yigit> // | ||
142 | let cipher = match Aes128Cbc::new_var(&temp_key, &request.iv.as_bytes()) { | 143 | let cipher = match Aes128Cbc::new_var(&temp_key, &request.iv.as_bytes()) { |
143 | Ok(c) => c, | 144 | Ok(c) => c, |
144 | Err(err) => { | 145 | Err(err) => { |
diff --git a/tests/route_tests.rs b/tests/route_tests.rs index ce7d704..bae58ee 100644 --- a/tests/route_tests.rs +++ b/tests/route_tests.rs | |||
@@ -1,6 +1,8 @@ | |||
1 | #[cfg(test)] | 1 | #[cfg(test)] |
2 | mod tests { | 2 | mod tests { |
3 | use gradecoin::schema::{create_database, AuthRequest, Block, Db, MetuId, Transaction, User}; | 3 | use gradecoin::schema::{ |
4 | create_database, AuthRequest, Block, Db, InitialAuthRequest, MetuId, Transaction, User, | ||
5 | }; | ||
4 | 6 | ||
5 | use gradecoin::routes::consensus_routes; | 7 | use gradecoin::routes::consensus_routes; |
6 | use warp::http::StatusCode; | 8 | use warp::http::StatusCode; |
@@ -440,6 +442,21 @@ FQIDAQAB | |||
440 | #[tokio::test] | 442 | #[tokio::test] |
441 | async fn user_authentication() { | 443 | async fn user_authentication() { |
442 | let db = mocked_db(); | 444 | let db = mocked_db(); |
445 | let filter = consensus_routes(db); | ||
446 | |||
447 | let res = warp::test::request() | ||
448 | .method("POST") | ||
449 | .json(&InitialAuthRequest { | ||
450 | c: "llqkPAX8oGxBLFHGMNzwrCAP2WmsGZlOcm3mCp7+ZnX9p7BPffRvGcYHpif4htwU5RyR3fLo/VWERXqddVQkxhfuum0dFn1cpPfYTokc2BHpi61i4SXCaCHlJDxCtCKnujfEzMnS5hAKMQSyrwq/DPBwOSQ/XQeeMB0YF+l+ZfVJ8e6sQ5FfSK9rSInv+TokA7az6vR7Ky5fGjQ0GxKkO+SKLd5eHuGKgQ19JUQrj3k19GJn1h1cmWW1PYqVKFDp/RfWFL9weG8VynRND6xGK5fQarjdG0uMAk8Cy8ItOCAeMnBhUv/P2a721u3tA7L496r4E3ZwdgsiHe4iYzFiAdvWDWsLRlxXS+6Q2vUYSLgcFVsv2jyQ28c/ay3F1hYAHaqN4HiDhKz6bFCiyow1Doya2V24VQm5eUGxXErjEnLY1FWE5sqRn6DUnES3FT8VJoMtnhCFtZhO4Jk0cjh15p9r+vK6uJv0PUCKOOYhghFi5bLL34OpmzoV7u7Fj6tSc/e9UujbCfYc3r9g0oUQ+QKxw6R5Fcqf21TbffxX/i1tKElIhkatfWCaZ+c0scLNL4Jg3KbNqbensOFqzErr12pXHFy7QKXH1usnCJyC+9D7NncxKZ9JuVFJL19Ayq90o/IYWhtVlkhZs/F5UPIhl3G7f8OQ1tUgfdCfiXZ5qgg=".to_owned(), | ||
451 | iv: "RbZzPxu1IL+f+PZ/SJzi/Q==".to_owned(), | ||
452 | key: "baz".to_owned(), | ||
453 | }) | ||
454 | .path("/register") | ||
455 | .reply(&filter) | ||
456 | .await; | ||
457 | |||
458 | println!("{:?}", res); | ||
459 | assert_eq!(res.status(), StatusCode::CREATED); | ||
443 | } | 460 | } |
444 | } | 461 | } |
445 | 462 | ||