-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...in-build/src/test/kotlin/io/sentry/android/gradle/telemetry/SentryTelemetryServiceTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |