Skip to content

Commit

Permalink
Solving bugs related with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelplazaspalacio committed Jun 28, 2023
1 parent 73d6f63 commit 4c563e9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class SettingsSecurityViewModel(
fun getBiometricsState(): Boolean = preferencesProvider.getBoolean(BiometricActivity.PREFERENCE_SET_BIOMETRIC, false)

fun isSecurityEnforcedEnabled() =
mdmProvider.getBrandingBoolean(CONFIGURATION_DEVICE_PROTECTION, R.bool.device_protection) && isDeviceSecure() &&
mdmProvider.getBrandingBoolean(CONFIGURATION_DEVICE_PROTECTION, R.bool.device_protection) && !isDeviceSecure() &&
parseFromInteger(mdmProvider.getBrandingInteger(NO_MDM_RESTRICTION_YET, R.integer.lock_enforced)) != LockEnforcedType.DISABLED

fun isLockDelayEnforcedEnabled() = LockTimeout.parseFromInteger(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ class SettingsSecurityViewModelTest : ViewModelTest() {
}

@Test
fun `is security enforced enabled device protection device secure - ok - true`() {
fun `is security enforced enabled device protection device secure - ok - false`() {
every { isDeviceSecure() } returns true
every { mdmProvider.getBrandingBoolean(any(), R.bool.device_protection) } returns true
every { mdmProvider.getBrandingInteger(any(), R.integer.lock_enforced) } returns LockEnforcedType.EITHER_ENFORCED.ordinal

val result = securityViewModel.isSecurityEnforcedEnabled()
assertTrue(result)
assertFalse(result)

}

Expand All @@ -163,16 +163,6 @@ class SettingsSecurityViewModelTest : ViewModelTest() {
assertFalse(result)
}

@Test
fun `is security enforced enabled device protection device secure - ok - false`() {
every { isDeviceSecure() } returns true
every { mdmProvider.getBrandingBoolean(any(), R.bool.device_protection) } returns true
every { mdmProvider.getBrandingInteger(any(), R.integer.lock_enforced) } returns LockEnforcedType.EITHER_ENFORCED.ordinal

val result = securityViewModel.isSecurityEnforcedEnabled()
assertFalse(result)
}

@Test
fun `is security enforced enabled no device protection device no secure - ok - false`() {
every { isDeviceSecure() } returns false
Expand Down

0 comments on commit 4c563e9

Please sign in to comment.