use of org.signal.storageservice.protos.groups.local.DecryptedGroupChange in project Signal-Android by WhisperSystems.
the class DecryptedGroupUtil_empty_Test method not_empty_with_modify_add_from_invite_link_access_field_15.
@Test
public void not_empty_with_modify_add_from_invite_link_access_field_15() {
DecryptedGroupChange change = DecryptedGroupChange.newBuilder().setNewInviteLinkAccess(AccessControl.AccessRequired.ADMINISTRATOR).build();
assertFalse(DecryptedGroupUtil.changeIsEmpty(change));
assertFalse(DecryptedGroupUtil.changeIsEmptyExceptForProfileKeyChanges(change));
}
use of org.signal.storageservice.protos.groups.local.DecryptedGroupChange in project Signal-Android by WhisperSystems.
the class DecryptedGroupUtil_empty_Test method not_empty_with_a_promote_requesting_member_field_18.
@Test
public void not_empty_with_a_promote_requesting_member_field_18() {
DecryptedGroupChange change = DecryptedGroupChange.newBuilder().addPromoteRequestingMembers(DecryptedApproveMember.getDefaultInstance()).build();
assertFalse(DecryptedGroupUtil.changeIsEmpty(change));
assertFalse(DecryptedGroupUtil.changeIsEmptyExceptForProfileKeyChanges(change));
}
use of org.signal.storageservice.protos.groups.local.DecryptedGroupChange in project Signal-Android by WhisperSystems.
the class GroupChangeUtil_resolveConflict_decryptedOnly_Test method field_5__unnecessary_role_changes_removed.
@Test
public void field_5__unnecessary_role_changes_removed() {
UUID member1 = UUID.randomUUID();
UUID member2 = UUID.randomUUID();
UUID member3 = UUID.randomUUID();
UUID memberNotInGroup = UUID.randomUUID();
DecryptedGroup groupState = DecryptedGroup.newBuilder().addMembers(admin(member1)).addMembers(member(member2)).addMembers(member(member3)).build();
DecryptedGroupChange decryptedChange = DecryptedGroupChange.newBuilder().addModifyMemberRoles(promoteAdmin(member1)).addModifyMemberRoles(promoteAdmin(member2)).addModifyMemberRoles(demoteAdmin(member3)).addModifyMemberRoles(promoteAdmin(memberNotInGroup)).build();
DecryptedGroupChange resolvedChanges = GroupChangeUtil.resolveConflict(groupState, decryptedChange).build();
DecryptedGroupChange expected = DecryptedGroupChange.newBuilder().addModifyMemberRoles(promoteAdmin(member2)).build();
assertEquals(expected, resolvedChanges);
}
use of org.signal.storageservice.protos.groups.local.DecryptedGroupChange in project Signal-Android by WhisperSystems.
the class GroupChangeUtil_resolveConflict_decryptedOnly_Test method field_18__promote_requesting_members.
@Test
public void field_18__promote_requesting_members() {
UUID member1 = UUID.randomUUID();
UUID member2 = UUID.randomUUID();
UUID member3 = UUID.randomUUID();
DecryptedGroup groupState = DecryptedGroup.newBuilder().addMembers(member(member1)).addRequestingMembers(requestingMember(member2)).build();
DecryptedGroupChange decryptedChange = DecryptedGroupChange.newBuilder().addPromoteRequestingMembers(approveMember(member1)).addPromoteRequestingMembers(approveMember(member2)).addPromoteRequestingMembers(approveMember(member3)).build();
DecryptedGroupChange resolvedChanges = GroupChangeUtil.resolveConflict(groupState, decryptedChange).build();
DecryptedGroupChange expected = DecryptedGroupChange.newBuilder().addPromoteRequestingMembers(approveMember(member2)).build();
assertEquals(expected, resolvedChanges);
}
use of org.signal.storageservice.protos.groups.local.DecryptedGroupChange in project Signal-Android by WhisperSystems.
the class GroupChangeUtil_resolveConflict_decryptedOnly_Test method field_14__no_membership_access_change_is_removed.
@Test
public void field_14__no_membership_access_change_is_removed() {
DecryptedGroup groupState = DecryptedGroup.newBuilder().setAccessControl(AccessControl.newBuilder().setMembers(AccessControl.AccessRequired.ADMINISTRATOR)).build();
DecryptedGroupChange decryptedChange = DecryptedGroupChange.newBuilder().setNewMemberAccess(AccessControl.AccessRequired.ADMINISTRATOR).build();
DecryptedGroupChange resolvedChanges = GroupChangeUtil.resolveConflict(groupState, decryptedChange).build();
assertTrue(DecryptedGroupUtil.changeIsEmpty(resolvedChanges));
}
Aggregations