Skip to content

Commit

Permalink
Create an update group to add avatar parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
FuDongHai committed Jul 23, 2024
1 parent 5a89470 commit 1cb9684
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ void testGroupCreatePublicWithCustom() {
void testGroupCreatePrivateWithNeedVerify() {
String randomOwnerUsername = Utilities.randomUserName();
String randomPassword = Utilities.randomPassword();
String avatar = "http://localhost:8080/image.png";

String randomMemberUsername = Utilities.randomUserName();
List<String> members = new ArrayList<>();
Expand All @@ -96,11 +97,14 @@ void testGroupCreatePrivateWithNeedVerify() {
.block(Utilities.IT_TIMEOUT));
String groupId = assertDoesNotThrow(() -> this.service.group()
.createPrivateGroup(randomOwnerUsername, "group", "group description", members, 200,
true, true, true, "custom", false).block(Utilities.IT_TIMEOUT));
true, true, true, "custom", false, "http://localhost:8080/image.png").block(Utilities.IT_TIMEOUT));
EMPage<String> groupMemberPage = assertDoesNotThrow(
() -> this.service.group().listGroupMembers(groupId, 100, null)
.block(Utilities.IT_TIMEOUT));

EMGroup group = assertDoesNotThrow(() -> this.service.group().getGroup(groupId).block(Utilities.IT_TIMEOUT));
assertEquals(avatar, group.getAvatar());

List<String> groupMembers = groupMemberPage.getValues();
if (groupMembers.size() != members.size()) {
throw new RuntimeException(
Expand Down Expand Up @@ -160,7 +164,7 @@ void testGroupCreatePublicWithNeedVerify() {
.block(Utilities.IT_TIMEOUT));
String groupId = assertDoesNotThrow(() -> this.service.group()
.createPublicGroup(randomOwnerUsername, "politics", "group description", members, 200,
true, "custom", true).block(Utilities.IT_TIMEOUT));
true, "custom", true, "http://localhost:8080/image.png").block(Utilities.IT_TIMEOUT));
EMPage<String> groupMemberPage = assertDoesNotThrow(
() -> this.service.group().listGroupMembers(groupId, 10, null)
.block(Utilities.IT_TIMEOUT));
Expand Down Expand Up @@ -191,7 +195,7 @@ void testLargeGroupCreatePublic() {
.block(Utilities.IT_TIMEOUT));
String groupId = assertDoesNotThrow(() -> this.service.group()
.createLargePublicGroup(randomOwnerUsername, "politics", "group description", members, 5000,
true, "custom", true).block(Utilities.IT_TIMEOUT));
true, "custom", true, "http://localhost:8080/image.png").block(Utilities.IT_TIMEOUT));
EMGroup group = assertDoesNotThrow(
() -> this.service.group().getGroup(groupId)
.block(Utilities.IT_TIMEOUT));
Expand Down Expand Up @@ -224,7 +228,7 @@ void testLargeGroupCreatePublicWithCustomGroupId() {
String customGroupId = String.valueOf(10000000 + random.nextInt(80000000));
String groupId = assertDoesNotThrow(() -> this.service.group()
.createLargePublicGroup(customGroupId, randomOwnerUsername, "politics", "group description", members, 5000,
true, "custom", true).block(Utilities.IT_TIMEOUT));
true, "custom", true, "http://localhost:8080/image.png").block(Utilities.IT_TIMEOUT));
EMGroup group = assertDoesNotThrow(
() -> this.service.group().getGroup(groupId)
.block(Utilities.IT_TIMEOUT));
Expand Down Expand Up @@ -258,7 +262,7 @@ void testLargeGroupCreatePrivate() {
.block(Utilities.IT_TIMEOUT));
String groupId = assertDoesNotThrow(() -> this.service.group()
.createLargePrivateGroup(randomOwnerUsername, "group", "group description", members, 5000,
true, true, true, "custom", false).block(Utilities.IT_TIMEOUT));
true, true, true, "custom", false, "http://localhost:8080/image.png").block(Utilities.IT_TIMEOUT));
EMGroup group = assertDoesNotThrow(
() -> this.service.group().getGroup(groupId)
.block(Utilities.IT_TIMEOUT));
Expand Down Expand Up @@ -291,7 +295,7 @@ void testLargeGroupCreatePrivateWithCustomGroupId() {
String customGroupId = String.valueOf(10000000 + random.nextInt(80000000));
String groupId = assertDoesNotThrow(() -> this.service.group()
.createLargePrivateGroup(customGroupId, randomOwnerUsername, "group", "group description", members, 5000,
true, true, true, "custom", false).block(Utilities.IT_TIMEOUT));
true, true, true, "custom", false, "http://localhost:8080/image.png").block(Utilities.IT_TIMEOUT));
EMGroup group = assertDoesNotThrow(
() -> this.service.group().getGroup(groupId)
.block(Utilities.IT_TIMEOUT));
Expand Down Expand Up @@ -622,6 +626,7 @@ void testGroupGetWithCustom() {
void testGroupUpdate() {
String randomOwnerUsername = Utilities.randomUserName();
String randomPassword = Utilities.randomPassword();
String avatar = "http://localhost:8080/image.png";

String randomMemberUsername = Utilities.randomUserName();
List<String> members = new ArrayList<>();
Expand All @@ -635,7 +640,7 @@ void testGroupUpdate() {
.createPrivateGroup(randomOwnerUsername, "group", "group description", members, 200,
true).block(Utilities.IT_TIMEOUT));
assertDoesNotThrow(() -> this.service.group()
.updateGroup(groupId, settings -> settings.setMaxMembers(maxMembers).setPublic(true).setCustom("group custom"))
.updateGroup(groupId, settings -> settings.setMaxMembers(maxMembers).setPublic(true).setCustom("group custom").setAvatar(avatar))
.block(Utilities.IT_TIMEOUT));
EMGroup group = assertDoesNotThrow(
() -> this.service.group().getGroup(groupId).block(Utilities.IT_TIMEOUT));
Expand All @@ -645,6 +650,8 @@ void testGroupUpdate() {
if (!group.getIsPublic()) {
throw new RuntimeException(String.format("%s group public update fail", groupId));
}
assertEquals(avatar, group.getAvatar());

assertDoesNotThrow(
() -> this.service.group().destroyGroup(groupId).block(Utilities.IT_TIMEOUT));
assertDoesNotThrow(
Expand Down
Loading

0 comments on commit 1cb9684

Please sign in to comment.