Move FakeAccountProviderAccessControl to the login test module

The fake was declared in RootFlowNodeTest, so other tests could not use
it. Move it next to the API it fakes, in a package mirroring the one of
the API, and let the result be provided by the caller, so that the case
where the account provider is not allowed can be tested too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benoit Marty
2026-08-20 15:20:33 +02:00
parent 67500edafa
commit 5bdaea3f6e
2 changed files with 21 additions and 6 deletions
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2026 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
* Please see LICENSE files in the repository root for full details.
*/
package io.element.android.features.login.test.accesscontrol
import io.element.android.features.login.api.accesscontrol.AccountProviderAccessControl
import io.element.android.tests.testutils.lambda.lambdaError
class FakeAccountProviderAccessControl(
private val isAllowedToConnectToAccountProviderResult: (String) -> Boolean = { lambdaError() },
) : AccountProviderAccessControl {
override suspend fun isAllowedToConnectToAccountProvider(accountProviderUrl: String): Boolean {
return isAllowedToConnectToAccountProviderResult(accountProviderUrl)
}
}