@@ -754,6 +754,31 @@ def get_bom_with_multiple_licenses() -> Bom:
754754 )
755755
756756
757+ def get_bom_for_issue_497_urls () -> Bom :
758+ """regression test for issue #497
759+ see https://github.com/CycloneDX/cyclonedx-python-lib/issues/497
760+ """
761+ return _make_bom (components = [
762+ Component (name = 'dummy' , bom_ref = 'dummy' , external_references = [
763+ ExternalReference (
764+ type = ExternalReferenceType .OTHER ,
765+ comment = 'nothing special' ,
766+ url = XsUri ('https://acme.org' )
767+ ),
768+ ExternalReference (
769+ type = ExternalReferenceType .OTHER ,
770+ comment = 'control characters' ,
771+ url = XsUri ('https://acme.org/?foo=sp ace&bar[23]=42<=1<2>=3>2&cb={lol}' )
772+ ),
773+ ExternalReference (
774+ type = ExternalReferenceType .OTHER ,
775+ comment = 'pre-encoded' ,
776+ url = XsUri ('https://acme.org/?bar%5b23%5D=42' )
777+ ),
778+ ])
779+ ])
780+
781+
757782def bom_all_same_bomref () -> Tuple [Bom , int ]:
758783 bom = Bom ()
759784 bom .metadata .component = Component (name = 'root' , bom_ref = 'foo' , components = [
@@ -774,13 +799,18 @@ def bom_all_same_bomref() -> Tuple[Bom, int]:
774799 if n .startswith ('get_bom_' ) and not n .endswith ('_invalid' )
775800)
776801
802+ all_get_bom_funct_valid_immut = tuple (
803+ (n , f ) for n , f in getmembers (sys .modules [__name__ ], isfunction )
804+ if n .startswith ('get_bom_' ) and not n .endswith ('_invalid' ) and not n .endswith ('_migrate' )
805+ )
806+
777807all_get_bom_funct_invalid = tuple (
778808 (n , f ) for n , f in getmembers (sys .modules [__name__ ], isfunction )
779809 if n .startswith ('get_bom_' ) and n .endswith ('_invalid' )
780810)
781811
782812all_get_bom_funct_with_incomplete_deps = {
783- # List of functions that return BOM with an incomplte dependency graph.
813+ # List of functions that return BOM with an incomplete dependency graph.
784814 # It is expected that some process auto-fixes this before actual serialization takes place.
785815 get_bom_just_complete_metadata ,
786816 get_bom_with_component_setuptools_basic ,
@@ -797,4 +827,5 @@ def bom_all_same_bomref() -> Tuple[Bom, int]:
797827 get_bom_with_services_simple ,
798828 get_bom_with_licenses ,
799829 get_bom_with_multiple_licenses ,
830+ get_bom_for_issue_497_urls ,
800831}
0 commit comments