update user secret

This commit is contained in:
realaravinth
2021-04-10 21:44:08 +05:30
parent 52ab947e3b
commit 08ec215709
4 changed files with 51 additions and 7 deletions

View File

@@ -44,6 +44,7 @@ async fn auth_works() {
let (_, _, signin_resp) = register_and_signin(NAME, EMAIL, PASSWORD).await;
let cookies = get_cookie!(signin_resp);
// chech if get user secret works
let resp = test::call_service(
&mut app,
test::TestRequest::get()
@@ -54,6 +55,17 @@ async fn auth_works() {
.await;
assert_eq!(resp.status(), StatusCode::OK);
// check if update user secret works
let resp = test::call_service(
&mut app,
test::TestRequest::post()
.cookie(cookies.clone())
.uri(GET_SECRET)
.to_request(),
)
.await;
assert_eq!(resp.status(), StatusCode::OK);
// 2. check if duplicate username is allowed
let msg = Register {
username: NAME.into(),