use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.
the class GroupChangeReconstructTest method access_control_change_membership_and_attributes.
@Test
public void access_control_change_membership_and_attributes() {
DecryptedGroup from = DecryptedGroup.newBuilder().setAccessControl(AccessControl.newBuilder().setMembers(AccessControl.AccessRequired.MEMBER).setAttributes(AccessControl.AccessRequired.ADMINISTRATOR)).build();
DecryptedGroup to = DecryptedGroup.newBuilder().setAccessControl(AccessControl.newBuilder().setMembers(AccessControl.AccessRequired.ADMINISTRATOR).setAttributes(AccessControl.AccessRequired.MEMBER)).build();
DecryptedGroupChange decryptedGroupChange = GroupChangeReconstruct.reconstructGroupChange(from, to);
assertEquals(DecryptedGroupChange.newBuilder().setNewMemberAccess(AccessControl.AccessRequired.ADMINISTRATOR).setNewAttributeAccess(AccessControl.AccessRequired.MEMBER).build(), decryptedGroupChange);
}
use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.
the class GroupChangeReconstructTest method avatar_change.
@Test
public void avatar_change() {
DecryptedGroup from = DecryptedGroup.newBuilder().setAvatar("A").build();
DecryptedGroup to = DecryptedGroup.newBuilder().setAvatar("B").build();
DecryptedGroupChange decryptedGroupChange = GroupChangeReconstruct.reconstructGroupChange(from, to);
assertEquals(DecryptedGroupChange.newBuilder().setNewAvatar(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 timer_change.
@Test
public void timer_change() {
DecryptedGroup from = DecryptedGroup.newBuilder().setDisappearingMessagesTimer(DecryptedTimer.newBuilder().setDuration(100)).build();
DecryptedGroup to = DecryptedGroup.newBuilder().setDisappearingMessagesTimer(DecryptedTimer.newBuilder().setDuration(200)).build();
DecryptedGroupChange decryptedGroupChange = GroupChangeReconstruct.reconstructGroupChange(from, to);
assertEquals(DecryptedGroupChange.newBuilder().setNewTimer(DecryptedTimer.newBuilder().setDuration(200)).build(), decryptedGroupChange);
}
use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.
the class GroupChangeReconstructTest method new_requesting_members_ignores_existing_by_uuid.
@Test
public void new_requesting_members_ignores_existing_by_uuid() {
UUID member1 = UUID.randomUUID();
UUID member2 = UUID.randomUUID();
ProfileKey profileKey2 = newProfileKey();
DecryptedGroup from = DecryptedGroup.newBuilder().addRequestingMembers(requestingMember(member1, newProfileKey())).build();
DecryptedGroup to = DecryptedGroup.newBuilder().addRequestingMembers(requestingMember(member1, newProfileKey())).addRequestingMembers(requestingMember(member2, profileKey2)).build();
DecryptedGroupChange decryptedGroupChange = GroupChangeReconstruct.reconstructGroupChange(from, to);
assertEquals(DecryptedGroupChange.newBuilder().addNewRequestingMembers(requestingMember(member2, profileKey2)).build(), decryptedGroupChange);
}
use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.
the class GroupChangeReconstructTest method announcement_group_change.
@Test
public void announcement_group_change() {
DecryptedGroup from = DecryptedGroup.newBuilder().setIsAnnouncementGroup(EnabledState.DISABLED).build();
DecryptedGroup to = DecryptedGroup.newBuilder().setIsAnnouncementGroup(EnabledState.ENABLED).build();
DecryptedGroupChange decryptedGroupChange = GroupChangeReconstruct.reconstructGroupChange(from, to);
assertEquals(DecryptedGroupChange.newBuilder().setNewIsAnnouncementGroup(EnabledState.ENABLED).build(), decryptedGroupChange);
}
Aggregations