mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-23 10:11:52 +03:00
update unit tests
This commit is contained in:
parent
9a19a9c608
commit
4490547e2d
@ -17,6 +17,7 @@
|
||||
package com.yubico.authenticator.oath
|
||||
|
||||
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
|
||||
import com.yubico.authenticator.ViewModelData
|
||||
import com.yubico.authenticator.device.Version
|
||||
import com.yubico.authenticator.oath.OathTestHelper.code
|
||||
import com.yubico.authenticator.oath.OathTestHelper.emptyCredentials
|
||||
@ -44,8 +45,7 @@ class ModelTest {
|
||||
Version(1, 2, 3),
|
||||
isAccessKeySet = false,
|
||||
isRemembered = false,
|
||||
isLocked = false,
|
||||
initialized = true
|
||||
isLocked = false
|
||||
)
|
||||
)
|
||||
}
|
||||
@ -117,7 +117,7 @@ class ModelTest {
|
||||
|
||||
viewModel.updateCredentials(m2)
|
||||
|
||||
assertEquals("device1", viewModel.sessionState.value?.deviceId)
|
||||
assertEquals("device1", viewModel.currentSession()?.deviceId)
|
||||
assertEquals(3, viewModel.credentials.value!!.size)
|
||||
assertTrue(viewModel.credentials.value!!.find { it.credential == cred1 } != null)
|
||||
assertTrue(viewModel.credentials.value!!.find { it.credential == cred2 } != null)
|
||||
@ -388,9 +388,9 @@ class ModelTest {
|
||||
val deviceId = "device"
|
||||
connectDevice(deviceId)
|
||||
viewModel.updateCredentials(mapOf(totp() to code()))
|
||||
viewModel.setSessionState(null)
|
||||
viewModel.clearSession()
|
||||
|
||||
assertNull(viewModel.sessionState.value)
|
||||
assertEquals(ViewModelData.Empty, viewModel.sessionState.value)
|
||||
assertNull(viewModel.credentials.value)
|
||||
}
|
||||
}
|
@ -40,8 +40,7 @@ class SerializationTest {
|
||||
Version(1, 2, 3),
|
||||
isAccessKeySet = false,
|
||||
isRemembered = false,
|
||||
isLocked = false,
|
||||
initialized = true
|
||||
isLocked = false
|
||||
)
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user