aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoralpaylan2021-04-14 02:42:04 +0300
committeralpaylan2021-04-14 02:42:04 +0300
commitc1f4287b167aeb69e26ff6307be4a76a124bd99b (patch)
treed16ebfe7690c9b3e46f4c946b9257684ebc323e6 /tests
parentd4646efc091a0bda018244f451e68c5798c62462 (diff)
downloadgradecoin-c1f4287b167aeb69e26ff6307be4a76a124bd99b.tar.gz
gradecoin-c1f4287b167aeb69e26ff6307be4a76a124bd99b.tar.bz2
gradecoin-c1f4287b167aeb69e26ff6307be4a76a124bd99b.zip
finished auth request testing.
Diffstat (limited to 'tests')
-rw-r--r--tests/schema_tests.rs25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/schema_tests.rs b/tests/schema_tests.rs
index 7fbbba0..e58af29 100644
--- a/tests/schema_tests.rs
+++ b/tests/schema_tests.rs
@@ -236,7 +236,7 @@ mod tests {
236 #[test] 236 #[test]
237 fn metu_id_deserialize_correctly() { 237 fn metu_id_deserialize_correctly() {
238 let expected_metu_id = MetuId::new ("e254275".to_owned()).unwrap(); 238 let expected_metu_id = MetuId::new ("e254275".to_owned()).unwrap();
239 let data = r#"{"{"id":"e254275"}"#; 239 let data = r#"{"id":"e254275"}"#;
240 let metu_id: MetuId = serde_json::from_str(data).unwrap(); 240 let metu_id: MetuId = serde_json::from_str(data).unwrap();
241 241
242 assert_eq!(metu_id, expected_metu_id); 242 assert_eq!(metu_id, expected_metu_id);
@@ -244,11 +244,34 @@ mod tests {
244 244
245 #[test] 245 #[test]
246 fn auth_request_serialize_correctly() { 246 fn auth_request_serialize_correctly() {
247 let auth_request = AuthRequest {
248 student_id: "e254275".to_owned(),
249 public_key: "public_key".to_owned()
250 };
247 251
252 assert_tokens(
253 &auth_request,
254 &[
255 Token::Struct{name: "AuthRequest", len: 2},
256 Token::String("student_id"),
257 Token::String("e254275"),
258 Token::String("public_key"),
259 Token::String("public_key"),
260 Token::StructEnd,
261 ]
262 )
248 } 263 }
249 264
250 #[test] 265 #[test]
251 fn auth_request_deserialize_correctly() { 266 fn auth_request_deserialize_correctly() {
267 let expected_auth_request = AuthRequest {
268 student_id: "e254275".to_owned(),
269 public_key: "public_key".to_owned()
270 };
271 let data = r#"{"student_id":"e254275","public_key":"public_key"}"#;
272 let auth_request: AuthRequest = serde_json::from_str(data).unwrap();
273
274 assert_eq!(auth_request, expected_auth_request);
252 275
253 } 276 }
254 277