get notifications

This commit is contained in:
realaravinth
2021-05-10 15:38:09 +05:30
parent aa0c30f1bd
commit 91ca00ea79
18 changed files with 241 additions and 25 deletions

View File

@@ -250,7 +250,11 @@ pub struct I32Levels {
pub visitor_threshold: i32,
}
async fn get_levels_util(key: &str, username: &str, data: &Data) -> ServiceResult<Vec<I32Levels>> {
async fn get_levels_util(
key: &str,
username: &str,
data: &Data,
) -> ServiceResult<Vec<I32Levels>> {
let levels = sqlx::query_as!(
I32Levels,
"SELECT difficulty_factor, visitor_threshold FROM mcaptcha_levels WHERE

View File

@@ -299,7 +299,8 @@ mod tests {
)
.await;
assert_eq!(update_token_resp.status(), StatusCode::OK);
let updated_token: MCaptchaDetails = test::read_body_json(update_token_resp).await;
let updated_token: MCaptchaDetails =
test::read_body_json(update_token_resp).await;
// get token key with updated key
let get_token_resp = test::call_service(
@@ -312,7 +313,8 @@ mod tests {
assert_eq!(get_token_resp.status(), StatusCode::OK);
// check if they match
let mut get_token_key: MCaptchaDetails = test::read_body_json(get_token_resp).await;
let mut get_token_key: MCaptchaDetails =
test::read_body_json(get_token_resp).await;
assert_eq!(get_token_key.key, updated_token.key);
get_token_key.key = "nonexistent".into();