mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Add additional group terminate checks.
This commit is contained in:
@@ -129,7 +129,8 @@ class GroupManagerV2Test_edit {
|
||||
|
||||
every { groupTable.getGroup(groupId) } returns data.groupRecord
|
||||
every { groupTable.requireGroup(groupId) } returns data.groupRecord.get()
|
||||
every { groupTable.update(any<GroupId.V2>(), any(), any()) } returns Unit
|
||||
every { groupTable.update(any<GroupId.V2>(), any(), any(), anyNullable()) } returns Unit
|
||||
every { Recipient.self() } returns RecipientDatabaseTestUtils.createRecipient(isSelf = true, recipientId = RecipientId.from(1L))
|
||||
every { sendGroupUpdateHelper.sendGroupUpdate(masterKey, any(), any(), any()) } returns GroupManagerV2.RecipientAndThread(Recipient.UNKNOWN, 1)
|
||||
every { groupsV2API.patchGroup(any(), any(), any()) } returns GroupChangeResponse(group_change = data.groupChange!!)
|
||||
every { Recipient.externalGroupExact(groupId) } returns RecipientDatabaseTestUtils.createRecipient(resolved = true)
|
||||
@@ -141,7 +142,7 @@ class GroupManagerV2Test_edit {
|
||||
|
||||
private fun then(then: (DecryptedGroup) -> Unit) {
|
||||
val decryptedGroupArg = slot<DecryptedGroup>()
|
||||
verify { groupTable.update(groupId, capture(decryptedGroupArg), any()) }
|
||||
verify { groupTable.update(groupId, capture(decryptedGroupArg), any(), anyNullable()) }
|
||||
then(decryptedGroupArg.captured)
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ class GroupsV2StateProcessorTest {
|
||||
every { groupsV2Authorization.getAuthorizationForToday(serviceIds, secretParams) } returns null
|
||||
|
||||
if (data.expectTableUpdate) {
|
||||
justRun { groupTable.update(any<GroupMasterKey>(), any<DecryptedGroup>(), any<ReceivedGroupSendEndorsements>()) }
|
||||
justRun { groupTable.update(any<GroupMasterKey>(), any<DecryptedGroup>(), anyNullable<ReceivedGroupSendEndorsements>(), anyNullable<RecipientId>()) }
|
||||
}
|
||||
|
||||
if (data.expectTableCreate) {
|
||||
@@ -171,6 +171,7 @@ class GroupsV2StateProcessorTest {
|
||||
if (data.expectTableUpdate || data.expectTableCreate) {
|
||||
justRun { profileAndMessageHelper.storeMessage(any(), any(), any()) }
|
||||
justRun { profileAndMessageHelper.persistLearnedProfileKeys(any<ProfileKeySet>()) }
|
||||
justRun { profileAndMessageHelper.stopAllTypingForGroup() }
|
||||
}
|
||||
|
||||
data.serverState?.let { serverState ->
|
||||
@@ -1052,7 +1053,7 @@ class GroupsV2StateProcessorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `when P2P change terminates group with known editor, then setTerminatedBy is called`() {
|
||||
fun `when P2P change terminates group with known editor, then update is called with terminator recipient id`() {
|
||||
val adminAci: ACI = ACI.from(UUID.randomUUID())
|
||||
val adminRecipientId = RecipientId.from(200)
|
||||
|
||||
@@ -1065,7 +1066,6 @@ class GroupsV2StateProcessorTest {
|
||||
}
|
||||
|
||||
every { recipientTable.getAndPossiblyMerge(adminAci, null) } returns adminRecipientId
|
||||
justRun { groupTable.setTerminatedBy(groupId, adminRecipientId) }
|
||||
|
||||
val signedChange = DecryptedGroupChange(
|
||||
revision = 6,
|
||||
@@ -1087,7 +1087,7 @@ class GroupsV2StateProcessorTest {
|
||||
assertThat(it.terminated, "group should be terminated").isEqualTo(true)
|
||||
}
|
||||
|
||||
verify { groupTable.setTerminatedBy(groupId, adminRecipientId) }
|
||||
verify { groupTable.update(masterKey, match { it.terminated }, null, adminRecipientId) }
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user