From 3541ee1d7f5bd2cd44e35b5a01f16fb7565ba49c Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Sat, 22 Feb 2020 16:47:52 +0800 Subject: [PATCH] tests: add test for email format TODO: actually test items/sync --- src/tests.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/tests.rs b/src/tests.rs index 5df3440..f556615 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -59,6 +59,22 @@ fn should_not_add_user_twice() { assert_eq!(resp.status(), Status::InternalServerError); } +#[test] +fn should_not_add_user_invalid_email() { + let resp = CLIENT + .post("/auth") + .header(ContentType::JSON) + .body(r#"{ + "email": "test.example.com", + "password": "testpw", + "pw_cost": 100, + "pw_nonce": "whatever", + "version": "001" + }"#) + .dispatch(); + assert_eq!(resp.status(), Status::BadRequest); +} + #[test] fn should_log_in_successfully() { CLIENT.post("/auth")