Skip to content
Snippets Groups Projects
Unverified Commit d96a931d authored by Jakob Möller's avatar Jakob Möller Committed by GitHub
Browse files

Introduce a missing set for the rollback of the token (#662)


* Introduce a missing set for the rollback of the token so that in case of failure, the token is rollbacked properly instead of being nulled away

Signed-off-by: default avatard067928 <jakob.moeller@sap.com>

* Fix Test

Signed-off-by: default avatard067928 <jakob.moeller@sap.com>
parent cdf1419c
No related branches found
No related tags found
No related merge requests found
...@@ -205,6 +205,7 @@ object RetrieveDiagnosisKeysTransaction : Transaction() { ...@@ -205,6 +205,7 @@ object RetrieveDiagnosisKeysTransaction : Transaction() {
* Executes the TOKEN Transaction State * Executes the TOKEN Transaction State
*/ */
private suspend fun executeToken() = executeState(TOKEN) { private suspend fun executeToken() = executeState(TOKEN) {
googleAPITokenForRollback.set(LocalData.googleApiToken())
val tempToken = UUID.randomUUID().toString() val tempToken = UUID.randomUUID().toString()
LocalData.googleApiToken(tempToken) LocalData.googleApiToken(tempToken)
return@executeState tempToken return@executeState tempToken
......
...@@ -19,6 +19,7 @@ import org.junit.Test ...@@ -19,6 +19,7 @@ import org.junit.Test
import java.io.File import java.io.File
import java.nio.file.Paths import java.nio.file.Paths
import java.util.Date import java.util.Date
import java.util.UUID
/** /**
* RetrieveDiagnosisKeysTransaction test. * RetrieveDiagnosisKeysTransaction test.
...@@ -44,6 +45,7 @@ class RetrieveDiagnosisKeysTransactionTest { ...@@ -44,6 +45,7 @@ class RetrieveDiagnosisKeysTransactionTest {
every { LocalData.googleApiToken(any()) } just Runs every { LocalData.googleApiToken(any()) } just Runs
every { LocalData.lastTimeDiagnosisKeysFromServerFetch() } returns Date() every { LocalData.lastTimeDiagnosisKeysFromServerFetch() } returns Date()
every { LocalData.lastTimeDiagnosisKeysFromServerFetch(any()) } just Runs every { LocalData.lastTimeDiagnosisKeysFromServerFetch(any()) } just Runs
every { LocalData.googleApiToken() } returns UUID.randomUUID().toString()
} }
@Test @Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment