Token login test
This commit is contained in:
parent
b03b703c22
commit
9ad01cd227
|
@ -20,3 +20,36 @@ async fn test_registration() {
|
|||
bundle.instance.clone().register_account(reg).await.unwrap();
|
||||
common::teardown(bundle).await;
|
||||
}
|
||||
|
||||
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
|
||||
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
|
||||
async fn test_login_with_token() {
|
||||
let mut bundle = common::setup().await;
|
||||
|
||||
let token = &bundle.user.token;
|
||||
let other_user = bundle
|
||||
.instance
|
||||
.login_with_token(token.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
bundle.user.object.read().unwrap().id,
|
||||
other_user.object.read().unwrap().id
|
||||
);
|
||||
assert_eq!(bundle.user.token, other_user.token);
|
||||
|
||||
common::teardown(bundle).await;
|
||||
}
|
||||
|
||||
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
|
||||
#[cfg_attr(not(target_arch = "wasm32"), tokio::test)]
|
||||
async fn test_login_with_invalid_token() {
|
||||
let mut bundle = common::setup().await;
|
||||
|
||||
let token = "invalid token lalalalala".to_string();
|
||||
let other_user = bundle.instance.login_with_token(token.clone()).await;
|
||||
|
||||
assert!(other_user.is_err());
|
||||
|
||||
common::teardown(bundle).await;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue