2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/19797 - Remove FenixAccountManager#signedInToFxa

After the changes from this patch this api is not used anymore so to prevent
future misuses of it this is removed in favor of the new "accountState".
This commit is contained in:
Mugurell 2021-06-16 11:23:24 +03:00
parent 00e54ff915
commit 60725fc1f9
2 changed files with 0 additions and 48 deletions

View File

@ -34,16 +34,6 @@ open class FenixAccountManager(context: Context) {
AccountState.AUTHENTICATED
}
}
/**
* Check if the current account is signed in and authenticated.
*/
fun signedInToFxa(): Boolean {
val account = accountManager.authenticatedAccount()
val needsReauth = accountManager.accountNeedsReauth()
return account != null && !needsReauth
}
}
/**

View File

@ -11,9 +11,7 @@ import mozilla.components.concept.sync.OAuthAccount
import mozilla.components.concept.sync.Profile
import mozilla.components.service.fxa.manager.FxaAccountManager
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertSame
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@ -64,42 +62,6 @@ class FenixAccountManagerTest {
assertEquals(null, result)
}
@Test
fun `GIVEN an account is signed in and authenticated THEN check returns true`() {
every { accountManagerComponent.authenticatedAccount() } returns account
every { accountManagerComponent.accountNeedsReauth() } returns false
every { context.components.backgroundServices.accountManager } returns accountManagerComponent
fenixFxaManager = FenixAccountManager(context)
val signedIn = fenixFxaManager.signedInToFxa()
assertTrue(signedIn)
}
@Test
fun `GIVEN an account is signed in and NOT authenticated THEN check returns false`() {
every { accountManagerComponent.authenticatedAccount() } returns account
every { accountManagerComponent.accountNeedsReauth() } returns true
every { context.components.backgroundServices.accountManager } returns accountManagerComponent
fenixFxaManager = FenixAccountManager(context)
val signedIn = fenixFxaManager.signedInToFxa()
assertFalse(signedIn)
}
@Test
fun `GIVEN an account is not signed in THEN check returns false`() {
every { accountManagerComponent.authenticatedAccount() } returns null
every { accountManagerComponent.accountNeedsReauth() } returns true
every { context.components.backgroundServices.accountManager } returns accountManagerComponent
fenixFxaManager = FenixAccountManager(context)
val signedIn = fenixFxaManager.signedInToFxa()
assertFalse(signedIn)
}
@Test
fun `GIVEN no account exists WHEN accountState is called THEN it returns AccountState#NO_ACCOUNT`() {
every { context.components.backgroundServices.accountManager } returns accountManagerComponent