Skip to content

Commit

Permalink
add test for case names being different from sample names
Browse files Browse the repository at this point in the history
  • Loading branch information
eliottBo committed Dec 4, 2024
1 parent 31b3d49 commit 3e61c33
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/services/order_validation_service/test_case_sample_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
ApplicationArchivedError,
ApplicationNotCompatibleError,
ApplicationNotValidError,
CaseNameSampleNameSameError,
ConcentrationRequiredIfSkipRCError,
ContainerNameMissingError,
ContainerNameRepeatedError,
Expand All @@ -29,6 +30,7 @@
validate_application_exists,
validate_application_not_archived,
validate_buffers_are_allowed,
validate_case_names_different_from_sample_names,
validate_concentration_interval_if_skip_rc,
validate_concentration_required_if_skip_rc,
validate_container_name_required,
Expand Down Expand Up @@ -396,3 +398,19 @@ def test_validate_sex_subject_id_clash(valid_order: OrderWithCases, sample_store
# THEN an error should be given for the clash
assert errors
assert isinstance(errors[0], SexSubjectIdError)


def test_validate_case_names_different_from_sample_names(valid_order: OrderWithCases):
# GIVEN an order with a sample with the same name as the case
valid_order.cases[0].samples[0].name = valid_order.cases[0].name

# WHEN validating that the case names are different from the sample names
errors: list[CaseNameSampleNameSameError] = validate_case_names_different_from_sample_names(
valid_order
)

# THEN an error should be returned
assert errors

# THEN the error should concern the same case and sample name
assert isinstance(errors[0], CaseNameSampleNameSameError)

0 comments on commit 3e61c33

Please sign in to comment.