()
| 621 | |
| 622 | #[tokio::test] |
| 623 | async fn test_error_response() -> Result<(), Error> { |
| 624 | let diagnostic = Diagnostic { |
| 625 | error_type: "InvalidEventDataError".into(), |
| 626 | error_message: "Error parsing event data".into(), |
| 627 | }; |
| 628 | let body = serde_json::to_string(&diagnostic)?; |
| 629 | |
| 630 | let server = MockServer::start(); |
| 631 | let mock = server.mock(|when, then| { |
| 632 | when.method(POST) |
| 633 | .path("/2018-06-01/runtime/invocation/156cb537-e2d4-11e8-9b34-d36013741fb9/error") |
| 634 | .header("lambda-runtime-function-error-type", "unhandled") |
| 635 | .body(body); |
| 636 | then.status(200).body(""); |
| 637 | }); |
| 638 | |
| 639 | let base = server.base_url().parse().expect("Invalid mock server Uri"); |
| 640 | let client = Client::builder().with_endpoint(base).build()?; |
| 641 | |
| 642 | let req = EventErrorRequest { |
| 643 | request_id: "156cb537-e2d4-11e8-9b34-d36013741fb9", |
| 644 | diagnostic, |
| 645 | }; |
| 646 | let req = req.into_req()?; |
| 647 | let rsp = client.call(req).await?; |
| 648 | |
| 649 | mock.assert_async().await; |
| 650 | assert_eq!(rsp.status(), StatusCode::OK); |
| 651 | Ok(()) |
| 652 | } |
| 653 | |
| 654 | #[tokio::test] |
| 655 | async fn successful_end_to_end_run() -> Result<(), Error> { |
nothing calls this directly
no test coverage detected