aboutsummaryrefslogtreecommitdiffstats
path: root/tests/route_tests.rs
diff options
context:
space:
mode:
authorYigit Sever2021-04-16 03:55:27 +0300
committerYigit Sever2021-04-16 03:55:27 +0300
commit90525af1b50219801a019842bc635ea08f9f93d9 (patch)
tree66b741f6e759fc6dbe044fe938d9e3b2c3a28221 /tests/route_tests.rs
parente923a69e503c81a38736f9eb3ea65e4c8551dee5 (diff)
downloadgradecoin-90525af1b50219801a019842bc635ea08f9f93d9.tar.gz
gradecoin-90525af1b50219801a019842bc635ea08f9f93d9.tar.bz2
gradecoin-90525af1b50219801a019842bc635ea08f9f93d9.zip
Writing auth test
Diffstat (limited to 'tests/route_tests.rs')
-rw-r--r--tests/route_tests.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/route_tests.rs b/tests/route_tests.rs
index 59483d3..a1531bb 100644
--- a/tests/route_tests.rs
+++ b/tests/route_tests.rs
@@ -1,6 +1,8 @@
1#[cfg(test)] 1#[cfg(test)]
2mod tests { 2mod 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;
@@ -406,6 +408,21 @@ FQIDAQAB
406 #[tokio::test] 408 #[tokio::test]
407 async fn user_authentication() { 409 async fn user_authentication() {
408 let db = mocked_db(); 410 let db = mocked_db();
411 let filter = consensus_routes(db);
412
413 let res = warp::test::request()
414 .method("POST")
415 .json(&InitialAuthRequest {
416 c: "llqkPAX8oGxBLFHGMNzwrCAP2WmsGZlOcm3mCp7+ZnX9p7BPffRvGcYHpif4htwU5RyR3fLo/VWERXqddVQkxhfuum0dFn1cpPfYTokc2BHpi61i4SXCaCHlJDxCtCKnujfEzMnS5hAKMQSyrwq/DPBwOSQ/XQeeMB0YF+l+ZfVJ8e6sQ5FfSK9rSInv+TokA7az6vR7Ky5fGjQ0GxKkO+SKLd5eHuGKgQ19JUQrj3k19GJn1h1cmWW1PYqVKFDp/RfWFL9weG8VynRND6xGK5fQarjdG0uMAk8Cy8ItOCAeMnBhUv/P2a721u3tA7L496r4E3ZwdgsiHe4iYzFiAdvWDWsLRlxXS+6Q2vUYSLgcFVsv2jyQ28c/ay3F1hYAHaqN4HiDhKz6bFCiyow1Doya2V24VQm5eUGxXErjEnLY1FWE5sqRn6DUnES3FT8VJoMtnhCFtZhO4Jk0cjh15p9r+vK6uJv0PUCKOOYhghFi5bLL34OpmzoV7u7Fj6tSc/e9UujbCfYc3r9g0oUQ+QKxw6R5Fcqf21TbffxX/i1tKElIhkatfWCaZ+c0scLNL4Jg3KbNqbensOFqzErr12pXHFy7QKXH1usnCJyC+9D7NncxKZ9JuVFJL19Ayq90o/IYWhtVlkhZs/F5UPIhl3G7f8OQ1tUgfdCfiXZ5qgg=".to_owned(),
417 iv: "RbZzPxu1IL+f+PZ/SJzi/Q==".to_owned(),
418 key: "baz".to_owned(),
419 })
420 .path("/register")
421 .reply(&filter)
422 .await;
423
424 println!("{:?}", res);
425 assert_eq!(res.status(), StatusCode::CREATED);
409 } 426 }
410} 427}
411 428