1111from flask import Flask , Request
1212from flask .testing import FlaskClient
1313from hamcrest import assert_that , contains_exactly , has_entries , has_length , is_ , none
14- from pydantic import HttpUrl
1514from wireup .integration .flask import get_app_container
1615
1716from eligibility_signposting_api .audit .audit_service import AuditService
@@ -398,7 +397,7 @@ def test_no_suitability_rules_for_actionable():
398397 action_type = ActionType ("TYPE_A" ),
399398 action_code = ActionCode ("CODE123" ),
400399 action_description = ActionDescription ("Some description" ),
401- url_link = UrlLink (HttpUrl ( "https://example.com" ) ),
400+ url_link = UrlLink ("https://example.com" ),
402401 url_label = UrlLabel ("Learn more" ),
403402 )
404403 ],
@@ -407,7 +406,7 @@ def test_no_suitability_rules_for_actionable():
407406 actionType = eligibility .ActionType ("TYPE_A" ),
408407 actionCode = eligibility .ActionCode ("CODE123" ),
409408 description = eligibility .Description ("Some description" ),
410- urlLink = eligibility .HttpUrl ("https://example.com" ),
409+ urlLink = eligibility .UrlLink ("https://example.com" ),
411410 urlLabel = eligibility .UrlLabel ("Learn more" ),
412411 )
413412 ],
@@ -426,9 +425,9 @@ def test_no_suitability_rules_for_actionable():
426425 eligibility .Action (
427426 actionType = eligibility .ActionType ("TYPE_B" ),
428427 actionCode = eligibility .ActionCode ("CODE123" ),
429- description = None ,
430- urlLink = None ,
431- urlLabel = None ,
428+ description = "" ,
429+ urlLink = "" ,
430+ urlLabel = "" ,
432431 )
433432 ],
434433 ),
@@ -601,9 +600,9 @@ def test_excludes_nulls_via_build_response(client: FlaskClient):
601600 eligibility .Action (
602601 actionType = eligibility .ActionType ("TYPE_A" ),
603602 actionCode = eligibility .ActionCode ("CODE123" ),
604- description = None , # Should be excluded
605- urlLink = None , # Should be excluded
606- urlLabel = None , # Should be excluded
603+ description = eligibility . Description ( "" ) , # Should be an empty string
604+ urlLink = eligibility . UrlLink ( "" ) , # Should be an empty string
605+ urlLabel = eligibility . UrlLabel ( "" ) , # Should be an empty string
607606 )
608607 ],
609608 )
@@ -633,9 +632,9 @@ def test_excludes_nulls_via_build_response(client: FlaskClient):
633632
634633 assert action ["actionType" ] == "TYPE_A"
635634 assert action ["actionCode" ] == "CODE123"
636- assert "description" not in action
637- assert "urlLink" not in action
638- assert "urlLabel" not in action
635+ assert action [ "description" ] == ""
636+ assert action [ "urlLink" ] == ""
637+ assert action [ "urlLabel" ] == ""
639638
640639
641640def test_build_response_include_values_that_are_not_null (client : FlaskClient ):
@@ -654,7 +653,7 @@ def test_build_response_include_values_that_are_not_null(client: FlaskClient):
654653 actionType = eligibility .ActionType ("TYPE_A" ),
655654 actionCode = eligibility .ActionCode ("CODE123" ),
656655 description = eligibility .Description ("Contact GP" ),
657- urlLink = eligibility .HttpUrl ( HttpUrl ( "https://example.dummy/" ) ),
656+ urlLink = eligibility .UrlLink ( "https://example.dummy/" ),
658657 urlLabel = eligibility .UrlLabel ("GP contact" ),
659658 )
660659 ],
0 commit comments