test(account-recovery, auth, notification): Add fake classes for feature flags.

This commit is contained in:
Mateusz Armatys 2024-02-08 15:16:36 +01:00
parent babb2879ea
commit 6e04272d7d
8 changed files with 225 additions and 0 deletions

View File

@ -27,6 +27,14 @@ public final class me/proton/core/accountrecovery/test/MinimalAccountRecoveryNot
public static fun resetDevice (Lme/proton/core/accountrecovery/test/MinimalAccountRecoveryNotificationTest;)V
}
public final class me/proton/core/accountrecovery/test/fake/FakeIsAccountRecoveryEnabled : me/proton/core/accountrecovery/domain/IsAccountRecoveryEnabled {
public fun <init> ()V
public fun <init> (Z)V
public final fun getEnabled ()Z
public fun invoke (Lme/proton/core/domain/entity/UserId;)Z
public final fun setEnabled (Z)V
}
public final class me/proton/core/accountrecovery/test/robot/AccountRecoveryGracePeriodRobot {
public fun <init> ()V
public final fun clickContinue ()V

View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 2024 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonCore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.accountrecovery.test.fake
import me.proton.core.accountrecovery.domain.IsAccountRecoveryEnabled
import me.proton.core.domain.entity.UserId
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
public class FakeIsAccountRecoveryEnabled(
public var enabled: Boolean
) : IsAccountRecoveryEnabled {
@Inject
public constructor() : this(enabled = false)
override fun invoke(userId: UserId?): Boolean = enabled
}

View File

@ -141,6 +141,36 @@ public final class me/proton/core/auth/test/MinimalSignUpExternalTests$DefaultIm
public static fun signupSwitchToInternalAccountHappyPath (Lme/proton/core/auth/test/MinimalSignUpExternalTests;)V
}
public final class me/proton/core/auth/test/fake/FakeIsCredentialLessEnabled : me/proton/core/auth/domain/usecase/IsCredentialLessEnabled {
public fun <init> ()V
public fun <init> (Z)V
public fun <init> (ZLkotlin/jvm/functions/Function1;)V
public fun awaitIsRemoteDisabled-8Mi8wO0 (Lme/proton/core/domain/entity/UserId;JLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun getLocalEnabled ()Z
public final fun getRemoteEnabled ()Lkotlin/jvm/functions/Function1;
public fun invoke (Lme/proton/core/domain/entity/UserId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun isLocalEnabled ()Z
public final fun setLocalEnabled (Z)V
public final fun setRemoteEnabled (Lkotlin/jvm/functions/Function1;)V
}
public final class me/proton/core/auth/test/fake/FakeIsSsoCustomTabEnabled : me/proton/core/auth/domain/usecase/IsSsoCustomTabEnabled {
public fun <init> ()V
public fun <init> (Z)V
public final fun getEnabled ()Z
public fun invoke ()Z
public final fun setEnabled (Z)V
}
public final class me/proton/core/auth/test/fake/FakeIsSsoEnabled : me/proton/core/auth/domain/usecase/IsSsoEnabled {
public fun <init> ()V
public fun <init> (Z)V
public synthetic fun <init> (ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getEnabled ()Z
public fun invoke ()Z
public final fun setEnabled (Z)V
}
public final class me/proton/core/auth/test/flow/SignInFlow {
public static final field INSTANCE Lme/proton/core/auth/test/flow/SignInFlow;
public final fun signInExternal (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2024 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonCore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.auth.test.fake
import me.proton.core.auth.domain.usecase.IsCredentialLessEnabled
import me.proton.core.domain.entity.UserId
import javax.inject.Inject
import javax.inject.Singleton
import kotlin.time.Duration
@Singleton
public class FakeIsCredentialLessEnabled(
public var localEnabled: Boolean,
public var remoteEnabled: suspend () -> Boolean
) : IsCredentialLessEnabled {
public constructor(enabled: Boolean) : this(localEnabled = enabled, remoteEnabled = { enabled })
@Inject
public constructor() : this(enabled = false)
override suspend fun invoke(userId: UserId?): Boolean =
isLocalEnabled() && !awaitIsRemoteDisabled(userId = userId)
override fun isLocalEnabled(): Boolean = localEnabled
override suspend fun awaitIsRemoteDisabled(
userId: UserId?,
timeout: Duration
): Boolean = remoteEnabled()
}

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2024 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonCore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.auth.test.fake
import me.proton.core.auth.domain.usecase.IsSsoCustomTabEnabled
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
public class FakeIsSsoCustomTabEnabled(public var enabled: Boolean) : IsSsoCustomTabEnabled {
@Inject
public constructor() : this(enabled = false)
override fun invoke(): Boolean = enabled
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2024 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonCore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.auth.test.fake
import me.proton.core.auth.domain.usecase.IsSsoEnabled
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
public class FakeIsSsoEnabled(
public var enabled: Boolean = false
) : IsSsoEnabled {
@Inject
public constructor() : this(enabled = false)
override fun invoke(): Boolean = enabled
}

View File

@ -14,3 +14,11 @@ public final class me/proton/core/notification/test/deeplink/TestDeeplinkIntentP
public fun setPath (Landroid/content/Intent;Ljava/lang/String;)Landroid/content/Intent;
}
public final class me/proton/core/notification/test/fake/FakeIsNotificationsEnabled : me/proton/core/notification/domain/usecase/IsNotificationsEnabled {
public fun <init> ()V
public fun <init> (Z)V
public final fun getEnabled ()Z
public fun invoke (Lme/proton/core/domain/entity/UserId;)Z
public final fun setEnabled (Z)V
}

View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 2024 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonCore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.notification.test.fake
import me.proton.core.domain.entity.UserId
import me.proton.core.notification.domain.usecase.IsNotificationsEnabled
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
public class FakeIsNotificationsEnabled(
public var enabled: Boolean
) : IsNotificationsEnabled {
@Inject
public constructor() : this(enabled = false)
override fun invoke(userId: UserId?): Boolean = enabled
}