@@ -585,7 +585,7 @@ def test_smartlink(self) -> None:
585585 for head in response .headers :
586586 if head [0 ] == "Location" :
587587 location = head [1 ]
588- self .assertEqual (location , "/node/standard/CWE/sectionid/456 " )
588+ self .assertEqual (location , "/cre/222-222 " )
589589 self .assertEqual (302 , response .status_code )
590590
591591 response = client .get (
@@ -596,7 +596,28 @@ def test_smartlink(self) -> None:
596596 for head in response .headers :
597597 if head [0 ] == "Location" :
598598 location = head [1 ]
599- self .assertEqual (location , "/node/standard/ASVS/section/v0.1.2" )
599+ self .assertEqual (location , "/cre/333-333" )
600+ self .assertEqual (302 , response .status_code )
601+
602+ # Multiple CREs linked to same standard → should fall back to node page
603+ cwe_multi = defs .Standard (name = "CWEmulti" , sectionID = "789" )
604+ ce = defs .CRE (id = "444-444" , description = "CE" , name = "CE" , tags = [])
605+ cf = defs .CRE (id = "555-555" , description = "CF" , name = "CF" , tags = [])
606+ dcwe_multi = collection .add_node (cwe_multi )
607+ dce = collection .add_cre (ce )
608+ dcf = collection .add_cre (cf )
609+ collection .add_link (dce , dcwe_multi , ltype = defs .LinkTypes .LinkedTo )
610+ collection .add_link (dcf , dcwe_multi , ltype = defs .LinkTypes .LinkedTo )
611+
612+ response = client .get (
613+ "/smartlink/standard/CWEmulti/789" ,
614+ headers = {"Content-Type" : "application/json" },
615+ )
616+ location = ""
617+ for head in response .headers :
618+ if head [0 ] == "Location" :
619+ location = head [1 ]
620+ self .assertEqual (location , "/node/standard/CWEmulti/sectionid/789" )
600621 self .assertEqual (302 , response .status_code )
601622
602623 # negative test, this cwe does not exist, therefore we redirect to Mitre!
0 commit comments