| Crates.io | armature-testing |
| lib.rs | armature-testing |
| version | 0.1.2 |
| created_at | 2025-12-27 02:04:43.827305+00 |
| updated_at | 2025-12-30 22:34:32.914395+00 |
| description | Testing utilities for Armature applications |
| homepage | https://pegasusheavy.github.io/armature |
| repository | https://github.com/pegasusheavy/armature |
| max_upload_size | |
| id | 2006574 |
| size | 130,054 |
Testing utilities for the Armature framework.
[dev-dependencies]
armature-testing = "0.1"
use armature_testing::{TestClient, assert_status};
#[tokio::test]
async fn test_hello_endpoint() {
let app = create_test_app();
let client = TestClient::new(app);
let response = client.get("/hello").send().await;
assert_status!(response, 200);
assert_eq!(response.text().await, "Hello, World!");
}
let client = TestClient::new(app);
// GET request
let resp = client.get("/users").send().await;
// POST with JSON
let resp = client.post("/users")
.json(&user)
.send()
.await;
// With headers
let resp = client.get("/api/data")
.header("Authorization", "Bearer token")
.send()
.await;
assert_status!(response, 200);
assert_json!(response, {"id": 1, "name": "Test"});
assert_header!(response, "Content-Type", "application/json");
MIT OR Apache-2.0