aboutsummaryrefslogtreecommitdiffstats
path: root/tests/route_tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/route_tests.rs')
-rw-r--r--tests/route_tests.rs33
1 files changed, 8 insertions, 25 deletions
diff --git a/tests/route_tests.rs b/tests/route_tests.rs
index 3125bc8..6d17368 100644
--- a/tests/route_tests.rs
+++ b/tests/route_tests.rs
@@ -10,25 +10,7 @@ mod tests {
10 let db = Db::new(); 10 let db = Db::new();
11 11
12 db.users.write().insert( 12 db.users.write().insert(
13 "mock_transaction_source".to_owned(), 13 "fingerprint_of_some_guy".to_owned(),
14 User {
15 user_id: MetuId::new("e254275".to_owned(), "DtNX1qk4YF4saRH".to_owned()).unwrap(),
16 public_key: "-----BEGIN PUBLIC KEY-----
17MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5yWTMeFqr2nvOC9oR5Wq
18/nzcNlwCIaziojt7rJ4BBvuwkT0tERDz8AgvUsaewiB+Fz5OXTeb3WAB1FEXnBXG
19ekrGzvC8jHQMKHyNoWzUlpQJ9UMtdQIWPOCuMyLpc+rNPL3428U8UpldjbTHHyq2
20/ef6abkdj+XWg/slYtrFeOf3ktc1l50R4k8VO8L6kQuh2+YIjXGPLShRaqnUQPtH
218LFPX4bO9lJ9mAoMZFec6XVwumn/uqu9jyWQL6qh6gtwQHgN+A9wGvzVvltJ9h8s
22shSHWWtBD0M19ilbXhKyBsHSSZkpx+TAvFhfQ8JURw7KqahUPVlCwJ5OIKccJ/6F
23FQIDAQAB
24-----END PUBLIC KEY-----"
25 .to_owned(),
26 balance: 30,
27 },
28 );
29
30 db.users.write().insert(
31 "mock_transaction_source2".to_owned(),
32 User { 14 User {
33 user_id: MetuId::new("e254275".to_owned(), "DtNX1qk4YF4saRH".to_owned()).unwrap(), 15 user_id: MetuId::new("e254275".to_owned(), "DtNX1qk4YF4saRH".to_owned()).unwrap(),
34 public_key: "-----BEGIN PUBLIC KEY----- 16 public_key: "-----BEGIN PUBLIC KEY-----
@@ -109,13 +91,14 @@ FQIDAQAB
109 timestamp: chrono::NaiveDate::from_ymd(2021, 04, 09).and_hms(14, 30, 00), 91 timestamp: chrono::NaiveDate::from_ymd(2021, 04, 09).and_hms(14, 30, 00),
110 } 92 }
111 } 93 }
94
112 fn mocked_transaction2() -> Transaction { 95 fn mocked_transaction2() -> Transaction {
113 Transaction { 96 Transaction {
114 by: "mock_transaction_source2".to_owned(), 97 by: "fingerprint_of_some_guy".to_owned(),
115 source: "mock_transaction_source2".to_owned(), 98 source: "31415926535897932384626433832795028841971693993751058209749445923".to_owned(),
116 target: "mock_transaction_target".to_owned(), 99 target: "fingerprint_of_some_guy".to_owned(),
117 amount: 2, 100 amount: 2,
118 timestamp: chrono::NaiveDate::from_ymd(2021, 04, 09).and_hms(14, 30, 00), 101 timestamp: chrono::NaiveDate::from_ymd(2021, 04, 13).and_hms(20, 55, 30),
119 } 102 }
120 } 103 }
121 104
@@ -194,7 +177,7 @@ FQIDAQAB
194 let res = warp::test::request() 177 let res = warp::test::request()
195 .method("POST") 178 .method("POST")
196 .json(&mocked_transaction2()) 179 .json(&mocked_transaction2())
197 .header("Authorization", "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0aGEiOiI2NDNmOGYzMjkxNTMzNTMzOTcwMDZmNjVmOWQ1ZmViMyIsImlhdCI6MTUxNjIzOTAyMiwiZXhwIjoyMDE2MjM5MDIyfQ.yNca1RJOkSEKoF7S4PSF4iB8zmnj13ujcfsdVRcJMcQNN4CxP-pJwbUBdRgR8kNwdfLP3nLo0UBwevP42TBoujMKx7oaIl-JXsO37x7Y9GWMAHYBxEOoq1EsBeaxv9pCdyZvuVeJYIMrOpzW7oTcF4tHHvmvySD2ITnQTWu_ioCXEFdX21QQIvsqpRn7XumfCMvWfUy_C2XTFIQEAGdakPmkZ2Xt66k9zhT9hazJgAwELv5VyMV54iF8vyvvmnLkiODwTt_8VdqC6fr6jPwYaP1mzgd58r0fM76Wu0g9tIXVU83rcFMRsm_faXGbsrDJIQ06-fAO_D1sh74fhndK_g") 180 .header("Authorization", "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0aGEiOiJiODI4ZmYwNzM5NjFmMDA2YjU3ZmNkZWMwNmEwZTY1YSIsImV4cCI6MjAwMDAwMDAwMCwiaWF0IjoyNTE2MjM5MDIyfQ.Zwr2BPYzxvdAy8ZjCWSA3dp96KKVHjRDu9imHKCJ0NUeD5fM4D678B6pRZk9ev8PvbEI88MgYVW9akj_IsFwrsho7Tpsh7ym593ZOMwtSWSxxzxuKuGhAuKHDiQlXMFfv6kl8-eXIxa7xbV_0m81vAz6_vYQnVnlhjRQ26LogJRixWpUKV7-mPdRHhrK6dUxi9CwVuc9fdYhd6n2FMKT2AlAnk472fDa3G1oPsFLkp56eJ6_rKWrALHFWItfNvY4zFvwXXyNjMu-0EYJiaQIXFVNnipsy5Sy2HckdY3UiYS2lFUwHIczNrdrLM7NQhJQmbJLD6XRAMifH6bA1ZxH8A")
198 .path("/transaction") 181 .path("/transaction")
199 .reply(&filter) 182 .reply(&filter)
200 .await; 183 .await;
@@ -247,7 +230,7 @@ FQIDAQAB
247 let res = warp::test::request() 230 let res = warp::test::request()
248 .method("POST") 231 .method("POST")
249 .json(&Block { 232 .json(&Block {
250 transaction_list: vec!["mock_transaction_source".to_owned()], 233 transaction_list: vec!["fingerprint_of_some_guy".to_owned(),"mock_transaction_source2".to_owned(), "mock_transaction_source3".to_owned(), "mock_transaction_source".to_owned(), "mock_transaction_source".to_owned()],
251 nonce: 2686215, 234 nonce: 2686215,
252 timestamp: chrono::NaiveDate::from_ymd(2021, 04, 13).and_hms(23, 38, 00), 235 timestamp: chrono::NaiveDate::from_ymd(2021, 04, 13).and_hms(23, 38, 00),
253 hash: "0000007c52e4486359f62b2d19781fafaf059bd691bc6d835b666f6eac1d01d9".to_owned(), 236 hash: "0000007c52e4486359f62b2d19781fafaf059bd691bc6d835b666f6eac1d01d9".to_owned(),