aboutsummaryrefslogtreecommitdiffstats
path: root/tests/schema_tests.rs
diff options
context:
space:
mode:
authorYigit Sever2022-04-16 18:05:37 +0300
committerYigit Sever2022-04-16 18:05:37 +0300
commit43ad693490d3c2770bdcad7f59be50d6f1aa79dc (patch)
treebc4f75101941bf369a82ab62e756c91ecbbbfd44 /tests/schema_tests.rs
parent96d34952c1fb2cf096b6c907feada60b0db27a8f (diff)
downloadgradecoin-43ad693490d3c2770bdcad7f59be50d6f1aa79dc.tar.gz
gradecoin-43ad693490d3c2770bdcad7f59be50d6f1aa79dc.tar.bz2
gradecoin-43ad693490d3c2770bdcad7f59be50d6f1aa79dc.zip
temporarily remove tests
Diffstat (limited to 'tests/schema_tests.rs')
-rw-r--r--tests/schema_tests.rs310
1 files changed, 0 insertions, 310 deletions
diff --git a/tests/schema_tests.rs b/tests/schema_tests.rs
deleted file mode 100644
index 072cb2b..0000000
--- a/tests/schema_tests.rs
+++ /dev/null
@@ -1,310 +0,0 @@
1// #[cfg(test)]
2// mod tests {
3// use gradecoin::schema::*;
4// use serde_test::{assert_tokens, Token};
5// use chrono::NaiveDate;
6
7// #[test]
8// fn claims_serialize_correctly() {
9// let claims = Claims {
10// tha: "hashed_string".to_owned(),
11// iat: 0,
12// exp: 100,
13// };
14// assert_tokens(
15// &claims,
16// &[
17// Token::Struct{name: "Claims", len: 3},
18// Token::String("tha"),
19// Token::String("hashed_string"),
20// Token::String("iat"),
21// Token::U64(0),
22// Token::String("exp"),
23// Token::U64(100),
24// Token::StructEnd,
25// ]
26// )
27// }
28
29// #[test]
30// fn claims_deserialize_correctly() {
31// let data = r#"{"tha":"hashed_string","iat":0,"exp":100}"#;
32// let claims: Claims = serde_json::from_str(data).unwrap();
33// let expected_claims = Claims {
34// tha: "hashed_string".to_owned(),
35// iat: 0,
36// exp: 100,
37// };
38// assert_eq!(claims, expected_claims);
39// }
40
41// #[test]
42// fn transaction_serialize_correctly() {
43// let transaction = Transaction {
44// by: "source".to_owned(),
45// source: "source".to_owned(),
46// target: "target".to_owned(),
47// amount: 0,
48// timestamp: NaiveDate::from_ymd(2021, 4, 2).and_hms(4, 2, 42),
49// };
50
51// assert_tokens(
52// &transaction,
53// &[
54// Token::Struct{name: "Transaction", len: 5},
55// Token::String("by"),
56// Token::String("source"),
57// Token::String("source"),
58// Token::String("source"),
59// Token::String("target"),
60// Token::String("target"),
61// Token::String("amount"),
62// Token::I32(0),
63// Token::String("timestamp"),
64// Token::String("2021-04-02T04:02:42"),
65// Token::StructEnd,
66// ]
67// )
68// }
69
70// #[test]
71// fn transaction_deserialize_correctly() {
72// let data = r#"{"by":"source","source":"source","target":"target","amount":0,"timestamp":"2021-04-02T04:02:42"}"#;
73// let transaction: Transaction = serde_json::from_str(data).unwrap();
74// let expected_transaction = Transaction {
75// by: "source".to_owned(),
76// source: "source".to_owned(),
77// target: "target".to_owned(),
78// amount: 0,
79// timestamp: NaiveDate::from_ymd(2021, 4, 2).and_hms(4, 2, 42),
80// };
81
82// assert_eq!(transaction, expected_transaction);
83// }
84
85// #[test]
86// fn block_serialize_correctly() {
87// let block = Block {
88// transaction_list: vec!["transaction1".to_owned()],
89// nonce: 0,
90// timestamp: NaiveDate::from_ymd(2021, 4, 2).and_hms(4, 2, 42),
91// hash: "hash".to_owned()
92// };
93
94// assert_tokens(
95// &block,
96// &[
97// Token::Struct{name: "Block", len: 4},
98// Token::String("transaction_list"),
99// Token::Seq {len: Some(1)},
100// Token::String("transaction1"),
101// Token::SeqEnd,
102// Token::String("nonce"),
103// Token::U32(0),
104// Token::String("timestamp"),
105// Token::String("2021-04-02T04:02:42"),
106// Token::String("hash"),
107// Token::String("hash"),
108// Token::StructEnd,
109// ]
110// )
111// }
112
113// #[test]
114// fn block_deserialize_correctly() {
115// let expected_block = Block {
116// transaction_list: vec!["transaction1".to_owned()],
117// nonce: 0,
118// timestamp: NaiveDate::from_ymd(2021, 4, 2).and_hms(4, 2, 42),
119// hash: "hash".to_owned()
120// };
121// let data = r#"{"transaction_list":["transaction1"],"nonce":0,"timestamp":"2021-04-02T04:02:42","hash":"hash"}"#;
122// let block: Block = serde_json::from_str(data).unwrap();
123
124// assert_eq!(block, expected_block);
125
126// }
127
128// #[test]
129// fn block_serialize_when_vec_emptpy() {
130// let block = Block {
131// transaction_list: vec![],
132// nonce: 0,
133// timestamp: NaiveDate::from_ymd(2021, 4, 2).and_hms(4, 2, 42),
134// hash: "hash".to_owned()
135// };
136
137// let json = serde_json::to_string(&block).unwrap();
138// assert_eq!(json, r#"{"nonce":0,"timestamp":"2021-04-02T04:02:42","hash":"hash"}"#)
139// }
140
141// #[test]
142// fn naked_block_serialize_correctly() {
143// let naked_block = NakedBlock {
144// transaction_list: vec!["transaction1".to_owned()],
145// nonce: 0,
146// timestamp: NaiveDate::from_ymd(2021, 4, 2).and_hms(4, 2, 42),
147// };
148
149// assert_tokens(
150// &naked_block,
151// &[
152// Token::Struct{name: "NakedBlock", len: 3},
153// Token::String("transaction_list"),
154// Token::Seq {len: Some(1)},
155// Token::String("transaction1"),
156// Token::SeqEnd,
157// Token::String("nonce"),
158// Token::U32(0),
159// Token::String("timestamp"),
160// Token::String("2021-04-02T04:02:42"),
161// Token::StructEnd,
162// ]
163// )
164// }
165
166// #[test]
167// fn naked_block_deserialize_correctly() {
168// let expected_naked_block = NakedBlock {
169// transaction_list: vec!["transaction1".to_owned()],
170// nonce: 0,
171// timestamp: NaiveDate::from_ymd(2021, 4, 2).and_hms(4, 2, 42),
172// };
173// let data = r#"{"transaction_list":["transaction1"],"nonce":0,"timestamp":"2021-04-02T04:02:42"}"#;
174// let naked_block: NakedBlock = serde_json::from_str(data).unwrap();
175
176// assert_eq!(naked_block, expected_naked_block);
177
178// }
179
180// #[test]
181// fn naked_block_serialize_when_vec_emptpy() {
182// let naked_block = NakedBlock {
183// transaction_list: vec![],
184// nonce: 0,
185// timestamp: NaiveDate::from_ymd(2021, 4, 2).and_hms(4, 2, 42),
186// };
187
188// let json = serde_json::to_string(&naked_block).unwrap();
189// assert_eq!(json, r#"{"nonce":0,"timestamp":"2021-04-02T04:02:42"}"#)
190// }
191
192// #[test]
193// fn user_serialize_correctly() {
194// let user = User {
195// user_id: MetuId::new("e254275".to_owned(), "DtNX1qk4YF4saRH".to_owned()).unwrap(),
196// public_key: "public_key".to_owned(),
197// balance: 0
198// };
199
200// assert_tokens(
201// &user,
202// &[
203// Token::Struct{name: "User", len: 3},
204// Token::String("user_id"),
205// Token::Struct {name: "MetuId", len: 2},
206// Token::String("id"),
207// Token::String("e254275"),
208// Token::String("passwd"),
209// Token::String("DtNX1qk4YF4saRH"),
210// Token::StructEnd,
211// Token::String("public_key"),
212// Token::String("public_key"),
213// Token::String("balance"),
214// Token::I32(0),
215// Token::StructEnd,
216// ]
217// )
218// }
219
220// #[test]
221// fn user_deserialize_correctly() {
222// let expected_user = User {
223// user_id: MetuId::new("e254275".to_owned(), "DtNX1qk4YF4saRH".to_owned()).unwrap(),
224// public_key: "public_key".to_owned(),
225// balance: 0
226// };
227// let data = r#"{"user_id":{"id":"e254275","passwd":"DtNX1qk4YF4saRH"},"public_key":"public_key","balance":0}"#;
228// let user: User = serde_json::from_str(data).unwrap();
229
230// assert_eq!(user, expected_user);
231
232// }
233
234// #[test]
235// fn metu_id_serialize_correctly() {
236// let metu_id = MetuId::new ("e254275".to_owned(), "DtNX1qk4YF4saRH".to_owned()).unwrap();
237
238// assert_tokens(
239// &metu_id,
240// &[
241// Token::Struct{name: "MetuId", len: 2},
242// Token::String("id"),
243// Token::String("e254275"),
244// Token::String("passwd"),
245// Token::String("DtNX1qk4YF4saRH"),
246// Token::StructEnd,
247// ]
248// )
249// }
250
251// #[test]
252// fn metu_id_deserialize_correctly() {
253// let expected_metu_id = MetuId::new ("e254275".to_owned(), "DtNX1qk4YF4saRH".to_owned()).unwrap();
254// let data = r#"{"id":"e254275","passwd":"DtNX1qk4YF4saRH"}"#;
255// let metu_id: MetuId = serde_json::from_str(data).unwrap();
256
257// assert_eq!(metu_id, expected_metu_id);
258// }
259
260// #[test]
261// fn auth_request_serialize_correctly() {
262// let auth_request = AuthRequest {
263// student_id: "e254275".to_owned(),
264// passwd: "DtNX1qk4YF4saRH".to_owned(),
265// public_key: "public_key".to_owned()
266// };
267
268// assert_tokens(
269// &auth_request,
270// &[
271// Token::Struct{name: "AuthRequest", len: 3},
272// Token::String("student_id"),
273// Token::String("e254275"),
274// Token::String("passwd"),
275// Token::String("DtNX1qk4YF4saRH"),
276// Token::String("public_key"),
277// Token::String("public_key"),
278// Token::StructEnd,
279// ]
280// )
281// }
282
283// #[test]
284// fn auth_request_deserialize_correctly() {
285// let expected_auth_request = AuthRequest {
286// student_id: "e254275".to_owned(),
287// passwd: "DtNX1qk4YF4saRH".to_owned(),
288// public_key: "public_key".to_owned()
289// };
290// let data = r#"{"student_id":"e254275","passwd":"DtNX1qk4YF4saRH","public_key":"public_key"}"#;
291// let auth_request: AuthRequest = serde_json::from_str(data).unwrap();
292
293// assert_eq!(auth_request, expected_auth_request);
294
295// }
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310// }