mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-26 15:07:42 +02:00
migrate integration testing to new crate (#2112)
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
use actix_web::{Responder, HttpResponse, App, test};
|
||||
use actix_web::{Responder, HttpResponse, App};
|
||||
use actix_web_codegen::*;
|
||||
|
||||
/// Docstrings shouldn't break anything.
|
||||
/// doc comments shouldn't break anything
|
||||
#[get("/")]
|
||||
async fn index() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
@ -9,7 +9,7 @@ async fn index() -> impl Responder {
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() {
|
||||
let srv = test::start(|| App::new().service(index));
|
||||
let srv = actix_test::start(|| App::new().service(index));
|
||||
|
||||
let request = srv.get("/");
|
||||
let response = request.send().await.unwrap();
|
||||
|
@ -7,9 +7,9 @@ async fn index() -> String {
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() {
|
||||
use actix_web::{App, test};
|
||||
use actix_web::App;
|
||||
|
||||
let srv = test::start(|| App::new().service(index));
|
||||
let srv = actix_test::start(|| App::new().service(index));
|
||||
|
||||
let request = srv.get("/");
|
||||
let response = request.send().await.unwrap();
|
||||
|
@ -5,7 +5,7 @@ error: HTTP method defined more than once: `GET`
|
||||
| ^^^^^
|
||||
|
||||
error[E0425]: cannot find value `index` in this scope
|
||||
--> $DIR/route-duplicate-method-fail.rs:12:49
|
||||
--> $DIR/route-duplicate-method-fail.rs:12:55
|
||||
|
|
||||
12 | let srv = test::start(|| App::new().service(index));
|
||||
| ^^^^^ not found in this scope
|
||||
12 | let srv = actix_test::start(|| App::new().service(index));
|
||||
| ^^^^^ not found in this scope
|
||||
|
@ -7,9 +7,9 @@ async fn index() -> String {
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() {
|
||||
use actix_web::{App, test};
|
||||
use actix_web::App;
|
||||
|
||||
let srv = test::start(|| App::new().service(index));
|
||||
let srv = actix_test::start(|| App::new().service(index));
|
||||
|
||||
let request = srv.get("/");
|
||||
let response = request.send().await.unwrap();
|
||||
|
@ -7,7 +7,7 @@ error: The #[route(..)] macro requires at least one `method` attribute
|
||||
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0425]: cannot find value `index` in this scope
|
||||
--> $DIR/route-missing-method-fail.rs:12:49
|
||||
--> $DIR/route-missing-method-fail.rs:12:55
|
||||
|
|
||||
12 | let srv = test::start(|| App::new().service(index));
|
||||
| ^^^^^ not found in this scope
|
||||
12 | let srv = actix_test::start(|| App::new().service(index));
|
||||
| ^^^^^ not found in this scope
|
||||
|
@ -7,9 +7,9 @@ async fn index() -> String {
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() {
|
||||
use actix_web::{App, test};
|
||||
use actix_web::App;
|
||||
|
||||
let srv = test::start(|| App::new().service(index));
|
||||
let srv = actix_test::start(|| App::new().service(index));
|
||||
|
||||
let request = srv.get("/");
|
||||
let response = request.send().await.unwrap();
|
||||
|
@ -7,9 +7,9 @@ async fn index() -> String {
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() {
|
||||
use actix_web::{App, test};
|
||||
use actix_web::App;
|
||||
|
||||
let srv = test::start(|| App::new().service(index));
|
||||
let srv = actix_test::start(|| App::new().service(index));
|
||||
|
||||
let request = srv.get("/");
|
||||
let response = request.send().await.unwrap();
|
||||
|
@ -5,7 +5,7 @@ error: Unexpected HTTP method: `UNEXPECTED`
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error[E0425]: cannot find value `index` in this scope
|
||||
--> $DIR/route-unexpected-method-fail.rs:12:49
|
||||
--> $DIR/route-unexpected-method-fail.rs:12:55
|
||||
|
|
||||
12 | let srv = test::start(|| App::new().service(index));
|
||||
| ^^^^^ not found in this scope
|
||||
12 | let srv = actix_test::start(|| App::new().service(index));
|
||||
| ^^^^^ not found in this scope
|
||||
|
@ -1,4 +1,4 @@
|
||||
use actix_web::{Responder, HttpResponse, App, test};
|
||||
use actix_web::{Responder, HttpResponse, App};
|
||||
use actix_web_codegen::*;
|
||||
|
||||
#[get("/config")]
|
||||
@ -8,7 +8,7 @@ async fn config() -> impl Responder {
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() {
|
||||
let srv = test::start(|| App::new().service(config));
|
||||
let srv = actix_test::start(|| App::new().service(config));
|
||||
|
||||
let request = srv.get("/config");
|
||||
let response = request.send().await.unwrap();
|
||||
|
Reference in New Issue
Block a user