Skip to content
Snippets Groups Projects
Unverified Commit 2b828505 authored by Juraj Kusnier's avatar Juraj Kusnier Committed by GitHub
Browse files

Exposure Checks are continued in End-of-Life State (EXPOSUREAPP-5298) #2435


* Add check for positive test in DownloadDiagnosisKeysTask

* Update DownloadDiagnosisKeysTaskTest

* Suppress detekt rule

Co-authored-by: default avatarharambasicluka <64483219+harambasicluka@users.noreply.github.com>
parent c4588eb0
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ import de.rki.coronawarnapp.environment.EnvironmentSetup
import de.rki.coronawarnapp.nearby.ENFClient
import de.rki.coronawarnapp.nearby.modules.detectiontracker.TrackedExposureDetection
import de.rki.coronawarnapp.risk.RollbackItem
import de.rki.coronawarnapp.storage.LocalData
import de.rki.coronawarnapp.task.Task
import de.rki.coronawarnapp.task.TaskCancellationException
import de.rki.coronawarnapp.task.TaskFactory
......@@ -25,6 +26,7 @@ import java.util.Date
import javax.inject.Inject
import javax.inject.Provider
@Suppress("ReturnCount")
class DownloadDiagnosisKeysTask @Inject constructor(
private val enfClient: ENFClient,
private val environmentSetup: EnvironmentSetup,
......@@ -111,6 +113,11 @@ class DownloadDiagnosisKeysTask @Inject constructor(
// remember version code of this execution for next time
settings.updateLastVersionCodeToCurrent()
if (LocalData.isAllowedToSubmitDiagnosisKeys()) {
Timber.tag(TAG).i("task aborted, positive test result")
return object : Task.Result {}
}
Timber.tag(TAG).d("Attempting submission to ENF")
val isSubmissionSuccessful = enfClient.provideDiagnosisKeys(
availableKeyFiles,
......
......@@ -8,6 +8,7 @@ import de.rki.coronawarnapp.environment.BuildConfigWrap
import de.rki.coronawarnapp.environment.EnvironmentSetup
import de.rki.coronawarnapp.nearby.ENFClient
import de.rki.coronawarnapp.nearby.modules.detectiontracker.TrackedExposureDetection
import de.rki.coronawarnapp.storage.LocalData
import de.rki.coronawarnapp.util.TimeStamper
import io.mockk.MockKAnnotations
import io.mockk.Runs
......@@ -54,6 +55,8 @@ class DownloadDiagnosisKeysTaskTest : BaseTest() {
mockkObject(BuildConfigWrap)
every { BuildConfigWrap.VERSION_CODE } returns 1080005
mockkObject(LocalData)
every { LocalData.isAllowedToSubmitDiagnosisKeys() } returns false
availableKey1.apply {
every { path } returns File("availableKey1")
......@@ -230,4 +233,20 @@ class DownloadDiagnosisKeysTaskTest : BaseTest() {
enfClient.provideDiagnosisKeys(any(), any())
}
}
@Test
fun `we do not submit keys if user got positive test results`() = runBlockingTest {
every { LocalData.isAllowedToSubmitDiagnosisKeys() } returns true
createInstance().run(DownloadDiagnosisKeysTask.Arguments())
coVerifySequence {
enfClient.isTracingEnabled
enfClient.latestTrackedExposureDetection()
}
coVerify(exactly = 0) {
enfClient.provideDiagnosisKeys(any(), any())
}
}
}
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