@@ -330,6 +330,40 @@ def test_dataset_detail_collections(
330330 )
331331 assert collection_link is not None
332332
333+ def test_metadata_landing_page_is_anchor (self , interface_with_dataset , db_client ):
334+ """
335+ Test that the landingPage key in the Complete Metadata section
336+ is rendered as an anchor tag.
337+ """
338+ landing_page_url = "https://example.com/landing-page"
339+ ds = interface_with_dataset .get_dataset_by_slug ("test" )
340+ ds .dcat = {** ds .dcat , "landingPage" : landing_page_url }
341+ interface_with_dataset .db .commit ()
342+
343+ with patch ("app.routes.interface" , interface_with_dataset ):
344+ response = db_client .get ("/dataset/test" )
345+
346+ assert response .status_code == 200
347+ soup = BeautifulSoup (response .text , "html.parser" )
348+
349+ metadata_table = soup .select_one ("table.metadata-table" )
350+ assert metadata_table is not None
351+
352+ landing_page_row = next (
353+ (
354+ row
355+ for row in metadata_table .select ("tr" )
356+ if row .select_one ("th" ).get_text (strip = True ) == "landingPage"
357+ ),
358+ None ,
359+ )
360+ assert landing_page_row is not None
361+
362+ anchor = landing_page_row .select_one ("td a" )
363+ assert anchor is not None
364+ assert anchor .get ("href" ) == landing_page_url
365+ assert anchor .get_text (strip = True ) == landing_page_url
366+
333367 def test_check_jsonld (self , interface_with_dataset , db_client ):
334368
335369 with patch ("app.routes.interface" , interface_with_dataset ):
0 commit comments