diff --git a/meta/lib/oeqa/selftest/cases/spdx.py b/meta/lib/oeqa/selftest/cases/spdx.py
index ce9a8af4f6..17484df591 100644
--- a/meta/lib/oeqa/selftest/cases/spdx.py
+++ b/meta/lib/oeqa/selftest/cases/spdx.py
@@ -543,3 +543,58 @@ class SPDX30Check(SPDX3CheckBase, OESelftestTestCase):
 
         # Document should be fully linked
         self.check_objset_missing_ids(objset)
+
+    # hello-rs is a test recipe with a fixed SRCREV. It fetches its source
+    # and one git dependency from github.com, and one crate.
+    HELLO_RS_DOWNLOAD_PURLS = {
+        "pkg:github/akiernan/hello-bin@d3d096eda182644868f8e7458dcfa538ff637db3",
+        "pkg:github/akiernan/hello-lib@59c84574e844617043cf337bc8fa537cf87ad8ae",
+        "pkg:cargo/figlet-rs@0.1.5",
+    }
+
+    def test_crate_package_identity(self):
+        """Test that a crate download has its name, version and PURL."""
+        objset = self.check_recipe_spdx(
+            "hello-rs",
+            "{DEPLOY_DIR_SPDX}/{SSTATE_PKGARCH}/builds/build-hello-rs.spdx.json",
+        )
+
+        crates = [
+            (pkg.name, pkg.software_packageVersion, pkg.software_packageUrl)
+            for pkg in objset.foreach_type(oe.spdx30.software_Package)
+            if (pkg.software_downloadLocation or "").startswith("https://static.crates.io/")
+        ]
+        self.assertEqual(crates, [("figlet-rs", "0.1.5", "pkg:cargo/figlet-rs@0.1.5")])
+
+    def get_package_purls(self, extraconf=""):
+        objset = self.check_recipe_spdx(
+            "hello-rs",
+            "{DEPLOY_DIR_SPDX}/{SSTATE_PKGARCH}/packages/package-hello-rs.spdx.json",
+            extraconf=extraconf,
+        )
+        package = next(
+            pkg
+            for pkg in objset.foreach_type(oe.spdx30.software_Package)
+            if pkg.name == "hello-rs"
+        )
+        purls = {
+            e.identifier
+            for e in package.externalIdentifier
+            if e.externalIdentifierType == oe.spdx30.ExternalIdentifierType.packageUrl
+        }
+        return package.software_packageUrl, purls
+
+    def test_download_purls_in_output_package(self):
+        """Test that the output package gets the PURLs of its downloads."""
+        package_purl, purls = self.get_package_purls()
+
+        own_purls = get_bb_var("SPDX_PACKAGE_URLS", "hello-rs").split()
+        self.assertEqual(package_purl, own_purls[0])
+        self.assertEqual(purls, set(own_purls) | self.HELLO_RS_DOWNLOAD_PURLS)
+
+    def test_download_purls_without_package_urls(self):
+        """Test that a download PURL does not become the package PURL."""
+        package_purl, purls = self.get_package_purls('SPDX_PACKAGE_URLS:pn-hello-rs = ""\n')
+
+        self.assertIsNone(package_purl)
+        self.assertEqual(purls, self.HELLO_RS_DOWNLOAD_PURLS)
