Add minimal test for basic hackathon operations and enhance test utilities
- Introduced a new test module for hackathon-related functionality. - Implemented a basic test for creating a hackathon using a mock repository. - Enhanced the test utilities in `lib.rs` for better request handling and response extraction. - Added a `ServiceClient` struct to facilitate HTTP requests in tests. - Created a `RequestBuilder` to streamline building and sending requests with headers and JSON bodies.
This commit is contained in:
@@ -318,10 +318,9 @@ pub async fn get_admin_team_list(
|
||||
axum::extract::Query(meta): axum::extract::Query<MetaRequestDto>,
|
||||
) -> Response {
|
||||
let state = state;
|
||||
with_perms(headers, axum::Extension(state), vec![PermissionsEnum::ReadListTeams], move |_claims, state| {
|
||||
let response = TeamsService::get_admin_team_list(&state, meta);
|
||||
response
|
||||
}).await
|
||||
with_perms(headers, axum::Extension(state), vec![PermissionsEnum::ReadListTeams], move |_claims, state| {
|
||||
TeamsService::get_admin_team_list(&state, meta)
|
||||
}).await
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
@@ -344,10 +343,9 @@ pub async fn get_admin_team_by_id(
|
||||
Path(id): Path<String>,
|
||||
) -> Response {
|
||||
let state = state;
|
||||
with_perms(headers, axum::Extension(state), vec![PermissionsEnum::ReadDetailTeams], move |_claims, state| {
|
||||
let response = TeamsService::get_admin_team_by_id(&state, id);
|
||||
response
|
||||
}).await
|
||||
with_perms(headers, axum::Extension(state), vec![PermissionsEnum::ReadDetailTeams], move |_claims, state| {
|
||||
TeamsService::get_admin_team_by_id(&state, id)
|
||||
}).await
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
@@ -370,10 +368,9 @@ pub async fn get_admin_team_members(
|
||||
Path(id): Path<String>,
|
||||
) -> Response {
|
||||
let state = state;
|
||||
with_perms(headers, axum::Extension(state), vec![PermissionsEnum::ReadDetailTeams], move |_claims, state| {
|
||||
let response = TeamsService::get_admin_team_members(&state, id);
|
||||
response
|
||||
}).await
|
||||
with_perms(headers, axum::Extension(state), vec![PermissionsEnum::ReadDetailTeams], move |_claims, state| {
|
||||
TeamsService::get_admin_team_members(&state, id)
|
||||
}).await
|
||||
}
|
||||
|
||||
pub fn teams_router() -> Router {
|
||||
|
||||
Reference in New Issue
Block a user