use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.
the class GroupChangeReconstructTest method to_admin.
@Test
public void to_admin() {
UUID uuid = UUID.randomUUID();
ProfileKey profileKey = randomProfileKey();
DecryptedGroup from = DecryptedGroup.newBuilder().addMembers(withProfileKey(member(uuid), profileKey)).build();
DecryptedGroup to = DecryptedGroup.newBuilder().addMembers(withProfileKey(admin(uuid), profileKey)).build();
DecryptedGroupChange decryptedGroupChange = GroupChangeReconstruct.reconstructGroupChange(from, to);
assertEquals(DecryptedGroupChange.newBuilder().addModifyMemberRoles(promoteAdmin(uuid)).build(), decryptedGroupChange);
}
use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.
the class GroupChangeReconstructTest method promote_requesting_members.
@Test
public void promote_requesting_members() {
UUID member1 = UUID.randomUUID();
ProfileKey profileKey1 = newProfileKey();
UUID member2 = UUID.randomUUID();
ProfileKey profileKey2 = newProfileKey();
DecryptedGroup from = DecryptedGroup.newBuilder().addRequestingMembers(requestingMember(member1, profileKey1)).addRequestingMembers(requestingMember(member2, profileKey2)).build();
DecryptedGroup to = DecryptedGroup.newBuilder().addMembers(member(member1, profileKey1)).addMembers(admin(member2, profileKey2)).build();
DecryptedGroupChange decryptedGroupChange = GroupChangeReconstruct.reconstructGroupChange(from, to);
assertEquals(DecryptedGroupChange.newBuilder().addPromoteRequestingMembers(approveMember(member1)).addPromoteRequestingMembers(approveAdmin(member2)).build(), decryptedGroupChange);
}
use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.
the class GroupChangeReconstructTest method description_change.
@Test
public void description_change() {
DecryptedGroup from = DecryptedGroup.newBuilder().setDescription("A").build();
DecryptedGroup to = DecryptedGroup.newBuilder().setDescription("B").build();
DecryptedGroupChange decryptedGroupChange = GroupChangeReconstruct.reconstructGroupChange(from, to);
assertEquals(DecryptedGroupChange.newBuilder().setNewDescription(DecryptedString.newBuilder().setValue("B")).build(), decryptedGroupChange);
}
use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.
the class GroupChangeReconstructTest method removed_requesting_members.
@Test
public void removed_requesting_members() {
UUID member1 = UUID.randomUUID();
DecryptedGroup from = DecryptedGroup.newBuilder().addRequestingMembers(requestingMember(member1, newProfileKey())).build();
DecryptedGroup to = DecryptedGroup.newBuilder().build();
DecryptedGroupChange decryptedGroupChange = GroupChangeReconstruct.reconstructGroupChange(from, to);
assertEquals(DecryptedGroupChange.newBuilder().addDeleteRequestingMembers(UuidUtil.toByteString(member1)).build(), decryptedGroupChange);
}
use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.
the class GroupsV2Operations_decrypt_group_Test method decrypt_description_field_11.
@Test
public void decrypt_description_field_11() throws VerificationFailedException, InvalidGroupStateException {
Group group = Group.newBuilder().setDescription(groupOperations.encryptDescription("Description!")).build();
DecryptedGroup decryptedGroup = groupOperations.decryptGroup(group);
assertEquals("Description!", decryptedGroup.getDescription());
}
Aggregations