mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-18 20:29:10 +03:00
Test framework cleaning
This commit is contained in:
parent
89267256ef
commit
1b12db9270
6 changed files with 22 additions and 24 deletions
|
@ -87,15 +87,13 @@ class CommonTestHelper internal constructor(context: Context, val cryptoConfig:
|
|||
internal fun runCryptoTest(context: Context, cryptoConfig: MXCryptoConfig? = null, autoSignoutOnClose: Boolean = true, block: suspend CoroutineScope.(CryptoTestHelper, CommonTestHelper) -> Unit) {
|
||||
val testHelper = CommonTestHelper(context, cryptoConfig)
|
||||
val cryptoTestHelper = CryptoTestHelper(testHelper)
|
||||
return try {
|
||||
runTest(dispatchTimeoutMs = TestConstants.timeOutMillis * 2) {
|
||||
withContext(Dispatchers.Main) {
|
||||
return runTest(dispatchTimeoutMs = TestConstants.timeOutMillis) {
|
||||
try {
|
||||
withContext(Dispatchers.Default) {
|
||||
block(cryptoTestHelper, testHelper)
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (autoSignoutOnClose) {
|
||||
runBlocking {
|
||||
} finally {
|
||||
if (autoSignoutOnClose) {
|
||||
testHelper.cleanUpOpenedSessions()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,8 +193,8 @@ class KeyShareTests : InstrumentedTest {
|
|||
|
||||
cryptoTestHelper.ensureCanDecrypt(listOf(receivedEvent.eventId), aliceSession2, roomId, listOf(sentEventText ?: ""))
|
||||
|
||||
commonTestHelper.signOutAndClose(aliceSession)
|
||||
commonTestHelper.signOutAndClose(aliceSession2)
|
||||
// commonTestHelper.signOutAndClose(aliceSession)
|
||||
// commonTestHelper.signOutAndClose(aliceSession2)
|
||||
}
|
||||
|
||||
// See E2ESanityTest for a test regarding secret sharing
|
||||
|
@ -272,8 +272,8 @@ class KeyShareTests : InstrumentedTest {
|
|||
ownDeviceReply != null && ownDeviceReply.result is RequestResult.Success
|
||||
}
|
||||
|
||||
commonTestHelper.signOutAndClose(aliceSession)
|
||||
commonTestHelper.signOutAndClose(aliceNewSession)
|
||||
// commonTestHelper.signOutAndClose(aliceSession)
|
||||
// commonTestHelper.signOutAndClose(aliceNewSession)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -387,9 +387,9 @@ class KeyShareTests : InstrumentedTest {
|
|||
result != null && result is RequestResult.Success && result.chainIndex == 3
|
||||
}
|
||||
|
||||
commonTestHelper.signOutAndClose(aliceNewSession)
|
||||
commonTestHelper.signOutAndClose(aliceSession)
|
||||
commonTestHelper.signOutAndClose(bobSession)
|
||||
// commonTestHelper.signOutAndClose(aliceNewSession)
|
||||
// commonTestHelper.signOutAndClose(aliceSession)
|
||||
// commonTestHelper.signOutAndClose(bobSession)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -479,8 +479,8 @@ class KeyShareTests : InstrumentedTest {
|
|||
val outgoing = aliceNewSession.cryptoService().getOutgoingRoomKeyRequests().firstOrNull { it.sessionId == sentEventMegolmSession }
|
||||
assertEquals("The request should be canceled", OutgoingRoomKeyRequestState.SENT_THEN_CANCELED, outgoing!!.state)
|
||||
|
||||
commonTestHelper.signOutAndClose(aliceNewSession)
|
||||
commonTestHelper.signOutAndClose(aliceSession)
|
||||
commonTestHelper.signOutAndClose(bobSession)
|
||||
// commonTestHelper.signOutAndClose(aliceNewSession)
|
||||
// commonTestHelper.signOutAndClose(aliceSession)
|
||||
// commonTestHelper.signOutAndClose(bobSession)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ class QuadSTests : InstrumentedTest {
|
|||
assertNotNull(defaultKeyAccountData?.content)
|
||||
assertEquals("Unexpected default key ${defaultKeyAccountData?.content}", TEST_KEY_ID, defaultKeyAccountData?.content?.get("key"))
|
||||
|
||||
testHelper.signOutAndClose(aliceSession)
|
||||
// testHelper.signOutAndClose(aliceSession)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -300,8 +300,8 @@ class VerificationTest : InstrumentedTest {
|
|||
requests.any { it.cancelConclusion == CancelCode.AcceptedByAnotherDevice }
|
||||
}
|
||||
|
||||
testHelper.signOutAndClose(aliceSessionToVerify)
|
||||
testHelper.signOutAndClose(aliceSessionThatVerifies)
|
||||
testHelper.signOutAndClose(aliceSessionThatReceivesCanceledEvent)
|
||||
// testHelper.signOutAndClose(aliceSessionToVerify)
|
||||
// testHelper.signOutAndClose(aliceSessionThatVerifies)
|
||||
// testHelper.signOutAndClose(aliceSessionThatReceivesCanceledEvent)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,8 +124,8 @@ class SpaceCreationTest : InstrumentedTest {
|
|||
assertEquals("Room name should be set", roomName, spaceBobPov?.asRoom()?.roomSummary()?.name)
|
||||
assertEquals("Room topic should be set", topic, spaceBobPov?.asRoom()?.roomSummary()?.topic)
|
||||
|
||||
commonTestHelper.signOutAndClose(aliceSession)
|
||||
commonTestHelper.signOutAndClose(bobSession)
|
||||
// commonTestHelper.signOutAndClose(aliceSession)
|
||||
// commonTestHelper.signOutAndClose(bobSession)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -334,7 +334,7 @@ class SpaceHierarchyTest : InstrumentedTest {
|
|||
}
|
||||
)
|
||||
|
||||
commonTestHelper.signOutAndClose(session)
|
||||
// commonTestHelper.signOutAndClose(session)
|
||||
}
|
||||
|
||||
data class TestSpaceCreationResult(
|
||||
|
|
Loading…
Add table
Reference in a new issue