Skip to content

Commit 298c4b7

Browse files
committed
test(contracts): standardize test event payloads with JSON fixtures
Align event fixture values (address number 111, seller "John Doe") to match other runtimes. Remove unused create_contract_invalid_1.json. Update helper seed data and inline test data to use consistent values.
1 parent 6fe4634 commit 298c4b7

5 files changed

Lines changed: 11 additions & 16 deletions

File tree

unicorn_contracts/tests/unit/events/create_contract_invalid_1.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

unicorn_contracts/tests/unit/events/create_contract_valid_1.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"country": "USA",
44
"city": "Anytown",
55
"street": "Main Street",
6-
"number": 123
6+
"number": 111
77
},
8-
"seller_name": "John Smith",
9-
"property_id": "usa/anytown/main-street/123"
8+
"seller_name": "John Doe",
9+
"property_id": "usa/anytown/main-street/111"
1010
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"property_id": "usa/anytown/main-street/123"
2+
"property_id": "usa/anytown/main-street/111"
33
}

unicorn_contracts/tests/unit/helper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ def create_ddb_table_contracts_with_entry(dynamodb):
6161
)
6262
table.meta.client.get_waiter("table_exists").wait(TableName=TABLE_NAME)
6363
contract = {
64-
"property_id": "usa/anytown/main-street/123", # PK
64+
"property_id": "usa/anytown/main-street/111", # PK
6565
"contract_created": "01/08/2022 20:36:30",
6666
"contract_last_modified_on": "01/08/2022 20:36:30",
6767
"contract_id": "11111111",
68-
"address": {"country": "USA", "city": "Anytown", "street": "Main Street", "number": 123},
69-
"seller_name": "John Smith",
68+
"address": {"country": "USA", "city": "Anytown", "street": "Main Street", "number": 111},
69+
"seller_name": "John Doe",
7070
"contract_status": "DRAFT",
7171
}
7272
table.put_item(Item=contract)

unicorn_contracts/tests/unit/test_contract_event_handler.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def test_create_contract_already_exists(dynamodb, sqs, lambda_context):
7474
create_ddb_table_contracts_with_entry(dynamodb)
7575
create_test_sqs_ingestion_queue(sqs)
7676

77-
# Contract for property_id "usa/anytown/main-street/123" already exists in DRAFT status;
77+
# Contract for property_id "usa/anytown/main-street/111" already exists in DRAFT status;
7878
# ConditionalCheckFailedException is caught and logged, not raised.
7979
contract_event_handler.lambda_handler(event, lambda_context)
8080

@@ -98,12 +98,12 @@ def test_update_contract_not_in_draft(dynamodb, sqs, lambda_context):
9898
create_test_sqs_ingestion_queue(sqs)
9999
table.put_item(
100100
Item={
101-
"property_id": "usa/anytown/main-street/123",
101+
"property_id": "usa/anytown/main-street/111",
102102
"contract_created": "01/08/2022 20:36:30",
103103
"contract_last_modified_on": "01/08/2022 20:36:30",
104104
"contract_id": "11111111",
105-
"address": {"country": "USA", "city": "Anytown", "street": "Main Street", "number": 123},
106-
"seller_name": "John Smith",
105+
"address": {"country": "USA", "city": "Anytown", "street": "Main Street", "number": 111},
106+
"seller_name": "John Doe",
107107
"contract_status": "APPROVED",
108108
}
109109
)

0 commit comments

Comments
 (0)