Skip to content

Commit 801e38d

Browse files
committed
I forgot we have tests
also thank you utoipa
1 parent 216ade6 commit 801e38d

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

src/api/leaderboards.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub struct LeaderboardInvite {
133133
}
134134

135135
#[utoipa::path(
136-
get,
136+
post,
137137
path = "/leaderboards/join",
138138
security(
139139
("api_key" = [])

src/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,14 @@ fn create_router_with_openapi(config: &TestaustimeConfig) -> (Router, utoipa::op
193193
.routes(routes!(api::users::get_current_activity))
194194
.routes(routes!(api::users::get_activity_summary))
195195
.routes(routes!(api::leaderboards::create_leaderboard))
196-
.routes(routes!(api::leaderboards::get_leaderboard))
196+
.routes(routes!(
197+
// utoipa/axum will not resolve these correctly based on method if registered
198+
// seperately, go figure
199+
api::leaderboards::get_leaderboard,
200+
api::leaderboards::delete_leaderboard
201+
))
197202
.routes(routes!(api::leaderboards::join_leaderboard))
198203
.routes(routes!(api::leaderboards::leave_leaderboard))
199-
.routes(routes!(api::leaderboards::delete_leaderboard))
200204
.routes(routes!(api::leaderboards::promote_member))
201205
.routes(routes!(api::leaderboards::demote_member))
202206
.routes(routes!(api::leaderboards::kick_member))

src/tests/leaderboards.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use serde_json::json;
22

33
use super::{macros::*, *};
44
use crate::{
5-
api::leaderboards::{LeaderboardInvite, LeaderboardName},
5+
api::leaderboards::{LeaderboardCreateRequest, LeaderboardInvite},
66
models::{NewUserIdentity, PrivateLeaderboard},
77
};
88

@@ -23,7 +23,7 @@ async fn creation_joining_and_deletion() {
2323

2424
let member: NewUserIdentity = body_to_json(resp).await;
2525

26-
let create = LeaderboardName {
26+
let create = LeaderboardCreateRequest {
2727
name: "board".to_string(),
2828
};
2929

src/tests/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use tower::ServiceExt;
1717
// NOTE: We would like to use diesels Connection::begin_test_transaction
1818
// But cannot use them because our database uses transactions to implement
1919
// some of the routes and there cannot exists transactions within transactions :'(
20-
use crate::create_router;
20+
use crate::create_router_with_openapi;
2121

2222
const TEST_ADDR: SocketAddr = SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 3000));
2323

@@ -41,7 +41,9 @@ fn create_test_router() -> Router {
4141
mail_password: "".to_string(),
4242
};
4343

44-
create_router(&config).layer(MockConnectInfo(SocketAddr::from(([127, 0, 0, 1], 3000))))
44+
create_router_with_openapi(&config)
45+
.0
46+
.layer(MockConnectInfo(SocketAddr::from(([127, 0, 0, 1], 3000))))
4547
}
4648

4749
#[tokio::test]

0 commit comments

Comments
 (0)