Revert "fix(#688): route expired auth sessions to sign-in (#689)" (#698)

This reverts commit a5baf41545.
This commit is contained in:
M57 authored and GitHub committed 2026-07-23 12:40:29 +03:00
1 parent bc6c8a2e68
commit 7927944198
10 files changed
+4 -217

No files matched your search

@@ -1,11 +1,9 @@
package com.m57.hermescontrol.data.remote
import com.m57.hermescontrol.data.local.AuthSessionState
import kotlinx.coroutines.runBlocking
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.ResponseBody.Companion.toResponseBody
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
import retrofit2.Response
@@ -198,36 +196,4 @@ class NetworkResultTest {
assertTrue(unknownError.message.contains("Unexpected error"))
assertEquals(1, callCount) // Should not retry for unknown exceptions
}
@Test
fun testSafeApiCall_authExpired_triggersLatchWhenReportTrue() =
runBlocking {
AuthSessionState.resetForTest()
assertFalse(AuthSessionState.signInRequired.value)
val result =
safeApiCall<String>(reportAuthExpiry = true) {
Response.error(401, "Unauthorized".toResponseBody("text/plain".toMediaTypeOrNull()))
}
assertTrue(result is NetworkResult.Failure)
assertTrue((result as NetworkResult.Failure).error is NetworkError.AuthExpired)
assertTrue(AuthSessionState.signInRequired.value)
}
@Test
fun testSafeApiCall_authExpired_doesNotTriggerLatchWhenReportFalse() =
runBlocking {
AuthSessionState.resetForTest()
assertFalse(AuthSessionState.signInRequired.value)
val result =
safeApiCall<String>(reportAuthExpiry = false) {
Response.error(401, "Unauthorized".toResponseBody("text/plain".toMediaTypeOrNull()))
}
assertTrue(result is NetworkResult.Failure)
assertTrue((result as NetworkResult.Failure).error is NetworkError.AuthExpired)
assertFalse(AuthSessionState.signInRequired.value)
}
}