Skip to content

Commit 8093c7f

Browse files
committed
.
1 parent c1fdaa4 commit 8093c7f

File tree

26 files changed

+803
-598
lines changed

26 files changed

+803
-598
lines changed

Cargo.lock

Lines changed: 21 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
use axum_test::TestServer;
2-
use shared::endpoints::endpoint::{GetEndpoint, PostEndpoint};
1+
// use axum_test::TestServer;
2+
// use shared::endpoints::endpoint::{GetEndpoint, PostEndpoint};
33

4-
pub trait PostEndpointTestClient: PostEndpoint {
5-
async fn make_test_request(
6-
test_server: &TestServer,
7-
payload: &Self::JsonPayload,
8-
query_params: Self::QueryParams,
9-
) -> <Self as PostEndpoint>::JsonResponse {
10-
let req = test_server
11-
.post(Self::PATH)
12-
.save_cookies()
13-
.json(payload)
14-
.add_query_params(query_params);
4+
// pub trait PostEndpointTestClient: PostEndpoint {
5+
// async fn make_test_request(
6+
// test_server: &TestServer,
7+
// payload: &Self::JsonPayload,
8+
// query_params: Self::QueryParams,
9+
// ) -> <Self as PostEndpoint>::JsonResponse {
10+
// let req = test_server
11+
// .post(Self::PATH)
12+
// .save_cookies()
13+
// .json(payload)
14+
// .add_query_params(query_params);
1515

16-
req.await.json::<Self::JsonResponse>()
17-
}
18-
}
16+
// req.await.json::<Self::JsonResponse>()
17+
// }
18+
// }
1919

20-
impl<E: PostEndpoint> PostEndpointTestClient for E {}
20+
// impl<E: PostEndpoint> PostEndpointTestClient for E {}
2121

22-
#[allow(dead_code)]
23-
pub trait GetEndpointTestClient: GetEndpoint {
24-
async fn make_test_request(
25-
test_server: &TestServer,
26-
query_params: Self::QueryParams,
27-
) -> <Self as GetEndpoint>::JsonResponse {
28-
let req = test_server
29-
.post(Self::PATH)
30-
.save_cookies()
31-
.add_query_params(query_params);
22+
// #[allow(dead_code)]
23+
// pub trait GetEndpointTestClient: GetEndpoint {
24+
// async fn make_test_request(
25+
// test_server: &TestServer,
26+
// query_params: Self::QueryParams,
27+
// ) -> <Self as GetEndpoint>::JsonResponse {
28+
// let req = test_server
29+
// .post(Self::PATH)
30+
// .save_cookies()
31+
// .add_query_params(query_params);
3232

33-
req.await.json::<Self::JsonResponse>()
34-
}
35-
}
33+
// req.await.json::<Self::JsonResponse>()
34+
// }
35+
// }
3636

37-
impl<E: GetEndpoint> GetEndpointTestClient for E {}
37+
// impl<E: GetEndpoint> GetEndpointTestClient for E {}

backend/src/tests/mod.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
use crate::{
22
config::Config,
3-
custom_github_api::{get_user_access_token_request, ATResp},
4-
db::get_login_user,
5-
utils::gen_rand_string,
3+
// custom_github_api::{get_user_access_token_request, ATResp},
4+
// db::get_login_user,
5+
// utils::gen_rand_string,
66
};
77
pub mod endpoint_test_client;
88
mod parse_request;
99

1010
use std::{
1111
cell::LazyCell,
12-
collections::HashMap,
12+
// collections::HashMap,
1313
future::Future,
1414
path::PathBuf,
1515
sync::Arc,
16-
time::{Duration, SystemTime},
16+
time::{
17+
// Duration,
18+
SystemTime,
19+
},
1720
};
1821

1922
use crate::error::Error as CrateError;
2023
use assert_json_diff::assert_json_include;
21-
use axum_test::{TestResponse, TestServer, WsMessage};
24+
use axum_test::{
25+
TestResponse,
26+
TestServer,
27+
// WsMessage
28+
};
2229
use backtrace::Backtrace;
2330
use deadpool_diesel::postgres::Pool;
2431
use derive_more::derive::AsRef;
@@ -27,27 +34,24 @@ use diesel_test::{
2734
postgres::{ParsingDbUrlError, PostgresDbUrlFactory},
2835
DieselTestConfig,
2936
};
30-
use endpoint_test_client::PostEndpointTestClient;
31-
use github_api::models::{PrivateUser, UsersGetAuthenticated200Response};
32-
use github_webhook_body::WebhookBody;
37+
// use endpoint_test_client::PostEndpointTestClient;
38+
// use github_api::models::{PrivateUser, UsersGetAuthenticated200Response};
39+
// use github_webhook_body::WebhookBody;
3340
use http::StatusCode;
3441
use parking_lot::Mutex;
3542
use parse_request::ParsedHttpRequest;
3643
use serde_json::Value;
37-
use shared::github_api_trait::GithubApi;
44+
// use shared::github_api_trait::GithubApi;
3845
use shared::{
39-
endpoints::defns::api::{
40-
auth::{
41-
finish::{AuthFinishEndpoint, AuthFinishPayload, GithubAccessToken},
42-
initiate::AuthInitiateEndpoint,
43-
},
44-
websocket_updates::{ServerMsg, WEBSOCKET_UPDATES_ENDPOINT},
45-
},
46+
// endpoints::defns::api::websocket_updates::{ServerMsg, WEBSOCKET_UPDATES_ENDPOINT},
4647
types::{installation::InstallationId, user::UserId},
4748
};
4849
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
49-
use url::Url;
50-
use wiremock::{MockServer, ResponseTemplate};
50+
// use url::Url;
51+
use wiremock::{
52+
MockServer,
53+
// ResponseTemplate
54+
};
5155

5256
use crate::{
5357
config::init_config,
@@ -120,8 +124,6 @@ struct TestSetup {
120124
server: TestServer,
121125
#[as_ref]
122126
config: Config,
123-
github_api_mock_server: MockServer,
124-
github_non_api_mock_server: MockServer,
125127
}
126128

127129
async fn with_test_server<Fut: Future>(
@@ -164,8 +166,6 @@ async fn with_test_server<Fut: Future>(
164166
pool,
165167
server,
166168
config,
167-
github_api_mock_server,
168-
github_non_api_mock_server,
169169
};
170170

171171
Ok::<Fut::Output, TestError>(func(test_setup).await)

0 commit comments

Comments
 (0)