From 714c0210044c9ae974b5f3ce27306a4aa7682f66 Mon Sep 17 00:00:00 2001 From: Ran Isenberg Date: Sun, 26 Feb 2023 10:44:45 +0200 Subject: [PATCH 1/2] feature: add missing test condition --- tests/integration/test_create_order.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integration/test_create_order.py b/tests/integration/test_create_order.py index cae51461..1e2db1f8 100644 --- a/tests/integration/test_create_order.py +++ b/tests/integration/test_create_order.py @@ -47,7 +47,8 @@ def mock_exception_dynamic_configuration(mocker) -> None: def test_handler_200_ok(mocker, table_name: str): mock_dynamic_configuration(mocker, MOCKED_SCHEMA) customer_name = 'RanTheBuilder' - body = Input(customer_name=customer_name, order_item_count=5, tier='premium') + order_item_count = 5 + body = Input(customer_name=customer_name, order_item_count=order_item_count, tier='premium') response = create_order(generate_api_gw_event(body.dict()), generate_context()) # assert response assert response['statusCode'] == HTTPStatus.OK @@ -60,6 +61,7 @@ def test_handler_200_ok(mocker, table_name: str): response = dynamodb_table.get_item(Key={'order_id': body_dict['order_id']}) assert 'Item' in response # order was found assert response['Item']['customer_name'] == customer_name + assert response['Item']['order_item_count'] == order_item_count def test_internal_server_error(mocker): From 3e4b8d3e3232683781abc963a0e957be4b65198b Mon Sep 17 00:00:00 2001 From: Ran Isenberg Date: Sun, 26 Feb 2023 17:00:27 +0200 Subject: [PATCH 2/2] a --- tests/infrastructure/test_cdk.py | 1 + tests/integration/test_create_order.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/infrastructure/test_cdk.py b/tests/infrastructure/test_cdk.py index 7b676072..d2242c89 100644 --- a/tests/infrastructure/test_cdk.py +++ b/tests/infrastructure/test_cdk.py @@ -14,3 +14,4 @@ def test_synthesizes_properly(): # verify that we have one API GW, that is it not deleted by mistake template.resource_count_is('AWS::ApiGateway::RestApi', 1) + template.resource_count_is('AWS::DynamoDB::Table', 1) diff --git a/tests/integration/test_create_order.py b/tests/integration/test_create_order.py index 1e2db1f8..23241271 100644 --- a/tests/integration/test_create_order.py +++ b/tests/integration/test_create_order.py @@ -61,7 +61,7 @@ def test_handler_200_ok(mocker, table_name: str): response = dynamodb_table.get_item(Key={'order_id': body_dict['order_id']}) assert 'Item' in response # order was found assert response['Item']['customer_name'] == customer_name - assert response['Item']['order_item_count'] == order_item_count + assert response['Item']['count'] == order_item_count def test_internal_server_error(mocker):