Skip to content

Commit

Permalink
test(carthage): Fix the GitHub organization replacement
Browse files Browse the repository at this point in the history
Fixup 9e4d666 to not replace `<REPLACE_GITHUB_ORGANIZATION>` with a
constant string (which defeats the purpose of adding that placeholder)
and use the actual GitHub organization name instead.

This should avoid test failures like the one at [1].

[1]: https://github.com/doubleopen-project/ort/actions/runs/8891375013/job/24413212066#step:7:1093

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Apr 30, 2024
1 parent 25515fb commit 1981a4e
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,22 @@ package org.ossreviewtoolkit.plugins.packagemanagers.carthage
import io.kotest.core.spec.style.StringSpec
import io.kotest.matchers.should

import java.io.File

import org.ossreviewtoolkit.analyzer.create
import org.ossreviewtoolkit.analyzer.resolveSingleProject
import org.ossreviewtoolkit.downloader.VcsHost
import org.ossreviewtoolkit.downloader.VersionControlSystem
import org.ossreviewtoolkit.model.toYaml
import org.ossreviewtoolkit.utils.ort.normalizeVcsUrl
import org.ossreviewtoolkit.utils.test.getAssetFile
import org.ossreviewtoolkit.utils.test.matchExpectedResult

class CarthageFunTest : StringSpec({
val vcs = checkNotNull(VersionControlSystem.forDirectory(File(".")))
val vcsUrl = normalizeVcsUrl(vcs.getRemoteUrl())
val vcsHost = checkNotNull(VcsHost.fromUrl(vcsUrl))

"Project dependencies are detected correctly" {
val definitionFile = getAssetFile("projects/synthetic/carthage/Cartfile.resolved")
val expectedResultFile = getAssetFile("projects/synthetic/carthage-expected-output.yml")
Expand All @@ -38,7 +47,7 @@ class CarthageFunTest : StringSpec({
result.toYaml() should matchExpectedResult(
expectedResultFile,
definitionFile,
mapOf("<REPLACE_GITHUB_ORGANIZATION>" to "oss-review-toolkit")
mapOf("<REPLACE_GITHUB_ORGANIZATION>" to vcsHost.getUserOrOrganization(vcsUrl).orEmpty())
)
}
})

0 comments on commit 1981a4e

Please sign in to comment.