Skip to content

Commit 975d8b7

Browse files
hjrochaFrancisco
authored andcommitted
adding unit tests
1 parent 3d2440f commit 975d8b7

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

cli/src/main/scala/com/codacy/analysis/cli/command/CLIApp.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ final case class Analyze(
141141
output: Option[File] = Option.empty,
142142
@ExtraName("c") @ValueDescription("The commit UUID of the commit that will be analysed")
143143
commitUuid: Option[Commit.Uuid] = Option.empty,
144-
@ExtraName("s") @ValueDescription("Skip commit UUID validation")
144+
@ExtraName("s") @ValueDescription("[default: false] - Force using a commit UUID")
145145
skipCommitUuidValidation: Int @@ Counter = Tag.of(0),
146146
@ExtraName("u") @ValueDescription("If the results should be uploaded to the API")
147147
upload: Int @@ Counter = Tag.of(0),

cli/src/test/scala/com/codacy/analysis/cli/CLISpec.scala

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,26 @@ class CLISpec extends Specification with NoLanguageFeatures with FileMatchers {
347347
}
348348
}
349349

350+
"does not fail when the uuid of the current commit of the git project does not match the one provided by parameter but fails for other reason" in {
351+
withTemporaryGitRepo { directory =>
352+
(for {
353+
_ <- File.temporaryFile(parent = Some(directory))
354+
} yield {
355+
val analyze = Analyze(
356+
options = CommonOptions(),
357+
api = APIOptions(projectToken = Some("hey, im a token"), codacyApiBaseUrl = Some("https://codacy.com")),
358+
tool = None,
359+
directory = Option(directory),
360+
upload = Tag.of(0),
361+
extras = ExtraOptions(),
362+
commitUuid = Option(Commit.Uuid("Aw geez Rick, this isnt the commit uuid!")),
363+
skipCommitUuidValidation = Tag.of(1),
364+
toolTimeout = None)
365+
cli.run(analyze) must beEqualTo(ExitStatus.ExitCodes.failedAnalysis)
366+
}).get
367+
}
368+
}
369+
350370
"cleanup config files after cli run" in {
351371
(for {
352372
directory <- File.temporaryDirectory()

0 commit comments

Comments
 (0)