Update CryptoTestData to handle more than 3 sessions.
This commit is contained in:
parent
9b332f7a32
commit
7e4725c091
|
@ -18,14 +18,21 @@ package org.matrix.android.sdk.common
|
||||||
|
|
||||||
import org.matrix.android.sdk.api.session.Session
|
import org.matrix.android.sdk.api.session.Session
|
||||||
|
|
||||||
data class CryptoTestData(val firstSession: Session,
|
data class CryptoTestData(val roomId: String,
|
||||||
val roomId: String,
|
val sessions: List<Session> = emptyList()) {
|
||||||
val secondSession: Session? = null,
|
|
||||||
val thirdSession: Session? = null) {
|
val firstSession: Session
|
||||||
|
get() = sessions.first()
|
||||||
|
|
||||||
|
val secondSession: Session?
|
||||||
|
get() = sessions.getOrNull(1)
|
||||||
|
|
||||||
|
val thirdSession: Session?
|
||||||
|
get() = sessions.getOrNull(2)
|
||||||
|
|
||||||
fun cleanUp(testHelper: CommonTestHelper) {
|
fun cleanUp(testHelper: CommonTestHelper) {
|
||||||
testHelper.signOutAndClose(firstSession)
|
sessions.forEach {
|
||||||
secondSession?.let { testHelper.signOutAndClose(it) }
|
testHelper.signOutAndClose(it)
|
||||||
thirdSession?.let { testHelper.signOutAndClose(it) }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CryptoTestData(aliceSession, roomId)
|
return CryptoTestData(roomId, listOf(aliceSession))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,7 +139,7 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) {
|
||||||
// assertNotNull(roomFromBobPOV.powerLevels)
|
// assertNotNull(roomFromBobPOV.powerLevels)
|
||||||
// assertTrue(roomFromBobPOV.powerLevels.maySendMessage(bobSession.myUserId))
|
// assertTrue(roomFromBobPOV.powerLevels.maySendMessage(bobSession.myUserId))
|
||||||
|
|
||||||
return CryptoTestData(aliceSession, aliceRoomId, bobSession)
|
return CryptoTestData(aliceRoomId, listOf(aliceSession, bobSession))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,7 +157,7 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) {
|
||||||
// wait the initial sync
|
// wait the initial sync
|
||||||
SystemClock.sleep(1000)
|
SystemClock.sleep(1000)
|
||||||
|
|
||||||
return CryptoTestData(aliceSession, aliceRoomId, cryptoTestData.secondSession, samSession)
|
return CryptoTestData(aliceRoomId, listOf(aliceSession, cryptoTestData.secondSession!!, samSession))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue