get user secret

This commit is contained in:
realaravinth
2021-04-10 21:15:31 +05:30
parent 884cb25e02
commit 52ab947e3b
5 changed files with 45 additions and 25 deletions

View File

@@ -34,6 +34,7 @@ async fn auth_works() {
const EMAIL: &str = "testuser1@a.com";
const SIGNIN: &str = "/api/v1/signin";
const SIGNUP: &str = "/api/v1/signup";
const GET_SECRET: &str = "/api/v1/account/secret/";
let mut app = get_app!(data).await;
@@ -43,6 +44,16 @@ async fn auth_works() {
let (_, _, signin_resp) = register_and_signin(NAME, EMAIL, PASSWORD).await;
let cookies = get_cookie!(signin_resp);
let resp = test::call_service(
&mut app,
test::TestRequest::get()
.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(),