mirror of
https://github.com/pcvolkmer/checkbar.git
synced 2025-07-02 06:22:53 +00:00
Use http crate instead of hyper crate for tests
This commit is contained in:
@ -41,14 +41,13 @@ impl HttpBasedChecker for Checker<'_> {
|
||||
mod tests {
|
||||
use crate::checker::actuator::Checker;
|
||||
use crate::checker::{CheckState, HttpBasedChecker};
|
||||
use hyper::Response as hyper_Response;
|
||||
use reqwest::Response;
|
||||
use serde_json::json;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_should_return_up_state() {
|
||||
let response = Response::from(
|
||||
hyper_Response::builder()
|
||||
http::Response::builder()
|
||||
.status(200)
|
||||
.body(json!({"status":"UP"}).to_string())
|
||||
.unwrap(),
|
||||
@ -61,7 +60,7 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn test_should_return_warn_state_on_status_not_up() {
|
||||
let response = Response::from(
|
||||
hyper_Response::builder()
|
||||
http::Response::builder()
|
||||
.status(200)
|
||||
.body(json!({"status":"DOWN"}).to_string())
|
||||
.unwrap(),
|
||||
@ -74,7 +73,7 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn test_should_return_warn_state_on_response_not_success() {
|
||||
let response = Response::from(
|
||||
hyper_Response::builder()
|
||||
http::Response::builder()
|
||||
.status(404)
|
||||
.body(String::from("Actuator Response Not Found"))
|
||||
.unwrap(),
|
||||
|
@ -33,13 +33,12 @@ impl HttpBasedChecker for Checker<'_> {
|
||||
mod tests {
|
||||
use crate::checker::http::Checker;
|
||||
use crate::checker::{CheckState, HttpBasedChecker};
|
||||
use hyper::Response as hyper_Response;
|
||||
use reqwest::Response;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_should_return_up_state() {
|
||||
let response = Response::from(
|
||||
hyper_Response::builder()
|
||||
http::Response::builder()
|
||||
.status(200)
|
||||
.body("Any response")
|
||||
.unwrap(),
|
||||
@ -52,7 +51,7 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn test_should_return_warn_state_on_response_not_success() {
|
||||
let response = Response::from(
|
||||
hyper_Response::builder()
|
||||
http::Response::builder()
|
||||
.status(404)
|
||||
.body(String::from("Http Response Not Found"))
|
||||
.unwrap(),
|
||||
|
Reference in New Issue
Block a user