mirror of
https://github.com/CCC-MF/bwhc-kafka-rest-proxy.git
synced 2025-04-19 11:06:51 +00:00
test: add tests for response generation
This commit is contained in:
parent
144ef6fd22
commit
22f7a7c65d
23
src/main.rs
23
src/main.rs
@ -154,3 +154,26 @@ fn error_response() -> Response {
|
||||
.body(Body::empty())
|
||||
.expect("response built")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use axum::http::StatusCode;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::{error_response, success_response};
|
||||
|
||||
#[test]
|
||||
fn should_return_success_response() {
|
||||
let response = success_response(&Uuid::new_v4().to_string());
|
||||
assert_eq!(response.status(), StatusCode::ACCEPTED);
|
||||
assert!(response.headers().contains_key("x-request-id"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_return_error_response() {
|
||||
let response = error_response();
|
||||
assert_eq!(response.status(), StatusCode::INTERNAL_SERVER_ERROR);
|
||||
assert_eq!(response.headers().contains_key("x-request-id"), false);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user