Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
markushi committed May 15, 2024
1 parent 90c3484 commit 4333a56
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package io.sentry.android.gradle.telemetry

import io.sentry.android.gradle.SentryCliProvider
import kotlin.test.assertEquals
import org.gradle.testfixtures.ProjectBuilder
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder

class SentryTelemetryServiceTest {

@get:Rule
val testProjectDir = TemporaryFolder()

@Suppress("UnstableApiUsage")
@Test
fun `when no auth token is present, SentryCliInfoValueSource sentry-cli info returns an empty string`() {
val project = ProjectBuilder
.builder()
.withProjectDir(testProjectDir.root)
.build()

val cliPath = SentryCliProvider
.getCliResourcesExtractionPath(project.layout.buildDirectory.asFile.get())

val infoOutput = project.providers.of(SentryCliInfoValueSource::class.java) { cliVS ->
cliVS.parameters.buildDirectory.set(project.buildDir)
cliVS.parameters.cliExecutable.set(cliPath.absolutePath)
// notice the absence of the auth token
// cliVS.parameters.authToken.set("")
}.get()

assertEquals("", infoOutput)
}
}

0 comments on commit 4333a56

Please sign in to comment.