armature-testing
Testing utilities for the Armature framework.
Features
- Test Client - HTTP client for testing handlers
- Mock Services - Mock external dependencies
- Fixtures - Database and state fixtures
- Assertions - HTTP response assertions
- Integration Tests - Full application testing
Installation
[]
= "0.1"
Quick Start
use *;
use HttpResponse;
async
Test Client
TestClient is built from a running TestApp (via app.client()) or directly
from an Arc<Router>. Its methods run the request through the router and
resolve immediately — there's no .send() step.
use *;
let client = app.client;
// GET request
let resp = client.get.await;
// POST with a JSON body
let body = to_vec.unwrap;
let resp = client.post.await;
// PUT and PATCH take a body the same way; DELETE takes none
let resp = client.put.await;
let resp = client.delete.await;
// Inspect the response
assert_eq!;
let text: = resp.body_string;
let json: Value = resp.body_json.unwrap;
Assertions
use *;
assert_status;
assert_json;
assert_header;
License
MIT OR Apache-2.0