From 6d0d157af08fa75ea4c03b899b3b4af0ecdc013b Mon Sep 17 00:00:00 2001 From: NarenderRajuB Date: Wed, 12 Feb 2025 16:55:42 +0000 Subject: [PATCH] fix non string for fund config export fix non string for fund config export fix data class --- app/export_config/generate_fund_round_config.py | 3 --- app/shared/data_classes.py | 6 +++--- tests/test_config_export.py | 10 +++++----- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/app/export_config/generate_fund_round_config.py b/app/export_config/generate_fund_round_config.py index f7614e3d..02d1bd64 100644 --- a/app/export_config/generate_fund_round_config.py +++ b/app/export_config/generate_fund_round_config.py @@ -93,9 +93,6 @@ def generate_fund_config(round_id): short_name=fund.short_name, description_json=fund.description_json, welsh_available=fund.welsh_available, - owner_organisation_name="None", - owner_organisation_shortname="None", - owner_organisation_logo_uri="None", funding_type=fund.funding_type.value, ggis_scheme_reference_number=fund.ggis_scheme_reference_number, ) diff --git a/app/shared/data_classes.py b/app/shared/data_classes.py index c0a049fc..d13db9af 100644 --- a/app/shared/data_classes.py +++ b/app/shared/data_classes.py @@ -94,11 +94,11 @@ class FundExport: id: str short_name: dict welsh_available: bool - owner_organisation_name: str - owner_organisation_shortname: str - owner_organisation_logo_uri: str ggis_scheme_reference_number: str funding_type: FundingType + owner_organisation_name: Optional[str] = None + owner_organisation_shortname: Optional[str] = None + owner_organisation_logo_uri: Optional[str] = None name_json: NameJson = field(default_factory=NameJson) title_json: TitleJson = field(default_factory=TitleJson) description_json: DescriptionJson = field(default_factory=DescriptionJson) diff --git a/tests/test_config_export.py b/tests/test_config_export.py index fb698634..ae4c167a 100644 --- a/tests/test_config_export.py +++ b/tests/test_config_export.py @@ -5,6 +5,7 @@ from pathlib import Path import pytest +from bs4 import BeautifulSoup from app.blueprints.application.routes import create_export_zip from app.export_config.generate_fund_round_config import generate_config_for_round @@ -17,7 +18,6 @@ generate_all_round_html, ) from app.export_config.helpers import validate_json -from bs4 import BeautifulSoup def read_data_from_output_file(file): @@ -63,9 +63,9 @@ def test_generate_config_for_round_valid_input(seed_dynamic_data, monkeypatch, t "fund_config": { "short_name": fund_short_name, "welsh_available": False, - "owner_organisation_name": "None", - "owner_organisation_shortname": "None", - "owner_organisation_logo_uri": "None", + "owner_organisation_name": None, + "owner_organisation_shortname": None, + "owner_organisation_logo_uri": None, "name_json": {"en": "Unit Test Fund 1"}, "title_json": {"en": "funding to improve testing"}, "description_json": {"en": "A £10m fund to improve testing across the devolved nations."}, @@ -333,4 +333,4 @@ def test_create_export_zip(temp_output_dir): def _normalize_html(html): """Parses and normalizes HTML using BeautifulSoup to avoid formatting differences.""" - return BeautifulSoup(html, "html.parser").prettify() \ No newline at end of file + return BeautifulSoup(html, "html.parser").prettify()