From 7596bdcc71340c255893b23e55593a04f884e6a2 Mon Sep 17 00:00:00 2001 From: Michael Huneke Date: Wed, 27 Nov 2024 17:27:18 -0500 Subject: [PATCH] Clean up --- .../src/api/agencies_v1/test_agencies_routes.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/api/tests/src/api/agencies_v1/test_agencies_routes.py b/api/tests/src/api/agencies_v1/test_agencies_routes.py index 497862d5a..70ee42802 100644 --- a/api/tests/src/api/agencies_v1/test_agencies_routes.py +++ b/api/tests/src/api/agencies_v1/test_agencies_routes.py @@ -1,7 +1,19 @@ -from src.db.models.agency_models import Agency +import pytest + +from src.db.models.agency_models import Agency, LinkAgencyDownloadFileType from tests.src.db.models.factories import AgencyFactory +@pytest.fixture(autouse=True) +def cleanup_agencies(db_session): + yield + # Delete related records first + db_session.query(LinkAgencyDownloadFileType).delete() + # Then delete agencies + db_session.query(Agency).delete() + db_session.commit() + + def test_agencies_get_default_dates(client, api_auth_token, enable_factory_create, db_session): # These should return in the default date range AgencyFactory.create_batch(20)