tests: add test for email format

TODO: actually test items/sync
This commit is contained in:
Peter Cai 2020-02-22 16:47:52 +08:00
parent 847dfd80dd
commit 3541ee1d7f
No known key found for this signature in database
GPG Key ID: 71F5FB4E4F3FD54F
1 changed files with 16 additions and 0 deletions

View File

@ -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")