Skip to content

Commit

Permalink
Improve unit test #180
Browse files Browse the repository at this point in the history
Signed-off-by: tdruez <[email protected]>
  • Loading branch information
tdruez committed Oct 23, 2024
1 parent 110b42d commit 90ee751
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions dje/tests/test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def test_outputs_get_attachment_response(self):
self.assertEqual("application/json", response["Content-Type"])

def test_outputs_get_spdx_document(self):
package = make_package(self.dataspace, package_url="pkg:type/name")
make_product_package(self.product1, package)

document = outputs.get_spdx_document(self.product1, self.super_user)
document.creation_info.created = "2000-01-01T01:02:03Z"
expected = {
Expand All @@ -60,8 +63,24 @@ def test_outputs_get_spdx_document(self):
],
"licenseListVersion": "3.18",
},
"packages": [],
"documentDescribes": [],
"packages": [
{
"name": "name",
"SPDXID": f"SPDXRef-dejacode-package-{package.uuid}",
"downloadLocation": "NOASSERTION",
"licenseConcluded": "NOASSERTION",
"copyrightText": "NOASSERTION",
"filesAnalyzed": False,
"externalRefs": [
{
"referenceCategory": "PACKAGE-MANAGER",
"referenceType": "purl",
"referenceLocator": "pkg:type/name",
}
],
}
],
"documentDescribes": [f"SPDXRef-dejacode-package-{package.uuid}"],
}
self.assertEqual(expected, document.as_dict())

Expand Down

0 comments on commit 90ee751

Please sign in to comment.