Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robinmackaij committed Dec 4, 2024
1 parent 8e43e7f commit 5ff7ef3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/libcore/suites/test_get_invalidated_parameters.robot
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ Test Get Invalidated Parameters Adds Optional Parameter If Not Provided
${headers}= Set Variable ${invalidated[1]}
Length Should Be ${headers} 1

Test Get Invalidated Parameters Adds Optional Parameter If treat_as_mandatory Is True
${request_data}= Get Request Data endpoint=/energy_label/{zipcode}/{home_number} method=get
Evaluate ${request_data.params.clear()} is None
${invalidated}= Get Invalidated Parameters
... status_code=422
... request_data=${request_data}
${extension}= Set Variable ${invalidated[0].get("extension")}
Length Should Be ${extension} 0
Length Should Be ${extension} 20
3 changes: 2 additions & 1 deletion tests/libcore/suites/test_request_data_class.robot
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ Test Get Required Properties Dict
Should Contain ${request_data.dto.as_dict()} parttime_day
Should Not Be Empty ${request_data.dto.name}
${required_properties}= Set Variable ${request_data.get_required_properties_dict()}
Should Not Contain ${required_properties} parttime_day
Should Contain ${required_properties} name
# parttime_day is configured with treat_as_mandatory=True
Should Contain ${required_properties} parttime_day

Test Get Required Params
${request_data}= Get Request Data endpoint=/available_employees method=get
Expand Down
16 changes: 16 additions & 0 deletions tests/user_implemented/custom_user_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ def get_relations() -> List[Relation]:
invalid_value_error_code=403,
error_code=422,
),
PropertyValueConstraint(
property_name="parttime_day",
values=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
treat_as_mandatory=True,
)
]
return relations

Expand All @@ -88,6 +93,17 @@ def get_relations() -> List[Relation]:
]
return relations

@staticmethod
def get_parameter_relations() -> List[Relation]:
relations: List[Relation] = [
PropertyValueConstraint(
property_name="extension",
values=["E", "boven", "A4.1"],
treat_as_mandatory=True,
)
]
return relations


class MessageDto(Dto):
@staticmethod
Expand Down

0 comments on commit 5ff7ef3

Please sign in to comment.