diff --git a/entity/src/wrappers/bna_pipeline.rs b/entity/src/wrappers/bna_pipeline.rs index e7dda31..8fa4a57 100644 --- a/entity/src/wrappers/bna_pipeline.rs +++ b/entity/src/wrappers/bna_pipeline.rs @@ -16,7 +16,6 @@ pub struct BNAPipelinePost { pub sqs_message: Option, pub start_time: TimeDateTimeWithTimeZone, pub state_machine_id: Uuid, - pub status: String, pub step: Option, pub torn_down: Option, } @@ -33,7 +32,7 @@ impl IntoActiveModel for BNAPipelinePost { sqs_message: ActiveValue::Set(self.sqs_message), start_time: ActiveValue::Set(self.start_time), state_machine_id: ActiveValue::Set(self.state_machine_id), - status: ActiveValue::Set(self.status), + status: ActiveValue::Set("Pending".to_string()), step: ActiveValue::Set(self.step), torn_down: ActiveValue::Set(self.torn_down), } diff --git a/lambdas/src/ratings/post-ratings-analysis.rs b/lambdas/src/ratings/post-ratings-analysis.rs index b77a80d..4c17e5e 100644 --- a/lambdas/src/ratings/post-ratings-analysis.rs +++ b/lambdas/src/ratings/post-ratings-analysis.rs @@ -46,3 +46,50 @@ async fn main() -> Result<(), Error> { e }) } + +#[cfg(test)] +mod tests { + + use super::*; + use aws_lambda_events::http; + use lambda_http::RequestExt; + + #[tokio::test] + async fn test_handler_all() { + let event = http::Request::builder() + .header(http::header::CONTENT_TYPE, "application/json") + .body(Body::Text( + r#"{ + "cost": null, + "end_time": null, + "fargate_price_id": null, + "fargate_task_arn": null, + "result_posted": null, + "s3_bucket": null, + "sqs_message": null, + "start_time": [ + 2024, + 247, + 13, + 7, + 29, + 922293000, + 0, + 0, + 0 + ], + "state_machine_id": "fc009967-c4d0-416b-baee-93708ac80cbc", + "status": null, + "step": "Analysis", + "torn_down": null + }"# + .to_string(), + )) + .expect("failed to build request") + .with_request_context(lambda_http::request::RequestContext::ApiGatewayV2( + lambda_http::aws_lambda_events::apigw::ApiGatewayV2httpRequestContext::default(), + )); + let r = function_handler(event).await; + let _var_name = dbg!(r); + } +}