Improve current push provider test: give info about the distributor.

This commit is contained in:
Benoit Marty 2025-01-02 10:56:57 +01:00
parent 0659174735
commit 6fb194f3dd
6 changed files with 165 additions and 15 deletions

View file

@ -17,7 +17,9 @@ import io.element.android.tests.testutils.lambda.lambdaError
class FakePushProvider(
override val index: Int = 0,
override val name: String = "aFakePushProvider",
override val supportMultipleDistributors: Boolean = false,
private val distributors: List<Distributor> = listOf(Distributor("aDistributorValue", "aDistributorName")),
private val currentDistributorValue: () -> String? = { lambdaError() },
private val currentDistributor: () -> Distributor? = { distributors.firstOrNull() },
private val currentUserPushConfig: CurrentUserPushConfig? = null,
private val registerWithResult: (MatrixClient, Distributor) -> Result<Unit> = { _, _ -> lambdaError() },
@ -32,6 +34,10 @@ class FakePushProvider(
return registerWithResult(matrixClient, distributor)
}
override suspend fun getCurrentDistributorValue(sessionId: SessionId): String? {
return currentDistributorValue()
}
override suspend fun getCurrentDistributor(sessionId: SessionId): Distributor? {
return currentDistributor()
}