use of org.signal.storageservice.protos.groups.local.DecryptedMember in project Signal-Android by signalapp.
the class DecryptedGroupUtil_apply_Test method apply_new_member_already_in_the_group_by_uuid.
@Test
public void apply_new_member_already_in_the_group_by_uuid() throws NotAbleToApplyGroupV2ChangeException {
DecryptedMember member1 = member(UUID.randomUUID());
UUID member2Uuid = UUID.randomUUID();
DecryptedMember member2a = member(member2Uuid, newProfileKey());
DecryptedMember member2b = member(member2Uuid, newProfileKey());
DecryptedGroup newGroup = DecryptedGroupUtil.apply(DecryptedGroup.newBuilder().setRevision(10).addMembers(member1).addMembers(member2a).build(), DecryptedGroupChange.newBuilder().setRevision(11).addNewMembers(member2b).build());
assertEquals(DecryptedGroup.newBuilder().setRevision(11).addMembers(member1).addMembers(member2b).build(), newGroup);
}
use of org.signal.storageservice.protos.groups.local.DecryptedMember in project Signal-Android by signalapp.
the class DecryptedGroupUtil_apply_Test method apply_remove_members_not_found.
@Test
public void apply_remove_members_not_found() throws NotAbleToApplyGroupV2ChangeException {
DecryptedMember member1 = member(UUID.randomUUID());
DecryptedMember member2 = member(UUID.randomUUID());
DecryptedGroup newGroup = DecryptedGroupUtil.apply(DecryptedGroup.newBuilder().setRevision(13).addMembers(member1).build(), DecryptedGroupChange.newBuilder().setRevision(14).addDeleteMembers(member2.getUuid()).build());
assertEquals(DecryptedGroup.newBuilder().addMembers(member1).setRevision(14).build(), newGroup);
}
use of org.signal.storageservice.protos.groups.local.DecryptedMember in project Signal-Android by signalapp.
the class DecryptedGroupUtil_apply_Test method cannot_promote_pending_member_if_not_in_group.
@Test(expected = NotAbleToApplyGroupV2ChangeException.class)
public void cannot_promote_pending_member_if_not_in_group() throws NotAbleToApplyGroupV2ChangeException {
ProfileKey profileKey2 = randomProfileKey();
DecryptedMember member1 = member(UUID.randomUUID());
UUID pending2Uuid = UUID.randomUUID();
DecryptedMember member2 = withProfileKey(admin(pending2Uuid), profileKey2);
DecryptedGroupUtil.apply(DecryptedGroup.newBuilder().setRevision(10).addMembers(member1).build(), DecryptedGroupChange.newBuilder().setRevision(11).addPromotePendingMembers(member2).build());
}
use of org.signal.storageservice.protos.groups.local.DecryptedMember in project Signal-Android by signalapp.
the class DecryptedGroupUtil_apply_Test method apply_modify_member_role.
@Test
public void apply_modify_member_role() throws NotAbleToApplyGroupV2ChangeException {
DecryptedMember member1 = member(UUID.randomUUID());
DecryptedMember member2 = admin(UUID.randomUUID());
DecryptedGroup newGroup = DecryptedGroupUtil.apply(DecryptedGroup.newBuilder().setRevision(13).addMembers(member1).addMembers(member2).build(), DecryptedGroupChange.newBuilder().setRevision(14).addModifyMemberRoles(DecryptedModifyMemberRole.newBuilder().setUuid(member1.getUuid()).setRole(Member.Role.ADMINISTRATOR)).addModifyMemberRoles(DecryptedModifyMemberRole.newBuilder().setUuid(member2.getUuid()).setRole(Member.Role.DEFAULT)).build());
assertEquals(DecryptedGroup.newBuilder().setRevision(14).addMembers(asAdmin(member1)).addMembers(asMember(member2)).build(), newGroup);
}
use of org.signal.storageservice.protos.groups.local.DecryptedMember in project Signal-Android by signalapp.
the class DecryptedGroupUtil_apply_Test method not_able_to_apply_modify_member_role_for_no_role.
@Test(expected = NotAbleToApplyGroupV2ChangeException.class)
public void not_able_to_apply_modify_member_role_for_no_role() throws NotAbleToApplyGroupV2ChangeException {
DecryptedMember member1 = member(UUID.randomUUID());
DecryptedGroupUtil.apply(DecryptedGroup.newBuilder().setRevision(13).addMembers(member1).build(), DecryptedGroupChange.newBuilder().setRevision(14).addModifyMemberRoles(DecryptedModifyMemberRole.newBuilder().setUuid(member1.getUuid()).build()).build());
}
Aggregations