19
19
20
20
package org.ossreviewtoolkit.cli
21
21
22
+ import io.kotest.core.TestConfiguration
22
23
import io.kotest.core.spec.style.WordSpec
23
24
import io.kotest.engine.spec.tempdir
24
25
import io.kotest.matchers.concurrent.shouldCompleteWithin
25
26
import io.kotest.matchers.shouldBe
26
27
28
+ import java.io.File
27
29
import java.util.concurrent.TimeUnit
28
30
29
31
import org.ossreviewtoolkit.analyzer.Analyzer
@@ -45,18 +47,9 @@ class AnalyzerFunTest : WordSpec({
45
47
" An analysis" should {
46
48
" correctly report repositories git-repo for projects" {
47
49
val expectedRepository = getAssetFile("git-repo-expected-repository.yml").readValue<Repository >()
48
- val pkg = Package .EMPTY .copy(
49
- vcsProcessed = VcsInfo (
50
- type = VcsType .GIT_REPO ,
51
- url = "https://github.com/oss-review-toolkit/ort-test-data-git-repo? manifest=manifest.xml",
52
- revision = "31588aa8f8555474e1c3c66a359ec99e4cd4b1fa"
53
- )
54
- )
55
- val outputDir = tempdir().also {
56
- GitRepoFactory ().create(PluginConfig .EMPTY ).download(pkg, it)
57
- }
50
+ val projectDir = createGitRepoProject()
58
51
59
- val repository = analyze(outputDir , packageManagers = emptySet()).repository
52
+ val repository = analyze(projectDir , packageManagers = emptySet()).repository
60
53
61
54
repository shouldBe expectedRepository
62
55
}
@@ -85,3 +78,17 @@ class AnalyzerFunTest : WordSpec({
85
78
}
86
79
}
87
80
})
81
+
82
+ private fun TestConfiguration.createGitRepoProject (): File {
83
+ val pkg = Package .EMPTY .copy(
84
+ vcsProcessed = VcsInfo (
85
+ type = VcsType .GIT_REPO ,
86
+ url = " https://github.com/oss-review-toolkit/ort-test-data-git-repo?manifest=manifest.xml" ,
87
+ revision = " 31588aa8f8555474e1c3c66a359ec99e4cd4b1fa"
88
+ )
89
+ )
90
+
91
+ return tempdir().also {
92
+ GitRepoFactory ().create(PluginConfig .EMPTY ).download(pkg, it)
93
+ }
94
+ }
0 commit comments