From e495e1d3a7e0b687d8bcb305fd6f711703dd2f4b Mon Sep 17 00:00:00 2001 From: SIMRAN MAKHIJA Date: Thu, 2 May 2024 01:26:23 -0400 Subject: [PATCH] cleanup --- src/tests/mod.rs | 1 - src/tests/namespace_test.rs | 43 ------------------------------------- 2 files changed, 44 deletions(-) delete mode 100644 src/tests/mod.rs delete mode 100644 src/tests/namespace_test.rs diff --git a/src/tests/mod.rs b/src/tests/mod.rs deleted file mode 100644 index 8b13789..0000000 --- a/src/tests/mod.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/tests/namespace_test.rs b/src/tests/namespace_test.rs deleted file mode 100644 index 3e6e447..0000000 --- a/src/tests/namespace_test.rs +++ /dev/null @@ -1,43 +0,0 @@ -use axum::{http::StatusCode, response::Json}; -use axum::extract::Json as JsonExtractor; -use axum::handler::post; -use axum::routing::Router; -use serde_json::json; -use axum::test::extract; - -use crate::{create_namespace, list_namespaces, Namespace}; - -#[tokio::test] -async fn test_list_namespaces() { - // Create a test router with the list_namespaces route - let app = Router::new().route("/namespaces", post(list_namespaces)); - - // Perform a request to the route - let response = axum::test::call(&app, axum::test::request::Request::post("/namespaces").body(()).unwrap()).await; - - // Ensure that the response status code is OK - assert_eq!(response.status(), StatusCode::OK); - - // Ensure that the response body contains the expected JSON data - let body = extract::>>(response.into_body()).await.unwrap(); - assert_eq!(body.0, vec!["accounting", "tax", "paid"]); -} - -#[tokio::test] -async fn test_create_namespace() { - // Create a test router with the create_namespace route - let app = Router::new().route("/namespaces", post(create_namespace)); - - // Create a JSON payload representing a new namespace - let payload = json!({}); - - // Perform a request to the route with the JSON payload - let response = axum::test::call(&app, axum::test::request::Request::post("/namespaces").body(payload.to_string()).unwrap()).await; - - // Ensure that the response status code is OK - assert_eq!(response.status(), StatusCode::OK); - - // Ensure that the response body contains the expected JSON data - let body = extract::>(response.into_body()).await.unwrap(); - assert_eq!(body, Json(Namespace {})); -}