Skip to content

Commit

Permalink
Removing admin route test
Browse files Browse the repository at this point in the history
  • Loading branch information
sagojez committed Apr 22, 2024
1 parent 0bac44a commit d933ffe
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 70 deletions.
62 changes: 1 addition & 61 deletions api/tests/api_tests/auth_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use http::{
};
use serde_json::{json, Value};

use super::test_server::{ApiResponse, TestServer, AUTH_PATHS, PUBLIC_PATHS};
use super::test_server::{ApiResponse, TestServer, PUBLIC_PATHS};

#[tokio::test]
async fn test_root() {
Expand All @@ -19,66 +19,6 @@ async fn test_root() {
assert_eq!(res.code, StatusCode::OK);
}

#[tokio::test]
async fn test_authorized() {
let server = TestServer::new(false, None).await;

for path in AUTH_PATHS {
let res = server
.send_request::<Value, Value>(&format!("v1/{path}"), Method::GET, None, None)
.await
.unwrap();
assert_eq!(
res,
ApiResponse {
code: StatusCode::UNAUTHORIZED,
data: json!({"error": "Unauthorized"})
}
);

let res = server
.send_request::<Value, Value>(
&format!("v1/{path}"),
Method::GET,
Some("invalid_access_key"),
None,
)
.await
.unwrap();
assert_eq!(
res,
ApiResponse {
code: StatusCode::UNAUTHORIZED,
data: json!({"error": "Unauthorized"})
}
);

let res = server
.send_request::<Value, Value>(
&format!("v1/{path}"),
Method::GET,
Some(&server.live_key),
None,
)
.await
.unwrap();

assert_eq!(res.code, StatusCode::OK);

let res = server
.send_request::<Value, Value>(
&format!("v1/{path}"),
Method::GET,
Some(&server.test_key),
None,
)
.await
.unwrap();

assert_eq!(res.code, StatusCode::OK);
}
}

#[tokio::test]
async fn test_unauthorized() {
let server = TestServer::new(false, None).await;
Expand Down
9 changes: 0 additions & 9 deletions api/tests/api_tests/test_server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,6 @@ pub mod test_core;
#[cfg(test)]
pub mod test_gateway;

#[allow(dead_code)]
pub const AUTH_PATHS: &[&str] = &[
"pipelines",
"events",
"transactions",
"connections",
"event-access",
];

#[allow(dead_code)]
pub const PUBLIC_PATHS: &[&str] = &["connection-definitions", "openapi"];

Expand Down

0 comments on commit d933ffe

Please sign in to comment.