Expand description
Framework-style test harness for Sova.
SqliteTestDb— tempfile sqlite + migrateTestApp— App bootstrap with Db + plugins- [
ActingAs] — inject auth / notification user on [TestClient] ResponseAssert/assert_json_snapshot— uniform response checks
ⓘ
use sova_testing::{ActingAs, ResponseAssert, TestApp, assert_json_snapshot};
let (_db, app) = TestApp::builder()
.migrator::<NotificationsMigrator>()
.install(Notifications::new().mount("/notifications"))
.build()
.await;
let c = TestClient::tracked(app).unwrap();
c.acting_as_id(1);
let res = c.get("/notifications").await;
res.assert_status(200);
assert_json_snapshot!("inbox", res.json_value());Macros§
- assert_
json_ snapshot - Assert JSON snapshot with common redactions (
id, timestamps).
Structs§
- Sqlite
Test Db - Isolated sqlite file + URL. Keeps
TempDiralive for the test duration. - TestApp
- Fluent bootstrap: migrate sqlite, install
Db+ plugins,run_startup. - Test
AppBuilder
Traits§
- Response
Assert - Fluent assertions for HTTP responses in tests.
Functions§
- apply_
migrations - Run each migration’s
upwithout sea-orm’s version tracker. - with_
json_ redactions - Redact volatile fields commonly present in API JSON.