Skip to content

Commit

Permalink
test: Use realistic RemoteArtifact placeholder values
Browse files Browse the repository at this point in the history
This avoids an error with upcoming hash sanity checks.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Jul 19, 2024
1 parent 1ba1116 commit 636411b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import org.ossreviewtoolkit.model.VcsType
import org.ossreviewtoolkit.model.config.FileArchiverConfiguration
import org.ossreviewtoolkit.utils.test.PostgresListener

private val SOURCE_ARTIFACT_PROVENANCE = ArtifactProvenance(sourceArtifact = RemoteArtifact("url", Hash.create("hash")))
private val SOURCE_ARTIFACT_PROVENANCE = ArtifactProvenance(RemoteArtifact("https://example.com/", Hash.NONE))
private val VCS_PROVENANCE = RepositoryProvenance(
vcsInfo = VcsInfo(
type = VcsType.GIT,
Expand Down
3 changes: 1 addition & 2 deletions model/src/test/kotlin/licenses/LicenseInfoResolverTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import java.lang.IllegalArgumentException
import org.ossreviewtoolkit.model.ArtifactProvenance
import org.ossreviewtoolkit.model.CopyrightFinding
import org.ossreviewtoolkit.model.Hash
import org.ossreviewtoolkit.model.HashAlgorithm
import org.ossreviewtoolkit.model.Identifier
import org.ossreviewtoolkit.model.LicenseFinding
import org.ossreviewtoolkit.model.LicenseSource
Expand Down Expand Up @@ -338,7 +337,7 @@ class LicenseInfoResolverTest : WordSpec({
"apply path excludes" {
val sourceArtifact = RemoteArtifact(
url = "https://example.com/",
hash = Hash("", HashAlgorithm.NONE)
hash = Hash.NONE
)
val sourceArtifactProvenance = ArtifactProvenance(
sourceArtifact = sourceArtifact
Expand Down
5 changes: 2 additions & 3 deletions plugins/package-managers/pub/src/funTest/kotlin/PubFunTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import org.ossreviewtoolkit.analyzer.create
import org.ossreviewtoolkit.analyzer.resolveSingleProject
import org.ossreviewtoolkit.model.AnalyzerResult
import org.ossreviewtoolkit.model.Hash
import org.ossreviewtoolkit.model.HashAlgorithm
import org.ossreviewtoolkit.model.toYaml
import org.ossreviewtoolkit.utils.test.getAssetFile
import org.ossreviewtoolkit.utils.test.matchExpectedResult
Expand Down Expand Up @@ -122,8 +121,8 @@ private fun AnalyzerResult.patchPackages(): AnalyzerResult {
pkg.takeUnless { it.id.toCoordinates().startsWith("Maven:com.android.tools.build:aapt2:") }
?: pkg.copy(
binaryArtifact = pkg.binaryArtifact.copy(
url = "***",
hash = Hash("***", HashAlgorithm.SHA1)
url = "https://example.com/",
hash = Hash.NONE
)
)
}
Expand Down
8 changes: 4 additions & 4 deletions reporter/src/testFixtures/kotlin/TestData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ val ORT_RESULT = OrtResult(
provenance = ArtifactProvenance(
sourceArtifact = RemoteArtifact(
url = "https://example.com/license-file-1.0.tgz",
hash = Hash(value = "", algorithm = HashAlgorithm.SHA1)
hash = Hash.NONE
)
),
scanner = ScannerDetails(name = "scanner", version = "1.0", configuration = ""),
Expand Down Expand Up @@ -305,7 +305,7 @@ val ORT_RESULT = OrtResult(
provenance = ArtifactProvenance(
sourceArtifact = RemoteArtifact(
url = "https://example.com/license-file-and-additional-licenses-1.0.tgz",
hash = Hash(value = "", algorithm = HashAlgorithm.SHA1)
hash = Hash.NONE
)
),
scanner = ScannerDetails(name = "scanner", version = "1.0", configuration = ""),
Expand Down Expand Up @@ -346,7 +346,7 @@ val ORT_RESULT = OrtResult(
provenance = ArtifactProvenance(
sourceArtifact = RemoteArtifact(
url = "https://example.com/concluded-license-1.0.tgz",
hash = Hash(value = "", algorithm = HashAlgorithm.SHA1)
hash = Hash.NONE
)
),
scanner = ScannerDetails(name = "scanner", version = "1.0", configuration = ""),
Expand Down Expand Up @@ -379,7 +379,7 @@ val ORT_RESULT = OrtResult(
provenance = ArtifactProvenance(
sourceArtifact = RemoteArtifact(
url = "https://example.com/declared-license-1.0.tgz",
hash = Hash(value = "", algorithm = HashAlgorithm.SHA1)
hash = Hash.NONE
)
),
scanner = ScannerDetails(name = "scanner", version = "1.0", configuration = ""),
Expand Down
2 changes: 1 addition & 1 deletion utils/test/src/main/kotlin/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ fun scannerRunOf(vararg pkgScanResults: Pair<Identifier, List<ScanResult>>): Sca
provenance = ArtifactProvenance(
sourceArtifact = RemoteArtifact(
url = id.toPurl(),
hash = Hash(value = "", algorithm = HashAlgorithm.NONE)
hash = Hash.NONE
)
)
)
Expand Down

0 comments on commit 636411b

Please sign in to comment.