-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for validation pool (#4132)
add test for validation pool
- Loading branch information
Showing
10 changed files
with
66 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def cgweb_orders_dir(fixtures_dir: Path) -> Path: | ||
"""Return the path to the cgweb_orders dir.""" | ||
return Path(fixtures_dir, "cgweb_orders") | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def invalid_cgweb_orders_dir(fixtures_dir: Path) -> Path: | ||
"""Return the path to the invalid_cgweb_orders dir.""" | ||
return Path(fixtures_dir, "invalid_cgweb_orders") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
tests/services/orders/validation_service/test_model_validator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import pytest | ||
|
||
from cg.services.orders.validation.model_validator.model_validator import ModelValidator | ||
from cg.services.orders.validation.models.order import Order | ||
from cg.services.orders.validation.workflows.fluffy.models.order import FluffyOrder | ||
from cg.services.orders.validation.workflows.rml.models.order import RmlOrder | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"order_fixture, expected_index_sequence, order_model", | ||
[ | ||
("fluffy_order_to_submit", "C01 IDT_10nt_568 (TGTGAGCGAA-AACTCCGATC)", FluffyOrder), | ||
("rml_order_to_submit", "C01 IDT_10nt_568 (TGTGAGCGAA-AACTCCGATC)", RmlOrder), | ||
], | ||
ids=["fluffy", "rml"], | ||
) | ||
def test_validate_pool_sample_default_index( | ||
order_fixture: str, | ||
expected_index_sequence: str, | ||
order_model: type[Order], | ||
model_validator: ModelValidator, | ||
request: pytest.FixtureRequest, | ||
): | ||
# GIVEN a pool raw order with a sample without index sequence but correct index and index number | ||
raw_order: dict = request.getfixturevalue(order_fixture) | ||
assert raw_order["samples"][0]["index_sequence"] == "" | ||
|
||
# WHEN validating the order | ||
order, _ = model_validator.validate(order=raw_order, model=order_model) | ||
|
||
# THEN the index sequence should be set to the default index sequence | ||
assert order.samples[0].index_sequence == expected_index_sequence |