ciallo-testing

    In-memory fluent TestClient, Cookie Jar, sync_openapi, and mocks for unmbt/ciallo

    testing
    http
    mock
    ciallo
    Download zip
    Author
    Version
    0.1.1
    License
    MIT
    Last updated
    13 hours ago
    Downloads
    8

    #unmbt/ciallo-testing

    In-memory fluent TestClient (with automatic Cookie Jar & Bearer injection) and sync_openapi snapshot drift helper for unmbt/ciallo.

    TestClient

    pub struct TestClient {
    // private fields
    }

    TestClient::TestClient

    TestClient::clear_cookies

    fn TestClient::clear_cookies(self : TestClient) -> Unit

    TestClient::get

    async fn TestClient::get(self : TestClient, path : StringView, headers? :
    Headers
    ) ->
    Response

    TestClient::post_json

    TestClient::with_bearer

    fn TestClient::with_bearer(self : TestClient, token : StringView) -> TestClient

    sync_openapi

    async fn sync_openapi(app :
    App
    , info :
    OpenApiInfo
    , out_path : StringView, check_only? : Bool) -> Unit

    契约快照导出与防陈腐校验辅助器(在 moon test 中落盘 openapi.json 联动 dev_build 生成 ciallo-eden SDK;CI 传 check_only=true 防漂移)

    with_rollback_tx

    #callsite(autofill(loc))
    async fn[R] with_rollback_tx(db :
    Db
    , loc~ : SourceLoc, body : async (
    DbTx
    ) -> R) -> R

    数据库集成测试专用事务自动回滚夹具(借鉴 sqlx::test): 无论测试闭包正常返回、断言失败还是协程取消,均经 defer + protect_from_cancel 强制 ROLLBACK,保证用例间零数据污染