allow deprecated App::data(_factory) in tests

This commit is contained in:
Rob Ede 2021-06-20 14:33:39 +01:00
parent 8ad9257684
commit 823a3104b9
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
10 changed files with 30 additions and 0 deletions

View File

@ -523,6 +523,8 @@ mod tests {
assert_eq!(resp.status(), StatusCode::CREATED);
}
// allow deprecated App::data
#[allow(deprecated)]
#[actix_rt::test]
async fn test_data_factory() {
let srv = init_service(
@ -546,6 +548,8 @@ mod tests {
assert_eq!(resp.status(), StatusCode::INTERNAL_SERVER_ERROR);
}
// allow deprecated App::data
#[allow(deprecated)]
#[actix_rt::test]
async fn test_data_factory_errors() {
let srv = try_init_service(

View File

@ -349,6 +349,8 @@ mod tests {
}
}
// allow deprecated App::data
#[allow(deprecated)]
#[actix_rt::test]
async fn test_drop_data() {
let data = Arc::new(AtomicBool::new(false));

View File

@ -154,6 +154,8 @@ mod tests {
web, App, HttpResponse,
};
// allow deprecated App::data
#[allow(deprecated)]
#[actix_rt::test]
async fn test_data_extractor() {
let srv = init_service(App::new().data("TEST".to_string()).service(
@ -221,6 +223,8 @@ mod tests {
assert_eq!(resp.status(), StatusCode::INTERNAL_SERVER_ERROR);
}
// allow deprecated App::data
#[allow(deprecated)]
#[actix_rt::test]
async fn test_route_data_extractor() {
let srv = init_service(
@ -250,6 +254,8 @@ mod tests {
assert_eq!(resp.status(), StatusCode::INTERNAL_SERVER_ERROR);
}
// allow deprecated App::data
#[allow(deprecated)]
#[actix_rt::test]
async fn test_override_data() {
let srv =

View File

@ -711,6 +711,8 @@ mod tests {
assert_eq!(body, Bytes::from_static(b"1"));
}
// allow deprecated App::data
#[allow(deprecated)]
#[actix_rt::test]
async fn test_extensions_dropped() {
struct Tracker {

View File

@ -695,6 +695,8 @@ mod tests {
assert_eq!(resp.status(), StatusCode::NO_CONTENT);
}
// allow deprecated App::data
#[allow(deprecated)]
#[actix_rt::test]
async fn test_data() {
let srv = init_service(
@ -727,6 +729,8 @@ mod tests {
assert_eq!(resp.status(), StatusCode::OK);
}
// allow deprecated App::data
#[allow(deprecated)]
#[actix_rt::test]
async fn test_data_default_service() {
let srv = init_service(

View File

@ -991,6 +991,8 @@ mod tests {
);
}
// allow deprecated App::data
#[allow(deprecated)]
#[actix_rt::test]
async fn test_override_data() {
let srv = init_service(App::new().data(1usize).service(
@ -1009,6 +1011,8 @@ mod tests {
assert_eq!(resp.status(), StatusCode::OK);
}
// allow deprecated App::data
#[allow(deprecated)]
#[actix_rt::test]
async fn test_override_data_default_service() {
let srv = init_service(App::new().data(1usize).service(

View File

@ -649,6 +649,8 @@ mod tests {
assert_eq!(resp.status(), http::StatusCode::NOT_FOUND);
}
// allow deprecated App::data
#[allow(deprecated)]
#[actix_rt::test]
async fn test_service_data() {
let srv =

View File

@ -839,6 +839,8 @@ mod tests {
assert!(res.status().is_success());
}
// allow deprecated App::data
#[allow(deprecated)]
#[actix_rt::test]
async fn test_server_data() {
async fn handler(data: web::Data<usize>) -> impl Responder {

View File

@ -398,6 +398,8 @@ mod tests {
assert!(cfg.check_mimetype(&req).is_ok());
}
// allow deprecated App::data
#[allow(deprecated)]
#[actix_rt::test]
async fn test_config_recall_locations() {
async fn bytes_handler(_: Bytes) -> impl Responder {

View File

@ -1028,6 +1028,8 @@ async fn test_normalize() {
assert!(response.status().is_success());
}
// allow deprecated App::data
#[allow(deprecated)]
#[actix_rt::test]
async fn test_data_drop() {
use std::sync::{