()
| 181 | |
| 182 | #[actix_web::test] |
| 183 | async fn handle_post_3_unit_test() { |
| 184 | let req = TestRequest::default().to_http_request(); |
| 185 | let params = Form(MyParams { |
| 186 | name: "John".to_owned(), |
| 187 | }); |
| 188 | let result = handle_post_3(req.clone(), params).await; |
| 189 | let resp = result.respond_to(&req); |
| 190 | assert_eq!(resp.status(), StatusCode::OK); |
| 191 | assert_eq!( |
| 192 | resp.headers().get(CONTENT_TYPE).unwrap(), |
| 193 | HeaderValue::from_static("text/plain") |
| 194 | ); |
| 195 | let body = match to_bytes(resp.into_body()).await { |
| 196 | Ok(x) => x, |
| 197 | _ => panic!(), |
| 198 | }; |
| 199 | assert_eq!(body.as_str(), "Your name is John"); |
| 200 | } |
| 201 | |
| 202 | #[actix_web::test] |
| 203 | async fn handle_post_3_integration_test() { |
nothing calls this directly
no test coverage detected