Skip to content

Commit 17c7e77

Browse files
Fix: Create step should not require step_id (#125)
1 parent 4714ec1 commit 17c7e77

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

nisystemlink/clients/testmonitor/models/_create_steps_request.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
class BaseStepRequest(JsonModel):
11-
step_id: str
11+
step_id: Optional[str]
1212
"""Step ID."""
1313

1414
result_id: str

tests/integration/testmonitor/test_testmonitor.py

+39
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,45 @@ def test__create_single_step__creation_succeed(
534534
assert created_step.inputs == inputs
535535
assert not created_step.outputs
536536

537+
def test__create_step_without_step_id__creation_succeed(
538+
self,
539+
client: TestMonitorClient,
540+
create_results,
541+
create_steps,
542+
):
543+
results = [
544+
CreateResultRequest(
545+
part_number="Python Client Testing",
546+
program_name="Python Client Test Program",
547+
status=Status.PASSED(),
548+
)
549+
]
550+
created_result = create_results(results)
551+
result_id = created_result.results[0].id
552+
name = "Test Step 1"
553+
data = StepData(
554+
text="This is a test step",
555+
parameters=[Measurement(name="param1", measurement="10")],
556+
)
557+
properties = {"property1": "value1", "property2": "value2"}
558+
keywords = ["keyword1", "keyword2"]
559+
inputs = [NamedValue(name="input1", value="inputValue1")]
560+
step = CreateStepRequest(
561+
result_id=result_id,
562+
name=name,
563+
data=data,
564+
properties=properties,
565+
keywords=keywords,
566+
inputs=inputs,
567+
)
568+
569+
response: CreateStepsPartialSuccess = create_steps(steps=[step])
570+
571+
assert response is not None
572+
assert len(response.steps) == 1
573+
created_step = response.steps[0]
574+
assert created_step.step_id is not None
575+
537576
def test__create_multiple_steps__multiple_creation_succeed(
538577
self, client: TestMonitorClient, create_results, create_steps
539578
):

0 commit comments

Comments
 (0)