Skip to content

Commit

Permalink
add describes relationship to write_tv test
Browse files Browse the repository at this point in the history
This leads to the failure of tests caused by the jsonyamlxml writer.
Signed-off-by: Meret Behrens <[email protected]>
  • Loading branch information
meretp committed Oct 26, 2022
1 parent 31e57d4 commit f061ea8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/data/doc_write/tv-simple-plus.tv
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ DocumentNamespace: https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0
DocumentName: Sample_Document-V2.1
SPDXID: SPDXRef-DOCUMENT
# Creation Info
# Relationships
Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-Package
# Package
PackageName: some/path
SPDXID: SPDXRef-Package
Expand Down
2 changes: 2 additions & 0 deletions tests/data/doc_write/tv-simple.tv
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ DocumentNamespace: https://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0
DocumentName: Sample_Document-V2.1
SPDXID: SPDXRef-DOCUMENT
# Creation Info
# Relationships
Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-Package
# Package
PackageName: some/path
SPDXID: SPDXRef-Package
Expand Down
6 changes: 6 additions & 0 deletions tests/data/doc_write/xml-simple-plus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@
<sha1>SOME-SHA1</sha1>
</Package>
</documentDescribes>
<relationships>
<spdxElementId>SPDXRef-DOCUMENT</spdxElementId>
<relatedSpdxElement>SPDXRef-Package</relatedSpdxElement>
<relationshipType>DESCRIBES</relationshipType>
</relationships>

</Document>
5 changes: 5 additions & 0 deletions tests/data/doc_write/xml-simple.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@
<sha1>SOME-SHA1</sha1>
</Package>
</documentDescribes>
<relationships>
<spdxElementId>SPDXRef-DOCUMENT</spdxElementId>
<relatedSpdxElement>SPDXRef-Package</relatedSpdxElement>
<relationshipType>DESCRIBES</relationshipType>
</relationships>
</Document>
10 changes: 10 additions & 0 deletions tests/test_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from spdx.file import File
from spdx.package import Package
from spdx.parsers.loggers import ErrorMessages
from spdx.relationship import Relationship
from spdx.utils import NoAssert
from spdx.version import Version

Expand Down Expand Up @@ -191,6 +192,8 @@ def _get_lgpl_doc(self, or_later=False):

package.add_lics_from_file(lic1)
package.add_file(file1)
relationship = doc.spdx_id + " " + "DESCRIBES" + " " + package.spdx_id
doc.add_relationships(Relationship(relationship))
return doc

def _get_lgpl_multi_package_doc(self, or_later=False):
Expand Down Expand Up @@ -246,6 +249,13 @@ def _get_lgpl_multi_package_doc(self, or_later=False):
doc.add_package(package2)
doc.add_package(package3)

relationship = doc.spdx_id + " " + "DESCRIBES" + " " + package1.spdx_id
doc.add_relationships(Relationship(relationship))
relationship = doc.spdx_id + " " + "DESCRIBES" + " " + package2.spdx_id
doc.add_relationships(Relationship(relationship))
relationship = doc.spdx_id + " " + "DESCRIBES" + " " + package3.spdx_id
doc.add_relationships(Relationship(relationship))

return doc

def test_write_document_rdf_with_validate(self):
Expand Down

0 comments on commit f061ea8

Please sign in to comment.