Skip to content

Commit

Permalink
fix merge issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadJaara committed May 3, 2024
1 parent 92c0262 commit e351dea
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,10 @@ class RegisterMLSClientUseCaseTest {
}.returns(result)
}

fun withIsMLSClientInitialisedReturns(result: Boolean = true) = apply {
<<<<<<< HEAD
every {
suspend fun withIsMLSClientInitialisedReturns(result: Boolean = true) = apply {
coEvery {
mlsClientProvider.isMLSClientInitialised()
}.returns(result)
=======
given(mlsClientProvider)
.suspendFunction(mlsClientProvider::isMLSClientInitialised)
.whenInvoked()
.thenReturn(result)
>>>>>>> 42db0701d9 (feat: support new MLS cipher suite [WPB-8592] (#2716))
}

suspend fun withRegisterMLSClient(result: Either<CoreFailure, Unit>) = apply {
Expand Down Expand Up @@ -230,6 +223,5 @@ class RegisterMLSClientUseCaseTest {
true, RANDOM_URL, DateTimeUtil.currentInstant()
)
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@ class MLSConfigHandlerTest {
MLS_CONFIG.copy(
status = Status.ENABLED,
defaultProtocol = SupportedProtocol.MLS
<<<<<<< HEAD
),
duringSlowSync = false
=======
), duringSlowSync = false
>>>>>>> 42db0701d9 (feat: support new MLS cipher suite [WPB-8592] (#2716))
)

coVerify {
Expand All @@ -76,12 +71,7 @@ class MLSConfigHandlerTest {
MLS_CONFIG.copy(
status = Status.ENABLED,
defaultProtocol = SupportedProtocol.PROTEUS
<<<<<<< HEAD
),
duringSlowSync = false
=======
), duringSlowSync = false
>>>>>>> 42db0701d9 (feat: support new MLS cipher suite [WPB-8592] (#2716))
)

coVerify {
Expand All @@ -102,12 +92,7 @@ class MLSConfigHandlerTest {
MLS_CONFIG.copy(
status = Status.DISABLED,
defaultProtocol = SupportedProtocol.MLS
<<<<<<< HEAD
),
duringSlowSync = false
=======
), duringSlowSync = false
>>>>>>> 42db0701d9 (feat: support new MLS cipher suite [WPB-8592] (#2716))
)

coVerify {
Expand All @@ -129,12 +114,7 @@ class MLSConfigHandlerTest {
MLS_CONFIG.copy(
status = Status.ENABLED,
supportedProtocols = setOf(SupportedProtocol.PROTEUS, SupportedProtocol.MLS)
<<<<<<< HEAD
),
duringSlowSync = false
=======
), duringSlowSync = false
>>>>>>> 42db0701d9 (feat: support new MLS cipher suite [WPB-8592] (#2716))
)

coVerify {
Expand All @@ -154,12 +134,8 @@ class MLSConfigHandlerTest {
handler.handle(
MLS_CONFIG.copy(
status = Status.DISABLED
<<<<<<< HEAD
),
duringSlowSync = false
=======

), duringSlowSync = false
>>>>>>> 42db0701d9 (feat: support new MLS cipher suite [WPB-8592] (#2716))
)

coVerify {
Expand All @@ -181,12 +157,7 @@ class MLSConfigHandlerTest {
MLS_CONFIG.copy(
status = Status.ENABLED,
supportedProtocols = setOf(SupportedProtocol.PROTEUS, SupportedProtocol.MLS)
<<<<<<< HEAD
),
duringSlowSync = false
=======
), duringSlowSync = false
>>>>>>> 42db0701d9 (feat: support new MLS cipher suite [WPB-8592] (#2716))
)

coVerify {
Expand All @@ -208,22 +179,15 @@ class MLSConfigHandlerTest {
MLS_CONFIG.copy(
status = Status.ENABLED,
supportedProtocols = setOf(SupportedProtocol.PROTEUS, SupportedProtocol.MLS)
<<<<<<< HEAD
),
duringSlowSync = true
=======
), duringSlowSync = true
>>>>>>> 42db0701d9 (feat: support new MLS cipher suite [WPB-8592] (#2716))
)

coVerify {
arrangement.updateSupportedProtocolsAndResolveOneOnOnes.invoke(eq(false))
}.wasInvoked(exactly = once)
}

<<<<<<< HEAD
private class Arrangement(private val block: suspend Arrangement.() -> Unit) :
=======

@Test
fun givenSupportedCipherSuiteIsNotNull_whenHandlling_thenStoreTheSupportedCipherSuite() = runTest {
val (arrangement, handler) = arrange {
Expand All @@ -249,20 +213,22 @@ class MLSConfigHandlerTest {
duringSlowSync = true,
)

verify(arrangement.userConfigRepository)
.suspendFunction(arrangement.userConfigRepository::setSupportedCipherSuite)
.with(eq(SupportedCipherSuite(
supported = listOf(
CipherSuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519,
CipherSuite.MLS_256_DHKEMP384_AES256GCM_SHA384_P384
),
default = CipherSuite.MLS_256_DHKEMP384_AES256GCM_SHA384_P384
)))
.wasInvoked(exactly = once)
coVerify {
arrangement.userConfigRepository.setSupportedCipherSuite(
eq(
SupportedCipherSuite(
supported = listOf(
CipherSuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519,
CipherSuite.MLS_256_DHKEMP384_AES256GCM_SHA384_P384
),
default = CipherSuite.MLS_256_DHKEMP384_AES256GCM_SHA384_P384
)
)
)
}.wasInvoked(exactly = once)
}

private class Arrangement(private val block: Arrangement.() -> Unit) :
>>>>>>> 42db0701d9 (feat: support new MLS cipher suite [WPB-8592] (#2716))
private class Arrangement(private val block: suspend Arrangement.() -> Unit) :
UserConfigRepositoryArrangement by UserConfigRepositoryArrangementImpl(),
UpdateSupportedProtocolsAndResolveOneOnOnesArrangement by UpdateSupportedProtocolsAndResolveOneOnOnesArrangementImpl() {
fun arrange() = run {
Expand All @@ -285,5 +251,4 @@ class MLSConfigHandlerTest {
supportedCipherSuite = null
)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,9 @@ internal interface UserConfigRepositoryArrangement {
suspend fun withSetSupportedProtocolsSuccessful()
fun withSetDefaultProtocolSuccessful()
fun withSetMLSEnabledSuccessful()
<<<<<<< HEAD
suspend fun withSetMigrationConfigurationSuccessful()
suspend fun withGetMigrationConfigurationReturning(result: Either<StorageFailure, MLSMigrationModel>)
=======
fun withSetMigrationConfigurationSuccessful()
fun withGetMigrationConfigurationReturning(result: Either<StorageFailure, MLSMigrationModel>)
fun withSetSupportedCipherSuite(result: Either<StorageFailure, Unit>)
>>>>>>> 42db0701d9 (feat: support new MLS cipher suite [WPB-8592] (#2716))
suspend fun withSetSupportedCipherSuite(result: Either<StorageFailure, Unit>)
}

internal class UserConfigRepositoryArrangementImpl : UserConfigRepositoryArrangement {
Expand Down Expand Up @@ -85,10 +80,7 @@ internal class UserConfigRepositoryArrangementImpl : UserConfigRepositoryArrange
}.returns(result)
}

override fun withSetSupportedCipherSuite(result: Either<StorageFailure, Unit>) {
given(userConfigRepository)
.suspendFunction(userConfigRepository::setSupportedCipherSuite)
.whenInvokedWith(any())
.thenReturn(result)
override suspend fun withSetSupportedCipherSuite(result: Either<StorageFailure, Unit>) {
coEvery { userConfigRepository.setSupportedCipherSuite(any()) }.returns(result)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ import com.wire.kalium.logic.data.conversation.Conversation
import com.wire.kalium.logic.data.id.ConversationId
import com.wire.kalium.logic.data.id.GroupID
import com.wire.kalium.logic.data.id.QualifiedIdMapperImpl
<<<<<<< HEAD
=======
import com.wire.kalium.logic.data.call.CallStatus
import com.wire.kalium.logic.data.mls.CipherSuite
>>>>>>> 42db0701d9 (feat: support new MLS cipher suite [WPB-8592] (#2716))
import com.wire.kalium.logic.feature.call.scenario.OnCloseCall
import com.wire.kalium.logic.framework.TestUser
import com.wire.kalium.network.NetworkState
Expand Down

0 comments on commit e351dea

Please sign in to comment.