Skip to content

Commit

Permalink
Update end-to-end test fixtures to pass T1OO filter
Browse files Browse the repository at this point in the history
In a sense this isn't ideal because we're relying on particular features
of our T1OO logic and if this changes the tests may need updating again.
The alternative would be threading the appropriate `include_t1oo`
database connection parameter through to the test container.  However,
given the role of these tests as end-to-end tests of the system it seems
better to stick to default parameters and exercise the full T1OO code
path.
  • Loading branch information
evansd committed Aug 2, 2024
1 parent 70ce5bf commit 584a0d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 7 additions & 1 deletion tests/acceptance/test_embedded_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@
parameterised_dataset_definition,
trivial_dataset_definition,
)
from tests.lib.tpp_schema import Patient
from tests.lib.tpp_schema import AllowedPatientsWithTypeOneDissent, Patient


@pytest.mark.parametrize("extension", list(FILE_FORMATS.keys()))
def test_generate_dataset(study, mssql_database, extension):
mssql_database.setup(
Patient(Patient_ID=1, DateOfBirth=datetime(1934, 5, 5)),
AllowedPatientsWithTypeOneDissent(Patient_ID=1),
Patient(Patient_ID=2, DateOfBirth=datetime(1943, 5, 5)),
AllowedPatientsWithTypeOneDissent(Patient_ID=2),
Patient(Patient_ID=3, DateOfBirth=datetime(1999, 5, 5)),
AllowedPatientsWithTypeOneDissent(Patient_ID=3),
)

study.setup_from_string(trivial_dataset_definition)
Expand All @@ -36,8 +39,11 @@ def test_generate_dataset(study, mssql_database, extension):
def test_parameterised_dataset_definition(study, mssql_database):
mssql_database.setup(
Patient(Patient_ID=1, DateOfBirth=datetime(1934, 5, 5)),
AllowedPatientsWithTypeOneDissent(Patient_ID=1),
Patient(Patient_ID=2, DateOfBirth=datetime(1943, 5, 5)),
AllowedPatientsWithTypeOneDissent(Patient_ID=2),
Patient(Patient_ID=3, DateOfBirth=datetime(1999, 5, 5)),
AllowedPatientsWithTypeOneDissent(Patient_ID=3),
)

study.setup_from_string(parameterised_dataset_definition)
Expand Down
7 changes: 5 additions & 2 deletions tests/docker/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@

from tests.lib import fixtures
from tests.lib.docker import ContainerError
from tests.lib.tpp_schema import Patient
from tests.lib.tpp_schema import AllowedPatientsWithTypeOneDissent, Patient


def test_generate_dataset_in_container(study, mssql_database):
mssql_database.setup(Patient(Patient_ID=1, DateOfBirth=datetime(1943, 5, 5)))
mssql_database.setup(
Patient(Patient_ID=1, DateOfBirth=datetime(1943, 5, 5)),
AllowedPatientsWithTypeOneDissent(Patient_ID=1),
)

study.setup_from_string(fixtures.trivial_dataset_definition)
study.generate_in_docker(mssql_database, "ehrql.backends.tpp.TPPBackend")
Expand Down

0 comments on commit 584a0d8

Please sign in to comment.