aboutsummaryrefslogtreecommitdiffstats
path: root/tests/route_tests.rs
diff options
context:
space:
mode:
authorYigit Sever2021-04-16 02:11:29 +0300
committerYigit Sever2021-04-16 02:11:29 +0300
commit3526fddd8012e28612513bc3711fe3a2fc7a371f (patch)
tree5a689c990300569aa85c32f4b1737ca478a65481 /tests/route_tests.rs
parentd69e68cd4ed0e74e0f857bfdf35a849d3c1a245d (diff)
downloadgradecoin-3526fddd8012e28612513bc3711fe3a2fc7a371f.tar.gz
gradecoin-3526fddd8012e28612513bc3711fe3a2fc7a371f.tar.bz2
gradecoin-3526fddd8012e28612513bc3711fe3a2fc7a371f.zip
Chipping away at block test
Diffstat (limited to 'tests/route_tests.rs')
-rw-r--r--tests/route_tests.rs40
1 files changed, 22 insertions, 18 deletions
diff --git a/tests/route_tests.rs b/tests/route_tests.rs
index 74ebebc..76ea5fc 100644
--- a/tests/route_tests.rs
+++ b/tests/route_tests.rs
@@ -52,23 +52,23 @@ sQIDAQAB
52 db 52 db
53 } 53 }
54 54
55 /// Create a mock user that is allowed to be in gradecoin to be used in tests 55 // /// Create a mock user that is allowed to be in gradecoin to be used in tests
56 fn priviliged_mocked_user() -> AuthRequest { 56 // fn priviliged_mocked_user() -> AuthRequest {
57 AuthRequest { 57 // AuthRequest {
58 student_id: String::from("e254275"), 58 // student_id: String::from("e254275"),
59 passwd: String::from("DtNX1qk4YF4saRH"), 59 // passwd: String::from("DtNX1qk4YF4saRH"),
60 public_key: "NOT IMPLEMENTED".to_owned(), 60 // public_key: "NOT IMPLEMENTED".to_owned(),
61 } 61 // }
62 } 62 // }
63 63
64 /// Create a mock user that is NOT allowed to be in gradecoin to be used in tests 64 // /// Create a mock user that is NOT allowed to be in gradecoin to be used in tests
65 fn unpriviliged_mocked_user() -> AuthRequest { 65 // fn unpriviliged_mocked_user() -> AuthRequest {
66 AuthRequest { 66 // AuthRequest {
67 student_id: String::from("foobarbaz"), 67 // student_id: String::from("foobarbaz"),
68 passwd: String::from("DtNX1qk4YF4saRH"), 68 // passwd: String::from("DtNX1qk4YF4saRH"),
69 public_key: "NOT IMPLEMENTED".to_owned(), 69 // public_key: "NOT IMPLEMENTED".to_owned(),
70 } 70 // }
71 } 71 // }
72 72
73 /// Create a mock transaction to be used in tests 73 /// Create a mock transaction to be used in tests
74 fn mocked_transaction() -> Transaction { 74 fn mocked_transaction() -> Transaction {
@@ -216,9 +216,11 @@ sQIDAQAB
216 .reply(&filter) 216 .reply(&filter)
217 .await; 217 .await;
218 218
219 println!("{:?}, {:?}", res, db.blockchain.read());
220
219 // should be reflectled on the db as well 221 // should be reflectled on the db as well
220 assert_eq!( 222 assert_eq!(
221 *db.blockchain.read().hash, 223 db.blockchain.read().hash,
222 "0000007c52e4486359f62b2d19781fafaf059bd691bc6d835b666f6eac1d01d9".to_owned() 224 "0000007c52e4486359f62b2d19781fafaf059bd691bc6d835b666f6eac1d01d9".to_owned()
223 ); 225 );
224 assert_eq!(res.status(), StatusCode::CREATED); 226 assert_eq!(res.status(), StatusCode::CREATED);
@@ -373,7 +375,9 @@ sQIDAQAB
373 375
374 /// Test the User Authentication Process 376 /// Test the User Authentication Process
375 #[tokio::test] 377 #[tokio::test]
376 async fn user_authentication() {} 378 async fn user_authentication() {
379 let db = mocked_db();
380 }
377} 381}
378 382
379// TODO: POST block without correct transactions test <09-04-21, yigit> // 383// TODO: POST block without correct transactions test <09-04-21, yigit> //