Files
nym/nym-api/tests/public-api/api_status.rs
T
Jędrzej Stuczyński e95aca715c feat: use ShutdownToken (CancellationToken inside) for nym-api (#5997)
* make nym-api use ShutdownToken instead of TaskClient

* ignore public-api tests if env is not set

* removed default features to avoid pulling in openssl
2025-09-08 09:45:28 +01:00

43 lines
1.2 KiB
Rust

use crate::utils::{base_url, make_request, validate_json_response};
#[tokio::test]
#[test_with::env(NYM_API)]
async fn test_health() -> Result<(), String> {
let url = format!("{}/v1/api-status/health", base_url()?);
let res = make_request(&url).await?;
let json = validate_json_response(res).await?;
assert_eq!(json["status"], "up", "Expected status is 'up'");
Ok(())
}
#[tokio::test]
#[test_with::env(NYM_API)]
async fn test_build_information() -> Result<(), String> {
let url = format!("{}/v1/api-status/build-information", base_url()?);
let res = make_request(&url).await?;
let json = validate_json_response(res).await?;
assert!(
json.get("build_version").is_some(),
"Expected a value for 'build_version'"
);
Ok(())
}
// ECASH API Test
/*
#[tokio::test]
async fn test_signer_information() -> Result<(), String> {
let url = format!("{}/v1/api-status/signer-information", base_url()?);
let res = make_request(&url).await?;
let json = validate_json_response(res).await?;
assert!(
json.get("signer_address").is_some(),
"Expected a value for 'signer_address'"
);
Ok(())
}
*/