Skip to content

Commit 82dab2f

Browse files
committed
Fix test
1 parent df1e8f9 commit 82dab2f

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

atcoder-problems-backend/tests/test_server_e2e_ac_ranking.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use actix_web::{test, web, App};
2-
use anyhow::Result;
1+
use actix_web::{test, web, App, Result};
32
use async_trait::async_trait;
43
use atcoder_problems_backend::server::{
54
config_services, AppData, Authentication, GitHubUserResponse,
@@ -14,25 +13,30 @@ struct MockAuth;
1413

1514
#[async_trait(?Send)]
1615
impl Authentication for MockAuth {
17-
async fn get_token(&self, _: &str) -> actix_web::Result<String> {
16+
async fn get_token(&self, _: &str) -> Result<String> {
1817
unimplemented!()
1918
}
20-
async fn get_user_id(&self, _: &str) -> actix_web::Result<GitHubUserResponse> {
19+
async fn get_user_id(&self, _: &str) -> Result<GitHubUserResponse> {
2120
unimplemented!()
2221
}
2322
}
2423

2524
#[actix_web::test]
26-
async fn test_ac_ranking() -> Result<()> {
27-
let pg_pool = sql_client::initialize_pool(utils::get_sql_url_from_env()).await?;
25+
async fn test_ac_ranking() {
26+
let pg_pool = sql_client::initialize_pool(utils::get_sql_url_from_env())
27+
.await
28+
.unwrap();
2829
sql_client::query("TRUNCATE accepted_count")
2930
.execute(&pg_pool)
30-
.await?;
31+
.await
32+
.unwrap();
3133
sql_client::query(
3234
r"INSERT INTO accepted_count (user_id, problem_count) VALUES ('u1', 1), ('u2', 2), ('u3', 1)",
3335
)
3436
.execute(&pg_pool)
35-
.await?;
37+
.await
38+
.unwrap();
39+
3640
let app_data = AppData::new(pg_pool, MockAuth);
3741
let mut app = test::init_service(
3842
App::new()
@@ -143,6 +147,4 @@ async fn test_ac_ranking() -> Result<()> {
143147
.to_request();
144148
let response = test::call_service(&mut app, request).await;
145149
assert_eq!(response.status(), StatusCode::NOT_FOUND);
146-
147-
Ok(())
148150
}

0 commit comments

Comments
 (0)