Skip to content

Commit 04d3433

Browse files
tiurincloutierMat
andcommitted
Remove region and account from context object ARNs
They are not affecting the functionality being tested. Removing them simplifies test setup. Co-authored-by: Mathieu Cloutier <[email protected]>
1 parent 0eedd60 commit 04d3433

File tree

3 files changed

+74
-92
lines changed

3 files changed

+74
-92
lines changed

tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.py

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
_CONTEXT_OBJECT_FULL: Final[dict] = {
2121
"Execution": {
22-
"Id": "arn:aws:states:__region_placeholder__:__account_id_placeholder__:execution:MyStateMachine:execution-name-12345",
22+
"Id": "arn:aws:states:::execution:MyStateMachine:execution-name-12345",
2323
"Input": {
2424
"input-value": 0,
2525
"message": "test data",
2626
"values": ["charizard", "pikachu", "bulbasaur"],
2727
},
2828
"Name": "execution-name-12345",
29-
"RoleArn": "arn:aws:iam::__account_id_placeholder__:role/StepFunctionsRole",
29+
"RoleArn": "arn:aws:iam:::role/StepFunctionsRole",
3030
"StartTime": "2025-01-15T10:30:00.000Z",
3131
},
3232
"State": {
@@ -35,7 +35,7 @@
3535
"RetryCount": 0,
3636
},
3737
"StateMachine": {
38-
"Id": "arn:aws:states:__region_placeholder__:__account_id_placeholder__:stateMachine:MyStateMachine",
38+
"Id": "arn:aws:states:::stateMachine:MyStateMachine",
3939
"Name": "MyStateMachine",
4040
},
4141
# Context object contains 'Task' when state is not a Task state with a '.sync' or '.waitForTaskToken' service integration pattern
@@ -67,8 +67,6 @@ class TestStateContextObject:
6767
def test_state_task_context_object(
6868
self,
6969
aws_client_no_sync_prefix,
70-
region_name,
71-
account_id,
7270
sfn_snapshot,
7371
context_object_literal,
7472
):
@@ -88,15 +86,11 @@ def test_state_task_context_object(
8886
)
8987
mocked_result = json.dumps({"pokemon": ["charizard", "pikachu", "bulbasaur"]})
9088

91-
context_object_full = CONTEXT_OBJECT_FULL.replace(
92-
"__region_placeholder__", region_name
93-
).replace("__account_id_placeholder__", account_id)
94-
9589
test_case_response = aws_client_no_sync_prefix.stepfunctions.test_state(
9690
definition=definition,
9791
input=exec_input,
9892
inspectionLevel=InspectionLevel.TRACE,
99-
context=context_object_full,
93+
context=CONTEXT_OBJECT_FULL,
10094
mock={"result": mocked_result},
10195
)
10296
sfn_snapshot.match("test_case_response", test_case_response)
@@ -105,8 +99,6 @@ def test_state_task_context_object(
10599
def test_state_wait_task_context_object(
106100
self,
107101
aws_client_no_sync_prefix,
108-
region_name,
109-
account_id,
110102
sfn_snapshot,
111103
):
112104
state_template = TST.load_sfn_template(
@@ -116,14 +108,10 @@ def test_state_wait_task_context_object(
116108
definition = json.dumps(state_template)
117109
mocked_result = json.dumps({"pokemon": ["charizard", "pikachu", "bulbasaur"]})
118110

119-
task_context_object_full = TASK_CONTEXT_OBJECT_FULL.replace(
120-
"__region_placeholder__", region_name
121-
).replace("__account_id_placeholder__", account_id)
122-
123111
test_case_response = aws_client_no_sync_prefix.stepfunctions.test_state(
124112
definition=definition,
125113
inspectionLevel=InspectionLevel.TRACE,
126-
context=task_context_object_full,
114+
context=TASK_CONTEXT_OBJECT_FULL,
127115
mock={"result": mocked_result},
128116
)
129117
sfn_snapshot.match("test_case_response", test_case_response)
@@ -138,8 +126,6 @@ def test_state_wait_task_context_object(
138126
def test_state_map_context_object(
139127
self,
140128
aws_client_no_sync_prefix,
141-
region_name,
142-
account_id,
143129
sfn_snapshot,
144130
context_object_literal,
145131
):
@@ -157,15 +143,11 @@ def test_state_map_context_object(
157143
exec_input = json.dumps(["fire", "electricity", "grass"])
158144
mocked_result = json.dumps(["CHARIZARD", "PIKACHU", "BULBASAUR"])
159145

160-
context_object_full = CONTEXT_OBJECT_FULL.replace(
161-
"__region_placeholder__", region_name
162-
).replace("__account_id_placeholder__", account_id)
163-
164146
test_case_response = aws_client_no_sync_prefix.stepfunctions.test_state(
165147
definition=definition,
166148
input=exec_input,
167149
inspectionLevel=InspectionLevel.TRACE,
168-
context=context_object_full,
150+
context=CONTEXT_OBJECT_FULL,
169151
mock={"result": mocked_result},
170152
)
171153
sfn_snapshot.match("test_case_response", test_case_response)

tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.snapshot.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.py::TestStateContextObject::test_state_task_context_object[ALL]": {
3-
"recorded-date": "03-12-2025, 12:32:47",
3+
"recorded-date": "03-12-2025, 18:51:48",
44
"recorded-content": {
55
"test_case_response": {
66
"inspectionData": {
@@ -24,7 +24,7 @@
2424
"afterResultPath": {
2525
"ContextObjectValue": {
2626
"Execution": {
27-
"Id": "arn:<partition>:states:<region>:111111111111:execution:MyStateMachine:execution-name-12345",
27+
"Id": "arn:<partition>:states:::execution:MyStateMachine:execution-name-12345",
2828
"Input": {
2929
"input-value": 0,
3030
"message": "test data",
@@ -35,7 +35,7 @@
3535
]
3636
},
3737
"Name": "execution-name-12345",
38-
"RoleArn": "arn:<partition>:iam::111111111111:role/StepFunctionsRole",
38+
"RoleArn": "arn:<partition>:iam:::role/StepFunctionsRole",
3939
"StartTime": "date"
4040
},
4141
"State": {
@@ -44,7 +44,7 @@
4444
"RetryCount": 0
4545
},
4646
"StateMachine": {
47-
"Id": "arn:<partition>:states:<region>:111111111111:stateMachine:MyStateMachine",
47+
"Id": "arn:<partition>:states:::stateMachine:MyStateMachine",
4848
"Name": "MyStateMachine"
4949
}
5050
},
@@ -59,7 +59,7 @@
5959
"afterResultSelector": {
6060
"ContextObjectValue": {
6161
"Execution": {
62-
"Id": "arn:<partition>:states:<region>:111111111111:execution:MyStateMachine:execution-name-12345",
62+
"Id": "arn:<partition>:states:::execution:MyStateMachine:execution-name-12345",
6363
"Input": {
6464
"input-value": 0,
6565
"message": "test data",
@@ -70,7 +70,7 @@
7070
]
7171
},
7272
"Name": "execution-name-12345",
73-
"RoleArn": "arn:<partition>:iam::111111111111:role/StepFunctionsRole",
73+
"RoleArn": "arn:<partition>:iam:::role/StepFunctionsRole",
7474
"StartTime": "date"
7575
},
7676
"State": {
@@ -79,7 +79,7 @@
7979
"RetryCount": 0
8080
},
8181
"StateMachine": {
82-
"Id": "arn:<partition>:states:<region>:111111111111:stateMachine:MyStateMachine",
82+
"Id": "arn:<partition>:states:::stateMachine:MyStateMachine",
8383
"Name": "MyStateMachine"
8484
}
8585
},
@@ -108,7 +108,7 @@
108108
"output": {
109109
"ContextObjectValue": {
110110
"Execution": {
111-
"Id": "arn:<partition>:states:<region>:111111111111:execution:MyStateMachine:execution-name-12345",
111+
"Id": "arn:<partition>:states:::execution:MyStateMachine:execution-name-12345",
112112
"Input": {
113113
"input-value": 0,
114114
"message": "test data",
@@ -119,7 +119,7 @@
119119
]
120120
},
121121
"Name": "execution-name-12345",
122-
"RoleArn": "arn:<partition>:iam::111111111111:role/StepFunctionsRole",
122+
"RoleArn": "arn:<partition>:iam:::role/StepFunctionsRole",
123123
"StartTime": "date"
124124
},
125125
"State": {
@@ -128,7 +128,7 @@
128128
"RetryCount": 0
129129
},
130130
"StateMachine": {
131-
"Id": "arn:<partition>:states:<region>:111111111111:stateMachine:MyStateMachine",
131+
"Id": "arn:<partition>:states:::stateMachine:MyStateMachine",
132132
"Name": "MyStateMachine"
133133
}
134134
},
@@ -149,7 +149,7 @@
149149
}
150150
},
151151
"tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.py::TestStateContextObject::test_state_task_context_object[EXECUTION_INPUT]": {
152-
"recorded-date": "03-12-2025, 12:32:47",
152+
"recorded-date": "03-12-2025, 18:51:48",
153153
"recorded-content": {
154154
"test_case_response": {
155155
"inspectionData": {
@@ -247,7 +247,7 @@
247247
}
248248
},
249249
"tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.py::TestStateContextObject::test_state_task_context_object[EXECUTION_INPUT_VALUES]": {
250-
"recorded-date": "03-12-2025, 12:32:47",
250+
"recorded-date": "03-12-2025, 18:51:49",
251251
"recorded-content": {
252252
"test_case_response": {
253253
"inspectionData": {
@@ -333,7 +333,7 @@
333333
}
334334
},
335335
"tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.py::TestStateContextObject::test_state_wait_task_context_object": {
336-
"recorded-date": "03-12-2025, 12:32:47",
336+
"recorded-date": "03-12-2025, 18:51:49",
337337
"recorded-content": {
338338
"test_case_response": {
339339
"inspectionData": {
@@ -389,7 +389,7 @@
389389
}
390390
},
391391
"tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.py::TestStateContextObject::test_state_map_context_object[ALL]": {
392-
"recorded-date": "03-12-2025, 12:32:47",
392+
"recorded-date": "03-12-2025, 18:51:49",
393393
"recorded-content": {
394394
"test_case_response": {
395395
"cause": "Reference path \"$\" must point to array.",
@@ -407,7 +407,7 @@
407407
}
408408
},
409409
"tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.py::TestStateContextObject::test_state_map_context_object[EXECUTION_INPUT]": {
410-
"recorded-date": "03-12-2025, 12:32:48",
410+
"recorded-date": "03-12-2025, 18:51:49",
411411
"recorded-content": {
412412
"test_case_response": {
413413
"cause": "Reference path \"$.Execution.Input\" must point to array.",
@@ -425,7 +425,7 @@
425425
}
426426
},
427427
"tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.py::TestStateContextObject::test_state_map_context_object[EXECUTION_INPUT_VALUES]": {
428-
"recorded-date": "03-12-2025, 12:32:48",
428+
"recorded-date": "03-12-2025, 18:51:49",
429429
"recorded-content": {
430430
"test_case_response": {
431431
"inspectionData": {
@@ -446,7 +446,7 @@
446446
}
447447
},
448448
"tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.py::TestStateContextObject::test_state_context_object_invalid_states[TOKEN_TASK_NOT_SYNC]": {
449-
"recorded-date": "03-12-2025, 12:32:48",
449+
"recorded-date": "03-12-2025, 18:51:50",
450450
"recorded-content": {
451451
"exception": {
452452
"exception_typename": "ValidationException",
@@ -455,7 +455,7 @@
455455
}
456456
},
457457
"tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.py::TestStateContextObject::test_state_context_object_invalid_states[INVALID_STATE_PASS]": {
458-
"recorded-date": "03-12-2025, 12:32:48",
458+
"recorded-date": "03-12-2025, 18:51:50",
459459
"recorded-content": {
460460
"exception": {
461461
"exception_typename": "ValidationException",
@@ -464,7 +464,7 @@
464464
}
465465
},
466466
"tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.py::TestStateContextObject::test_state_context_object_validation_failures[INVALID_EXECUTION_ID_TYPE]": {
467-
"recorded-date": "03-12-2025, 12:32:48",
467+
"recorded-date": "03-12-2025, 18:51:50",
468468
"recorded-content": {
469469
"exception": {
470470
"exception_typename": "ValidationException",
@@ -473,7 +473,7 @@
473473
}
474474
},
475475
"tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.py::TestStateContextObject::test_state_context_object_validation_failures[INVALID_MAP]": {
476-
"recorded-date": "03-12-2025, 12:32:49",
476+
"recorded-date": "03-12-2025, 18:51:50",
477477
"recorded-content": {
478478
"exception": {
479479
"exception_typename": "ValidationException",
@@ -482,7 +482,7 @@
482482
}
483483
},
484484
"tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.py::TestStateContextObject::test_state_context_object_validation_failures[INVALID_EXECUTION_FIELD]": {
485-
"recorded-date": "03-12-2025, 12:32:49",
485+
"recorded-date": "03-12-2025, 18:51:51",
486486
"recorded-content": {
487487
"exception": {
488488
"exception_typename": "ValidationException",
@@ -491,7 +491,7 @@
491491
}
492492
},
493493
"tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.py::TestStateContextObject::test_state_context_object_validation_failures[INVALID_FIELD]": {
494-
"recorded-date": "03-12-2025, 12:32:49",
494+
"recorded-date": "03-12-2025, 18:51:51",
495495
"recorded-content": {
496496
"exception": {
497497
"exception_typename": "ValidationException",
@@ -500,7 +500,7 @@
500500
}
501501
},
502502
"tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.py::TestStateContextObject::test_state_context_object_edge_cases[EMPTY_OBJECTS]": {
503-
"recorded-date": "03-12-2025, 12:32:49",
503+
"recorded-date": "03-12-2025, 18:51:51",
504504
"recorded-content": {
505505
"test_case_response": {
506506
"inspectionData": {
@@ -570,7 +570,7 @@
570570
}
571571
},
572572
"tests/aws/services/stepfunctions/v2/test_state/test_state_context_object.py::TestStateContextObject::test_state_context_object_edge_cases[EMPTY]": {
573-
"recorded-date": "03-12-2025, 12:32:50",
573+
"recorded-date": "03-12-2025, 18:51:51",
574574
"recorded-content": {
575575
"test_case_response": {
576576
"inspectionData": {

0 commit comments

Comments
 (0)