#actix #test

testax

用于测试 actix 的 GET/POST/UPDATE/DELETE 的 Crate

5 个不稳定版本

0.3.0 2020 年 9 月 25 日
0.2.0 2020 年 5 月 17 日
0.1.2 2020 年 5 月 16 日
0.1.1 2020 年 5 月 11 日
0.1.0 2020 年 5 月 10 日

#700测试

MIT 许可证

9KB
103

TestAx

Build Status Documentation

用于测试基本 actix GET/POST/UPDATE/DELETE 的简单 Crate

[dev-dependencies]
testax = "0.1"

待办事项

  • GET
  • POST
  • UPDATE
  • DELETE
  • 通用?

最小示例

async fn index(info: web::Path<(u32, String)>) -> impl Responder {
    format!("Hello {}! id:{}", info.1, info.0)
}

#[actix_rt::test]
async fn test_minimal() {
    let mut app = test::init_service(App::new().service(index)).await;

    let resp = get(&mut app, "/32/Filip").await;
    assert_eq!(resp.status.as_u16(), 200);
    assert_eq!(resp.body, "Hello Filip! id:32");
}

依赖项

~27MB
~581K SLoC