Skip to content

Commit

Permalink
FS-4917 - Remove unused tasks and move test data seeding into tests d…
Browse files Browse the repository at this point in the history
…irectory

These tasks were developer tools for seeding and manipulating the local database, as well as to manually generate export files. None of this stuff was linked to the frontend. Seeding the local database for unit tests is still required, and so this has been moved to a new place.
  • Loading branch information
wjrm500 committed Dec 23, 2024
1 parent 675417d commit 0ba728e
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 218 deletions.
22 changes: 0 additions & 22 deletions tasks/__init__.py

This file was deleted.

86 changes: 0 additions & 86 deletions tasks/db_tasks.py

This file was deleted.

87 changes: 0 additions & 87 deletions tasks/export_tasks.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from app.create_app import create_app
from config import Config
from tasks.test_data import init_unit_test_data
from tasks.test_data import insert_test_data
from tests.seed_test_data import init_unit_test_data
from tests.seed_test_data import insert_test_data

pytest_plugins = ["fsd_test_utils.fixtures.db_fixtures"]

Expand Down
20 changes: 3 additions & 17 deletions tasks/test_data.py → tests/seed_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def init_salmon_fishing_fund():
"en": "A £10m fund to improve access to salmon fishing facilities across the devolved nations."
},
welsh_available=False,
short_name=f"SFF{randint(0,999)}",
short_name=f"SFF{randint(0,999)}", # NOSONAR
owner_organisation_id=o.organisation_id,
funding_type=FundingType.COMPETITIVE,
ggis_scheme_reference_number="G1-SCH-0000092414",
Expand Down Expand Up @@ -377,7 +377,7 @@ def init_unit_test_data() -> dict:
title_json={"en": "funding to improve testing"},
description_json={"en": "A £10m fund to improve testing across the devolved nations."},
welsh_available=False,
short_name=f"UTF{randint(0,999)}",
short_name=f"UTF{randint(0,999)}", # NOSONAR
owner_organisation_id=o.organisation_id,
funding_type=FundingType.COMPETITIVE,
ggis_scheme_reference_number="G3-SCH-0000092414",
Expand All @@ -388,7 +388,7 @@ def init_unit_test_data() -> dict:
fund_id=f.fund_id,
audit_info={"user": "dummy_user", "timestamp": datetime.now().isoformat(), "action": "create"},
title_json={"en": "round the first"},
short_name=f"UTR{randint(0,999)}",
short_name=f"UTR{randint(0,999)}", # NOSONAR
opens=datetime.now(),
deadline=datetime.now(),
assessment_start=datetime.now(),
Expand All @@ -415,20 +415,6 @@ def init_unit_test_data() -> dict:
eligibility_config={"has_eligibility": False},
eoi_decision_schema={"en": {"valid": True}, "cy": {"valid": False}},
)
# r2: Round = Round(
# round_id=uuid4(),
# fund_id=f.fund_id,
# audit_info={"user": "dummy_user", "timestamp": datetime.now().isoformat(), "action": "create"},
# title_json={"en": "round the second"},
# short_name=f"UTR{randint(0,999)}",
# opens=datetime.now(),
# deadline=datetime.now(),
# assessment_start=datetime.now(),
# reminder_date=datetime.now(),
# assessment_deadline=datetime.now(),
# prospectus_link="http://www.google.com",
# privacy_notice_link="http://www.google.com",
# )

s1: Section = Section(
section_id=uuid4(), index=1, round_id=r.round_id, name_in_apply_json={"en": "Organisation Information"}
Expand Down
4 changes: 2 additions & 2 deletions tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
from app.db.queries.fund import get_fund_by_id
from app.db.queries.round import add_round
from app.db.queries.round import get_round_by_id
from tasks.test_data import BASIC_FUND_INFO
from tasks.test_data import BASIC_ROUND_INFO
from tests.seed_test_data import BASIC_FUND_INFO
from tests.seed_test_data import BASIC_ROUND_INFO


def test_add_organisation(flask_test_client, _db, clear_test_data):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
from app.import_config.load_form_json import load_form_jsons
from app.shared.data_classes import Condition
from app.shared.data_classes import ConditionValue
from tasks.test_data import BASIC_FUND_INFO
from tasks.test_data import BASIC_ROUND_INFO
from tests.seed_test_data import BASIC_FUND_INFO
from tests.seed_test_data import BASIC_ROUND_INFO


def test_build_form_json_no_conditions(seed_dynamic_data):
Expand Down

0 comments on commit 0ba728e

Please sign in to comment.