File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -791,6 +791,15 @@ def make_bom_link(
791791 bom_ref_part = f'#{ url_quote (str (bom_ref ))} ' if bom_ref else ''
792792 return cls (f'urn:cdx:{ serial_number } /{ version } { bom_ref_part } ' )
793793
794+ def is_bom_link (self ) -> bool :
795+ """
796+ Check if the URI is a BOM-Link.
797+
798+ Returns:
799+ `bool`
800+ """
801+ return self ._uri .startswith ('urn:cdx:' )
802+
794803
795804@serializable .serializable_class
796805class ExternalReference :
Original file line number Diff line number Diff line change @@ -556,6 +556,10 @@ def test_make_bom_link_with_bom_ref(self) -> None:
556556 2 , BomRef ('componentA#sub-componentB%2' ))
557557 self .assertEqual (bom_link .uri , 'urn:cdx:e5a93409-fd7c-4ffa-bf7f-6dc1630b1b9d/2#componentA%23sub-componentB%252' )
558558
559+ def test_is_bom_link (self ) -> None :
560+ self .assertTrue (XsUri ('urn:cdx:e5a93409-fd7c-4ffa-bf7f-6dc1630b1b9d/2' ).is_bom_link ())
561+ self .assertFalse (XsUri ('http://example.com/resource' ).is_bom_link ())
562+
559563
560564class TestModelProperty (TestCase ):
561565
You can’t perform that action at this time.
0 commit comments