Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable build config for integration test env vars #29

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion passage/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ android {
versionCode 10
versionName "1.6.1"


buildConfigField "String", "MAILOSAUR_API_KEY", "\"${System.getenv('MAILOSAUR_API_KEY') ?: ''}\""
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildFeatures {
buildConfig = true
}

buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import id.passage.android.BuildConfig

Check failure on line 1 in passage/src/androidTest/java/id/passage/android/MailosaurClient.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] passage/src/androidTest/java/id/passage/android/MailosaurClient.kt#L1 <standard:filename>

File 'MailosaurClient.kt' contains a single top level declaration and should be named 'MailosaurAPIClient.kt'
Raw output
passage/src/androidTest/java/id/passage/android/MailosaurClient.kt:1:1: error: File 'MailosaurClient.kt' contains a single top level declaration and should be named 'MailosaurAPIClient.kt' (standard:filename)
import kotlinx.serialization.Serializable
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
Expand Down Expand Up @@ -50,7 +51,7 @@
internal const val serverId = "ncor7c1m"

private const val apiURL = "https://mailosaur.com/api/messages"
private const val mailosaurAPIKey = ""
private val mailosaurAPIKey = BuildConfig.MAILOSAUR_API_KEY

private val client = OkHttpClient()

Expand Down
15 changes: 0 additions & 15 deletions passage/src/androidTest/java/id/passage/android/TokenStoreTests.kt
rickycpadilla marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,6 @@ internal class TokenStoreTests {
}
}

@Test
fun authTokenChangesAfterRefresh() =
runTest {
try {
val oldToken = passage.tokenStore.authToken
passage.tokenStore.attemptRefreshTokenStore()
val newToken = passage.tokenStore.authToken
assertThat(oldToken).isNotNull()
assertThat(newToken).isNotNull()
assertThat(oldToken).isNotEqualTo(newToken)
} catch (e: Exception) {
fail("Test failed due to unexpected exception: ${e.message}")
}
}

@Test
fun authTokenThrowsErrorAfterRevoke() =
runTest {
Expand Down