All checks were successful
Rust Build / Check (pull_request) Successful in 44s
Rust Build / Test Suite (pull_request) Successful in 31s
Rust Build / Rustfmt (pull_request) Successful in 25s
Rust Build / Clippy (pull_request) Successful in 33s
Rust Build / build (pull_request) Successful in 36s
43 lines
999 B
Rust
43 lines
999 B
Rust
extern crate icarus_auth;
|
|
|
|
use axum::body::Body;
|
|
// use axum::response::Response;
|
|
use axum::{
|
|
Router,
|
|
http::{Request, StatusCode},
|
|
routing::get,
|
|
};
|
|
// use http::{Request, StatusCode};
|
|
// use serde_json::json;
|
|
// use tower::ServiceExt; // for `.oneshot()`
|
|
use tower::util::ServiceExt;
|
|
|
|
use crate::icarus_auth::callers;
|
|
|
|
#[tokio::test]
|
|
async fn test_hello_world() {
|
|
let app = Router::new().route(callers::endpoints::ROOT, get(callers::common::root)); // Replace with your handler
|
|
|
|
let response = app
|
|
.oneshot(
|
|
Request::builder()
|
|
.uri(callers::endpoints::ROOT)
|
|
.body(Body::empty())
|
|
.unwrap(),
|
|
)
|
|
.await
|
|
.unwrap();
|
|
|
|
assert_eq!(response.status(), StatusCode::OK);
|
|
|
|
let body = String::from_utf8(
|
|
axum::body::to_bytes(response.into_body(), usize::MAX)
|
|
.await
|
|
.unwrap()
|
|
.to_vec(),
|
|
)
|
|
.unwrap();
|
|
|
|
assert_eq!(body, "Hello, World!");
|
|
}
|