Skip to content

Commit 5ce6cb5

Browse files
authored
Merge pull request #83 from passageidentity/PSG-5003
PSG-5003
2 parents 388817a + f623b5d commit 5ce6cb5

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

passage/src/androidTest/java/id/passage/android/TokenStoreTests.kt

+15
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import kotlinx.coroutines.delay
1717
import kotlinx.coroutines.runBlocking
1818
import kotlinx.coroutines.test.runTest
1919
import org.junit.After
20+
import org.junit.Assert.assertNotSame
2021
import org.junit.Assert.assertTrue
2122
import org.junit.Before
2223
import org.junit.Rule
@@ -167,4 +168,18 @@ internal class TokenStoreTests {
167168
assertThat(e is PassageTokenException)
168169
}
169170
}
171+
172+
@Test
173+
fun refreshWithValidToken(): Unit =
174+
runBlocking {
175+
try {
176+
val currentRefreshToken = refreshToken
177+
val authResult = passage.tokenStore.refreshAuthToken(currentRefreshToken)
178+
val newStoredRefreshToken = passage.tokenStore.refreshToken
179+
assertNotNull(authResult)
180+
assertNotSame(currentRefreshToken, newStoredRefreshToken)
181+
} catch (e: Exception) {
182+
assertThat(e is PassageTokenException)
183+
}
184+
}
170185
}

passage/src/main/java/id/passage/android/PassageTokenStore.kt

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class PassageTokenStore(
9393
} catch (e: Exception) {
9494
throw PassageTokenException.convert(e)
9595
}
96+
setTokens(apiAuthResult)
9697
return apiAuthResult
9798
}
9899

0 commit comments

Comments
 (0)