|
1 | 1 | use actix_web::{http::StatusCode, test, App}; |
2 | | -use atcoder_problems_backend::server::config_services; |
3 | 2 | use serde_json::Value; |
4 | 3 | use sql_client::models::Submission; |
5 | 4 | use sql_client::PgPool; |
@@ -36,35 +35,6 @@ async fn prepare_data_set(conn: &PgPool) { |
36 | 35 | .unwrap(); |
37 | 36 | } |
38 | 37 |
|
39 | | -#[actix_web::test] |
40 | | -async fn test_user_submissions() { |
41 | | - let pg_pool = utils::initialize_and_connect_to_test_sql().await; |
42 | | - prepare_data_set(&pg_pool).await; |
43 | | - |
44 | | - let app = test::init_service( |
45 | | - App::new() |
46 | | - .app_data(actix_web::web::Data::new(pg_pool)) |
47 | | - .configure(config_services), |
48 | | - ) |
49 | | - .await; |
50 | | - |
51 | | - let request = test::TestRequest::get() |
52 | | - .uri("/atcoder-api/results?user=u1") |
53 | | - .to_request(); |
54 | | - let submissions: Vec<Submission> = test::call_and_read_body_json(&app, request).await; |
55 | | - |
56 | | - assert_eq!(submissions.len(), 5); |
57 | | - assert!(submissions.iter().all(|s| s.user_id == "u1")); |
58 | | - |
59 | | - let response = test::TestRequest::get() |
60 | | - .uri("/atcoder-api/results?user=u2") |
61 | | - .to_request(); |
62 | | - let submissions: Vec<Submission> = test::call_and_read_body_json(&app, response).await; |
63 | | - |
64 | | - assert_eq!(submissions.len(), 5); |
65 | | - assert!(submissions.iter().all(|s| s.user_id == "u2")); |
66 | | -} |
67 | | - |
68 | 38 | #[actix_web::test] |
69 | 39 | async fn test_user_submissions_fromtime() { |
70 | 40 | let pg_pool = utils::initialize_and_connect_to_test_sql().await; |
@@ -186,7 +156,7 @@ async fn test_invalid_path() { |
186 | 156 | assert_eq!(response.status(), StatusCode::NOT_FOUND); |
187 | 157 |
|
188 | 158 | let response = test::TestRequest::get() |
189 | | - .uri("/atcoder-api/results") |
| 159 | + .uri("/atcoder-api/v3/user/submissions") |
190 | 160 | .send_request(&app) |
191 | 161 | .await; |
192 | 162 |
|
@@ -256,7 +226,7 @@ async fn test_cors() { |
256 | 226 | ); |
257 | 227 |
|
258 | 228 | let response = test::TestRequest::get() |
259 | | - .uri("/atcoder-api/results?user=u1") |
| 229 | + .uri("/atcoder-api/v3/user/submissions?user=u1&from_second=0") |
260 | 230 | .send_request(&app) |
261 | 231 | .await; |
262 | 232 |
|
|
0 commit comments