-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
113 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#[cfg(feature = "axum-integration")] | ||
mod tests { | ||
use axum::body::Body; | ||
use http::Request; | ||
use okapi_operation::{ | ||
axum_integration::{get, Router}, | ||
oh, openapi, openapi_handler, openapi_service, Components, ToResponses, | ||
}; | ||
|
||
#[test] | ||
fn openapi_handler_name() { | ||
#[openapi] | ||
async fn handle() {} | ||
|
||
let _ = Router::<()>::new().route("/", get(oh!(handle))); | ||
} | ||
|
||
#[test] | ||
fn openapi_handler_path() { | ||
mod outer { | ||
pub mod inner { | ||
use okapi_operation::*; | ||
|
||
#[openapi] | ||
pub async fn handle() {} | ||
} | ||
} | ||
|
||
let _ = Router::<()>::new().route("/", get(openapi_handler!(outer::inner::handle))); | ||
} | ||
|
||
#[test] | ||
fn openapi_handler_method() { | ||
struct S {} | ||
|
||
impl S { | ||
#[openapi] | ||
async fn handle() {} | ||
} | ||
|
||
let _ = Router::<()>::new().route("/", get(openapi_handler!(S::handle))); | ||
} | ||
|
||
#[test] | ||
fn openapi_handler_typed() { | ||
#[openapi] | ||
async fn handle<T>() {} | ||
|
||
let _ = Router::<()>::new().route("/", get(openapi_handler!(handle::<()>))); | ||
} | ||
|
||
#[test] | ||
#[allow(deprecated)] | ||
fn openapi_service_name() { | ||
#[openapi] | ||
async fn service(_: Request<Body>) { | ||
unimplemented!() | ||
} | ||
|
||
let _ = Router::<()>::new().route("/", get(openapi_service!(service))); | ||
} | ||
} |