From eb2577e7fd92f283e440decb81a82822643d0d36 Mon Sep 17 00:00:00 2001 From: Rory Kelly Date: Mon, 13 Apr 2026 09:48:00 +0100 Subject: [PATCH 01/13] Add builder for updating multiple GHTeam properties. --- src/main/java/org/kohsuke/github/GHTeam.java | 23 ++++ .../kohsuke/github/GHTeamUpdateBuilder.java | 123 ++++++++++++++++++ .../github/GHTeamUpdateBuilderTest.java | 97 ++++++++++++++ 3 files changed, 243 insertions(+) create mode 100644 src/main/java/org/kohsuke/github/GHTeamUpdateBuilder.java create mode 100644 src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java diff --git a/src/main/java/org/kohsuke/github/GHTeam.java b/src/main/java/org/kohsuke/github/GHTeam.java index 49be640321..0ac0ad4a90 100644 --- a/src/main/java/org/kohsuke/github/GHTeam.java +++ b/src/main/java/org/kohsuke/github/GHTeam.java @@ -48,6 +48,20 @@ public enum Role { MEMBER } + /** + * Notification setting across a team + */ + public enum NotificationSetting { + /** + * Team members receive notifications when the team is @mentioned. + */ + NOTIFICATIONS_ENABLED, + /** + * No one receives notifications. + */ + NOTIFICATIONS_DISABLED + } + /** * Path for external group-related operations */ @@ -511,6 +525,15 @@ public void setPrivacy(Privacy privacy) throws IOException { root().createRequest().method("PATCH").with("privacy", privacy).withUrlPath(api("")).send(); } + /** + * Start constructing an update request for multiple properties of this team. + * + * @return a builder to update this team + */ + public GHTeamUpdateBuilder updateTeam() { + return new GHTeamUpdateBuilder(root(), organization.getLogin(), name); + } + private String api(String tail) { if (organization == null) { // Teams returned from pull requests to do not have an organization. Attempt to use url. diff --git a/src/main/java/org/kohsuke/github/GHTeamUpdateBuilder.java b/src/main/java/org/kohsuke/github/GHTeamUpdateBuilder.java new file mode 100644 index 0000000000..2a1e4357c5 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHTeamUpdateBuilder.java @@ -0,0 +1,123 @@ +package org.kohsuke.github; + +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + +import java.io.IOException; + +/** + * Updates a team. + * + * @see Update team docs + * @author Rory Kelly + */ +public class GHTeamUpdateBuilder extends GitHubInteractiveObject { + + private final String orgName; + private final String existingName; + /** The builder. */ + protected final Requester builder; + + /** + * Instantiates a new GH team update builder. + * + * @param root + * the root + * @param orgName + * the org name + * @param existingName + * the current name of the existing team + */ + @SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected") + public GHTeamUpdateBuilder(GitHub root, String orgName, String existingName) { + super(root); + this.orgName = orgName; + this.existingName = existingName; + this.builder = root.createRequest(); + } + + /** + * Updates a team with all the provided parameters. + * + * @return the gh team + * @throws IOException + * if team cannot be updated + */ + public GHTeam update() throws IOException { + return builder.method("PATCH").withUrlPath("/orgs/" + orgName + "/teams/" + existingName).fetch(GHTeam.class).wrapUp(root()); + } + + /** + * Name for this team. + * + * @param name + * name of team + * @return a builder to continue with building + */ + public GHTeamUpdateBuilder name(String name) { + this.builder.with("name", name); + return this; + } + + /** + * Description for this team. + * + * @param description + * description of team + * @return a builder to continue with building + */ + public GHTeamUpdateBuilder description(String description) { + this.builder.with("description", description); + return this; + } + + /** + * Privacy for this team. + * + * @param privacy + * privacy of team + * @return a builder to continue with building + */ + public GHTeamUpdateBuilder privacy(GHTeam.Privacy privacy) { + this.builder.with("privacy", privacy); + return this; + } + + /** + * The notification setting explicitly set for this team. + * + * @param notificationSetting + * notification setting to be applied + * @return a builder to continue with building + */ + public GHTeamUpdateBuilder notifications(GHTeam.NotificationSetting notificationSetting) { + this.builder.with("notification_setting", notificationSetting); + return this; + } + + /** + * The permission that new repositories will be added to the team with when none is specified. + * + * @param permission + * permission to be applied + * @return a builder to continue with building + * @deprecated see + * Update team docs + */ + @Deprecated + public GHTeamUpdateBuilder permission(GHOrganization.Permission permission) { + this.builder.with("permission", permission); + return this; + } + + /** + * Parent team id for this team. + * + * @param parentTeamId + * parentTeamId of team, or null if you are removing the parent + * @return a builder to continue with building + */ + public GHTeamUpdateBuilder parentTeamId(Long parentTeamId) { + this.builder.with("parent_team_id", parentTeamId); + return this; + } +} diff --git a/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java b/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java new file mode 100644 index 0000000000..4428735a1c --- /dev/null +++ b/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java @@ -0,0 +1,97 @@ +package org.kohsuke.github; + +import org.junit.Test; + +import java.io.IOException; + +import static org.hamcrest.Matchers.equalTo; + +// TODO: Auto-generated Javadoc + +/** + * The Class GHTeamUpdateBuilderTest. + * + * @author Rory Kelly + */ +public class GHTeamUpdateBuilderTest extends AbstractGitHubWireMockTest { + + private static final String TEAM_TO_UPDATE_SLUG = "dummy-team-to-update"; + + private static final String TEAM_TO_UPDATE_NEW_NAME = "dummy-team-updated"; + private static final String TEAM_TO_UPDATE_NEW_DESCRIPTION = "This is an updated description!"; + private static final GHTeam.Privacy TEAM_TO_UPDATE_NEW_PRIVACY = GHTeam.Privacy.SECRET; + private static final GHTeam.NotificationSetting TEAM_TO_UPDATE_NEW_NOTIFICATIONS = GHTeam.NotificationSetting.NOTIFICATIONS_DISABLED; + @Deprecated + private static final GHOrganization.Permission TEAM_TO_UPDATE_NEW_PERMISSIONS = GHOrganization.Permission.PUSH; + + // private static final String CURRENT_PARENT_TEAM_SLUG = "dummy-current-parent-team"; + private static final String NEW_PARENT_TEAM_SLUG = "dummy-new-parent-team"; + + /** + * Create default GHTeamBuilderTest instance + */ + public GHTeamUpdateBuilderTest() { + } + + // update name, description, privacy, notifications, permission, no change to parent team + // update parent team + // update removal of parent team + + @Test + public void testUpdateTeamWithNewParentTeam() throws IOException { + // Get the parent team + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + GHTeam teamToUpdate = org.getTeamBySlug(TEAM_TO_UPDATE_SLUG); + GHTeam newParentTeam = org.getTeamBySlug(NEW_PARENT_TEAM_SLUG); + + GHTeam updatedTeam = getCommonBuilder(teamToUpdate) + .parentTeamId(newParentTeam.getId()) + .update(); + + assertUpdatedTeam(updatedTeam); + // assertThat(updatedTeam.getParentTeam().getId(), equalTo(newParentTeam.getId())); + } + + @Test + public void testUpdateTeamWithNoChangeToParentTeam() throws IOException { + // Get the parent team + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + GHTeam teamToUpdate = org.getTeamBySlug(TEAM_TO_UPDATE_SLUG); + // GHTeam existingParentTeam = org.getTeamBySlug(CURRENT_PARENT_TEAM_SLUG); + + GHTeam updatedTeam = getCommonBuilder(teamToUpdate).update(); + + assertUpdatedTeam(updatedTeam); + // assertThat(teamToUpdate.getParentTeam().getId(), equalTo(existingParentTeam.getId())); + } + + @Test + public void testUpdateTeamWithRemovedParentTeam() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + GHTeam teamToUpdate = org.getTeamBySlug(TEAM_TO_UPDATE_SLUG); + + GHTeam updatedTeam = getCommonBuilder(teamToUpdate) + .parentTeamId(null) + .update(); + + assertUpdatedTeam(updatedTeam); + // assertThat(teamToUpdate.getParentTeam(), equalTo(null)); + } + + private GHTeamUpdateBuilder getCommonBuilder(GHTeam teamToUpdate) { + return teamToUpdate.updateTeam() + .name(TEAM_TO_UPDATE_NEW_NAME) + .description(TEAM_TO_UPDATE_NEW_DESCRIPTION) + .privacy(TEAM_TO_UPDATE_NEW_PRIVACY) + .notifications(TEAM_TO_UPDATE_NEW_NOTIFICATIONS) + .permission(TEAM_TO_UPDATE_NEW_PERMISSIONS); + } + + private void assertUpdatedTeam(GHTeam updatedTeam) { + assertThat(updatedTeam.getName(), equalTo(TEAM_TO_UPDATE_NEW_NAME)); + assertThat(updatedTeam.getDescription(), equalTo(TEAM_TO_UPDATE_NEW_DESCRIPTION)); + assertThat(updatedTeam.getPrivacy(), equalTo(TEAM_TO_UPDATE_NEW_PRIVACY)); + // assertThat(updatedTeam.getNotificationSetting(), equalTo(TEAM_TO_UPDATE_NEW_NOTIFICATIONS)); + assertThat(updatedTeam.getPermission(), equalTo(TEAM_TO_UPDATE_NEW_PERMISSIONS)); + } +} From d68318bc39cbee47cf75eaf1285c36ea2aa21269 Mon Sep 17 00:00:00 2001 From: Rory Kelly Date: Mon, 13 Apr 2026 10:15:50 +0100 Subject: [PATCH 02/13] Add UNKNOWN value for nested GHTeam enums where missing. --- src/main/java/org/kohsuke/github/GHTeam.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHTeam.java b/src/main/java/org/kohsuke/github/GHTeam.java index 0ac0ad4a90..16648b4f86 100644 --- a/src/main/java/org/kohsuke/github/GHTeam.java +++ b/src/main/java/org/kohsuke/github/GHTeam.java @@ -45,7 +45,9 @@ public enum Role { */ MAINTAINER, /** A normal member of the team. */ - MEMBER + MEMBER, + /** Unknown role. */ + UNKNOWN } /** @@ -59,7 +61,11 @@ public enum NotificationSetting { /** * No one receives notifications. */ - NOTIFICATIONS_DISABLED + NOTIFICATIONS_DISABLED, + /** + * Unknown notification setting. + */ + UNKNOWN } /** From 7f3d758a43c1e7c0b6184ddfa349ecb33b9a9427 Mon Sep 17 00:00:00 2001 From: Rory Kelly Date: Mon, 13 Apr 2026 13:12:15 +0100 Subject: [PATCH 03/13] Update test comments. --- .../github/GHTeamUpdateBuilderTest.java | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java b/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java index 4428735a1c..cc5cd230b5 100644 --- a/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java +++ b/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java @@ -33,17 +33,18 @@ public class GHTeamUpdateBuilderTest extends AbstractGitHubWireMockTest { public GHTeamUpdateBuilderTest() { } - // update name, description, privacy, notifications, permission, no change to parent team - // update parent team - // update removal of parent team - + /** + * Given a team, when updating the team with a different parent team, then the team is updated with the new parent team. + * @throws IOException exception thrown if there is an issue with Wiremock + */ @Test public void testUpdateTeamWithNewParentTeam() throws IOException { - // Get the parent team + // Get the org and teams GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); GHTeam teamToUpdate = org.getTeamBySlug(TEAM_TO_UPDATE_SLUG); GHTeam newParentTeam = org.getTeamBySlug(NEW_PARENT_TEAM_SLUG); + // Update team with different parent team GHTeam updatedTeam = getCommonBuilder(teamToUpdate) .parentTeamId(newParentTeam.getId()) .update(); @@ -52,24 +53,35 @@ public void testUpdateTeamWithNewParentTeam() throws IOException { // assertThat(updatedTeam.getParentTeam().getId(), equalTo(newParentTeam.getId())); } + /** + * Given a team, when updating the team with no change to parent team, then the team is updated with no change to the parent team. + * @throws IOException exception thrown if there is an issue with Wiremock + */ @Test public void testUpdateTeamWithNoChangeToParentTeam() throws IOException { - // Get the parent team + // Get the org and team GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); GHTeam teamToUpdate = org.getTeamBySlug(TEAM_TO_UPDATE_SLUG); // GHTeam existingParentTeam = org.getTeamBySlug(CURRENT_PARENT_TEAM_SLUG); + // update team with no change to parent team GHTeam updatedTeam = getCommonBuilder(teamToUpdate).update(); assertUpdatedTeam(updatedTeam); // assertThat(teamToUpdate.getParentTeam().getId(), equalTo(existingParentTeam.getId())); } + /** + * Given a team, when updating the team with a removed parent team, then the team is updated and has no parent team. + * @throws IOException exception thrown if there is an issue with Wiremock + */ @Test public void testUpdateTeamWithRemovedParentTeam() throws IOException { + // Get the org and team GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); GHTeam teamToUpdate = org.getTeamBySlug(TEAM_TO_UPDATE_SLUG); + // Update team with removed parent team GHTeam updatedTeam = getCommonBuilder(teamToUpdate) .parentTeamId(null) .update(); @@ -78,6 +90,12 @@ public void testUpdateTeamWithRemovedParentTeam() throws IOException { // assertThat(teamToUpdate.getParentTeam(), equalTo(null)); } + /** + * Get the GHTeamUpdateBuilder instance with the common fields set for updating a team, to be used in the different update scenarios. + * + * @param teamToUpdate the base team to update + * @return the GHTeamUpdateBuilder instance with the common fields set for updating a team + */ private GHTeamUpdateBuilder getCommonBuilder(GHTeam teamToUpdate) { return teamToUpdate.updateTeam() .name(TEAM_TO_UPDATE_NEW_NAME) @@ -87,6 +105,11 @@ private GHTeamUpdateBuilder getCommonBuilder(GHTeam teamToUpdate) { .permission(TEAM_TO_UPDATE_NEW_PERMISSIONS); } + /** + * Assert that the updated team has the expected updated values. + * + * @param updatedTeam the team to assert the updated values on + */ private void assertUpdatedTeam(GHTeam updatedTeam) { assertThat(updatedTeam.getName(), equalTo(TEAM_TO_UPDATE_NEW_NAME)); assertThat(updatedTeam.getDescription(), equalTo(TEAM_TO_UPDATE_NEW_DESCRIPTION)); From d352813ed2ceb5eff8350385859b06af0e0ec4a5 Mon Sep 17 00:00:00 2001 From: Rory Kelly Date: Thu, 21 May 2026 08:43:36 +0100 Subject: [PATCH 04/13] Run spotless. --- src/main/java/org/kohsuke/github/GHTeam.java | 36 ++++----- .../kohsuke/github/GHTeamUpdateBuilder.java | 74 ++++++++++--------- .../github/GHTeamUpdateBuilderTest.java | 69 +++++++++-------- 3 files changed, 94 insertions(+), 85 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHTeam.java b/src/main/java/org/kohsuke/github/GHTeam.java index 16648b4f86..05098114f1 100644 --- a/src/main/java/org/kohsuke/github/GHTeam.java +++ b/src/main/java/org/kohsuke/github/GHTeam.java @@ -20,6 +20,24 @@ */ public class GHTeam extends GHObject implements Refreshable { + /** + * Notification setting across a team + */ + public enum NotificationSetting { + /** + * No one receives notifications. + */ + NOTIFICATIONS_DISABLED, + /** + * Team members receive notifications when the team is @mentioned. + */ + NOTIFICATIONS_ENABLED, + /** + * Unknown notification setting. + */ + UNKNOWN + } + /** * The Enum Privacy. */ @@ -50,24 +68,6 @@ public enum Role { UNKNOWN } - /** - * Notification setting across a team - */ - public enum NotificationSetting { - /** - * Team members receive notifications when the team is @mentioned. - */ - NOTIFICATIONS_ENABLED, - /** - * No one receives notifications. - */ - NOTIFICATIONS_DISABLED, - /** - * Unknown notification setting. - */ - UNKNOWN - } - /** * Path for external group-related operations */ diff --git a/src/main/java/org/kohsuke/github/GHTeamUpdateBuilder.java b/src/main/java/org/kohsuke/github/GHTeamUpdateBuilder.java index 2a1e4357c5..b877ba2ef3 100644 --- a/src/main/java/org/kohsuke/github/GHTeamUpdateBuilder.java +++ b/src/main/java/org/kohsuke/github/GHTeamUpdateBuilder.java @@ -12,8 +12,8 @@ */ public class GHTeamUpdateBuilder extends GitHubInteractiveObject { - private final String orgName; private final String existingName; + private final String orgName; /** The builder. */ protected final Requester builder; @@ -35,29 +35,6 @@ public GHTeamUpdateBuilder(GitHub root, String orgName, String existingName) { this.builder = root.createRequest(); } - /** - * Updates a team with all the provided parameters. - * - * @return the gh team - * @throws IOException - * if team cannot be updated - */ - public GHTeam update() throws IOException { - return builder.method("PATCH").withUrlPath("/orgs/" + orgName + "/teams/" + existingName).fetch(GHTeam.class).wrapUp(root()); - } - - /** - * Name for this team. - * - * @param name - * name of team - * @return a builder to continue with building - */ - public GHTeamUpdateBuilder name(String name) { - this.builder.with("name", name); - return this; - } - /** * Description for this team. * @@ -71,14 +48,14 @@ public GHTeamUpdateBuilder description(String description) { } /** - * Privacy for this team. + * Name for this team. * - * @param privacy - * privacy of team + * @param name + * name of team * @return a builder to continue with building */ - public GHTeamUpdateBuilder privacy(GHTeam.Privacy privacy) { - this.builder.with("privacy", privacy); + public GHTeamUpdateBuilder name(String name) { + this.builder.with("name", name); return this; } @@ -94,14 +71,25 @@ public GHTeamUpdateBuilder notifications(GHTeam.NotificationSetting notification return this; } + /** + * Parent team id for this team. + * + * @param parentTeamId + * parentTeamId of team, or null if you are removing the parent + * @return a builder to continue with building + */ + public GHTeamUpdateBuilder parentTeamId(Long parentTeamId) { + this.builder.with("parent_team_id", parentTeamId); + return this; + } + /** * The permission that new repositories will be added to the team with when none is specified. * * @param permission * permission to be applied * @return a builder to continue with building - * @deprecated see - * Update team docs + * @deprecated see Update team docs */ @Deprecated public GHTeamUpdateBuilder permission(GHOrganization.Permission permission) { @@ -110,14 +98,28 @@ public GHTeamUpdateBuilder permission(GHOrganization.Permission permission) { } /** - * Parent team id for this team. + * Privacy for this team. * - * @param parentTeamId - * parentTeamId of team, or null if you are removing the parent + * @param privacy + * privacy of team * @return a builder to continue with building */ - public GHTeamUpdateBuilder parentTeamId(Long parentTeamId) { - this.builder.with("parent_team_id", parentTeamId); + public GHTeamUpdateBuilder privacy(GHTeam.Privacy privacy) { + this.builder.with("privacy", privacy); return this; } + + /** + * Updates a team with all the provided parameters. + * + * @return the gh team + * @throws IOException + * if team cannot be updated + */ + public GHTeam update() throws IOException { + return builder.method("PATCH") + .withUrlPath("/orgs/" + orgName + "/teams/" + existingName) + .fetch(GHTeam.class) + .wrapUp(root()); + } } diff --git a/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java b/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java index cc5cd230b5..b78e811dc8 100644 --- a/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java +++ b/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java @@ -15,17 +15,17 @@ */ public class GHTeamUpdateBuilderTest extends AbstractGitHubWireMockTest { - private static final String TEAM_TO_UPDATE_SLUG = "dummy-team-to-update"; + // private static final String CURRENT_PARENT_TEAM_SLUG = "dummy-current-parent-team"; + private static final String NEW_PARENT_TEAM_SLUG = "dummy-new-parent-team"; - private static final String TEAM_TO_UPDATE_NEW_NAME = "dummy-team-updated"; private static final String TEAM_TO_UPDATE_NEW_DESCRIPTION = "This is an updated description!"; - private static final GHTeam.Privacy TEAM_TO_UPDATE_NEW_PRIVACY = GHTeam.Privacy.SECRET; + private static final String TEAM_TO_UPDATE_NEW_NAME = "dummy-team-updated"; private static final GHTeam.NotificationSetting TEAM_TO_UPDATE_NEW_NOTIFICATIONS = GHTeam.NotificationSetting.NOTIFICATIONS_DISABLED; @Deprecated private static final GHOrganization.Permission TEAM_TO_UPDATE_NEW_PERMISSIONS = GHOrganization.Permission.PUSH; + private static final GHTeam.Privacy TEAM_TO_UPDATE_NEW_PRIVACY = GHTeam.Privacy.SECRET; - // private static final String CURRENT_PARENT_TEAM_SLUG = "dummy-current-parent-team"; - private static final String NEW_PARENT_TEAM_SLUG = "dummy-new-parent-team"; + private static final String TEAM_TO_UPDATE_SLUG = "dummy-team-to-update"; /** * Create default GHTeamBuilderTest instance @@ -34,8 +34,11 @@ public GHTeamUpdateBuilderTest() { } /** - * Given a team, when updating the team with a different parent team, then the team is updated with the new parent team. - * @throws IOException exception thrown if there is an issue with Wiremock + * Given a team, when updating the team with a different parent team, then the team is updated with the new parent + * team. + * + * @throws IOException + * exception thrown if there is an issue with Wiremock */ @Test public void testUpdateTeamWithNewParentTeam() throws IOException { @@ -45,17 +48,18 @@ public void testUpdateTeamWithNewParentTeam() throws IOException { GHTeam newParentTeam = org.getTeamBySlug(NEW_PARENT_TEAM_SLUG); // Update team with different parent team - GHTeam updatedTeam = getCommonBuilder(teamToUpdate) - .parentTeamId(newParentTeam.getId()) - .update(); + GHTeam updatedTeam = getCommonBuilder(teamToUpdate).parentTeamId(newParentTeam.getId()).update(); assertUpdatedTeam(updatedTeam); // assertThat(updatedTeam.getParentTeam().getId(), equalTo(newParentTeam.getId())); } /** - * Given a team, when updating the team with no change to parent team, then the team is updated with no change to the parent team. - * @throws IOException exception thrown if there is an issue with Wiremock + * Given a team, when updating the team with no change to parent team, then the team is updated with no change to + * the parent team. + * + * @throws IOException + * exception thrown if there is an issue with Wiremock */ @Test public void testUpdateTeamWithNoChangeToParentTeam() throws IOException { @@ -73,7 +77,9 @@ public void testUpdateTeamWithNoChangeToParentTeam() throws IOException { /** * Given a team, when updating the team with a removed parent team, then the team is updated and has no parent team. - * @throws IOException exception thrown if there is an issue with Wiremock + * + * @throws IOException + * exception thrown if there is an issue with Wiremock */ @Test public void testUpdateTeamWithRemovedParentTeam() throws IOException { @@ -82,18 +88,32 @@ public void testUpdateTeamWithRemovedParentTeam() throws IOException { GHTeam teamToUpdate = org.getTeamBySlug(TEAM_TO_UPDATE_SLUG); // Update team with removed parent team - GHTeam updatedTeam = getCommonBuilder(teamToUpdate) - .parentTeamId(null) - .update(); + GHTeam updatedTeam = getCommonBuilder(teamToUpdate).parentTeamId(null).update(); assertUpdatedTeam(updatedTeam); // assertThat(teamToUpdate.getParentTeam(), equalTo(null)); } /** - * Get the GHTeamUpdateBuilder instance with the common fields set for updating a team, to be used in the different update scenarios. + * Assert that the updated team has the expected updated values. * - * @param teamToUpdate the base team to update + * @param updatedTeam + * the team to assert the updated values on + */ + private void assertUpdatedTeam(GHTeam updatedTeam) { + assertThat(updatedTeam.getName(), equalTo(TEAM_TO_UPDATE_NEW_NAME)); + assertThat(updatedTeam.getDescription(), equalTo(TEAM_TO_UPDATE_NEW_DESCRIPTION)); + assertThat(updatedTeam.getPrivacy(), equalTo(TEAM_TO_UPDATE_NEW_PRIVACY)); + // assertThat(updatedTeam.getNotificationSetting(), equalTo(TEAM_TO_UPDATE_NEW_NOTIFICATIONS)); + assertThat(updatedTeam.getPermission(), equalTo(TEAM_TO_UPDATE_NEW_PERMISSIONS)); + } + + /** + * Get the GHTeamUpdateBuilder instance with the common fields set for updating a team, to be used in the different + * update scenarios. + * + * @param teamToUpdate + * the base team to update * @return the GHTeamUpdateBuilder instance with the common fields set for updating a team */ private GHTeamUpdateBuilder getCommonBuilder(GHTeam teamToUpdate) { @@ -104,17 +124,4 @@ private GHTeamUpdateBuilder getCommonBuilder(GHTeam teamToUpdate) { .notifications(TEAM_TO_UPDATE_NEW_NOTIFICATIONS) .permission(TEAM_TO_UPDATE_NEW_PERMISSIONS); } - - /** - * Assert that the updated team has the expected updated values. - * - * @param updatedTeam the team to assert the updated values on - */ - private void assertUpdatedTeam(GHTeam updatedTeam) { - assertThat(updatedTeam.getName(), equalTo(TEAM_TO_UPDATE_NEW_NAME)); - assertThat(updatedTeam.getDescription(), equalTo(TEAM_TO_UPDATE_NEW_DESCRIPTION)); - assertThat(updatedTeam.getPrivacy(), equalTo(TEAM_TO_UPDATE_NEW_PRIVACY)); - // assertThat(updatedTeam.getNotificationSetting(), equalTo(TEAM_TO_UPDATE_NEW_NOTIFICATIONS)); - assertThat(updatedTeam.getPermission(), equalTo(TEAM_TO_UPDATE_NEW_PERMISSIONS)); - } } From 0bb19b28acca448587dfd2571c41f32008c9a64d Mon Sep 17 00:00:00 2001 From: Rory Kelly Date: Fri, 16 Oct 2026 11:56:48 +0100 Subject: [PATCH 05/13] Update tests to handle constraints, actual data returned, and clarity of change source. --- .../java/org/kohsuke/github/GHTeamUpdateBuilderTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java b/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java index b78e811dc8..68539b881a 100644 --- a/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java +++ b/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java @@ -18,12 +18,12 @@ public class GHTeamUpdateBuilderTest extends AbstractGitHubWireMockTest { // private static final String CURRENT_PARENT_TEAM_SLUG = "dummy-current-parent-team"; private static final String NEW_PARENT_TEAM_SLUG = "dummy-new-parent-team"; - private static final String TEAM_TO_UPDATE_NEW_DESCRIPTION = "This is an updated description!"; + private static final String TEAM_TO_UPDATE_NEW_DESCRIPTION = "Updated by GHTeamUpdateBuilderTest"; private static final String TEAM_TO_UPDATE_NEW_NAME = "dummy-team-updated"; private static final GHTeam.NotificationSetting TEAM_TO_UPDATE_NEW_NOTIFICATIONS = GHTeam.NotificationSetting.NOTIFICATIONS_DISABLED; @Deprecated private static final GHOrganization.Permission TEAM_TO_UPDATE_NEW_PERMISSIONS = GHOrganization.Permission.PUSH; - private static final GHTeam.Privacy TEAM_TO_UPDATE_NEW_PRIVACY = GHTeam.Privacy.SECRET; + private static final GHTeam.Privacy TEAM_TO_UPDATE_NEW_PRIVACY = GHTeam.Privacy.CLOSED; private static final String TEAM_TO_UPDATE_SLUG = "dummy-team-to-update"; @@ -105,7 +105,7 @@ private void assertUpdatedTeam(GHTeam updatedTeam) { assertThat(updatedTeam.getDescription(), equalTo(TEAM_TO_UPDATE_NEW_DESCRIPTION)); assertThat(updatedTeam.getPrivacy(), equalTo(TEAM_TO_UPDATE_NEW_PRIVACY)); // assertThat(updatedTeam.getNotificationSetting(), equalTo(TEAM_TO_UPDATE_NEW_NOTIFICATIONS)); - assertThat(updatedTeam.getPermission(), equalTo(TEAM_TO_UPDATE_NEW_PERMISSIONS)); + assertThat(updatedTeam.getPermission(), equalTo(TEAM_TO_UPDATE_NEW_PERMISSIONS.name().toLowerCase())); } /** From 1cb0a6c3b6a2e9ff1ed6d5db6f80fb4cdd7a35f9 Mon Sep 17 00:00:00 2001 From: Rory Kelly Date: Fri, 16 Oct 2026 11:57:09 +0100 Subject: [PATCH 06/13] Add wiremocks for `testUpdateTeamWithNewParentTeam`. --- .../__files/1-user.json | 36 ++++++++++ .../__files/2-orgs_hub4j-test-org.json | 67 ++++++++++++++++++ .../__files/3-o_h_t_dummy-team-to-update.json | 53 +++++++++++++++ .../4-o_h_t_dummy-new-parent-team.json | 53 +++++++++++++++ .../__files/5-o_h_t_dummy-team-to-update.json | 68 +++++++++++++++++++ .../mappings/1-user.json | 48 +++++++++++++ .../mappings/2-orgs_hub4j-test-org.json | 48 +++++++++++++ .../3-o_h_t_dummy-team-to-update.json | 48 +++++++++++++ .../4-o_h_t_dummy-new-parent-team.json | 48 +++++++++++++ .../5-o_h_t_dummy-team-to-update.json | 54 +++++++++++++++ 10 files changed, 523 insertions(+) create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/1-user.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/2-orgs_hub4j-test-org.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/3-o_h_t_dummy-team-to-update.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/4-o_h_t_dummy-new-parent-team.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/5-o_h_t_dummy-team-to-update.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/1-user.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/2-orgs_hub4j-test-org.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/3-o_h_t_dummy-team-to-update.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/4-o_h_t_dummy-new-parent-team.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/5-o_h_t_dummy-team-to-update.json diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/1-user.json new file mode 100644 index 0000000000..65da4e72ab --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/1-user.json @@ -0,0 +1,36 @@ +{ + "login": "rozza-sb", + "id": 136339038, + "node_id": "U_kgDOCCBeXg", + "avatar_url": "https://avatars.githubusercontent.com/u/136339038?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/rozza-sb", + "html_url": "https://github.com/rozza-sb", + "followers_url": "https://api.github.com/users/rozza-sb/followers", + "following_url": "https://api.github.com/users/rozza-sb/following{/other_user}", + "gists_url": "https://api.github.com/users/rozza-sb/gists{/gist_id}", + "starred_url": "https://api.github.com/users/rozza-sb/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/rozza-sb/subscriptions", + "organizations_url": "https://api.github.com/users/rozza-sb/orgs", + "repos_url": "https://api.github.com/users/rozza-sb/repos", + "events_url": "https://api.github.com/users/rozza-sb/events{/privacy}", + "received_events_url": "https://api.github.com/users/rozza-sb/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false, + "name": "Rory Kelly", + "company": null, + "blog": "", + "location": null, + "email": null, + "hireable": null, + "bio": null, + "twitter_username": null, + "notification_email": null, + "public_repos": 2, + "public_gists": 1, + "followers": 0, + "following": 0, + "created_at": "2023-06-12T12:41:11Z", + "updated_at": "2026-09-21T10:04:39Z" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..eea7b7303a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/2-orgs_hub4j-test-org.json @@ -0,0 +1,67 @@ +{ + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 27, + "public_gists": 0, + "followers": 2, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2025-08-05T00:53:03Z", + "archived_at": null, + "type": "Organization", + "total_private_repos": 8, + "owned_private_repos": 8, + "private_gists": null, + "disk_usage": null, + "collaborators": null, + "billing_email": null, + "default_repository_permission": null, + "members_can_create_repositories": false, + "two_factor_requirement_enabled": null, + "members_allowed_repository_creation_type": "none", + "members_can_create_public_repositories": false, + "members_can_create_private_repositories": false, + "members_can_create_internal_repositories": false, + "members_can_create_pages": true, + "members_can_fork_private_repositories": false, + "web_commit_signoff_required": false, + "deploy_keys_enabled_for_repositories": false, + "members_can_delete_repositories": true, + "members_can_change_repo_visibility": true, + "members_can_invite_outside_collaborators": true, + "members_can_delete_issues": false, + "display_commenter_full_name_setting_enabled": false, + "readers_can_create_discussions": true, + "members_can_create_teams": true, + "members_can_view_dependency_insights": true, + "default_repository_branch": "main", + "members_can_create_public_pages": true, + "members_can_create_private_pages": true, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 10000, + "filled_seats": 54, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/3-o_h_t_dummy-team-to-update.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/3-o_h_t_dummy-team-to-update.json new file mode 100644 index 0000000000..768c554425 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/3-o_h_t_dummy-team-to-update.json @@ -0,0 +1,53 @@ +{ + "name": "dummy-team-to-update", + "id": 20138402, + "node_id": "T_kwDOAHMfo84BM0mi", + "slug": "dummy-team-to-update", + "description": "hub4j/github-api#2249", + "privacy": "secret", + "notification_setting": "notifications_disabled", + "url": "https://api.github.com/organizations/7544739/team/20138402", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team-to-update", + "members_url": "https://api.github.com/organizations/7544739/team/20138402/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/20138402/repos", + "type": "organization", + "organization_id": 7544739, + "permission": "push", + "created_at": "2026-10-16T10:46:58Z", + "updated_at": "2026-10-16T10:51:13Z", + "members_count": 1, + "repos_count": 0, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 27, + "public_gists": 0, + "followers": 2, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2025-08-05T00:53:03Z", + "archived_at": null, + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/4-o_h_t_dummy-new-parent-team.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/4-o_h_t_dummy-new-parent-team.json new file mode 100644 index 0000000000..dfb5f267d7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/4-o_h_t_dummy-new-parent-team.json @@ -0,0 +1,53 @@ +{ + "name": "dummy-new-parent-team", + "id": 20138416, + "node_id": "T_kwDOAHMfo84BM0mw", + "slug": "dummy-new-parent-team", + "description": "hub4j/github-api#2249", + "privacy": "closed", + "notification_setting": "notifications_disabled", + "url": "https://api.github.com/organizations/7544739/team/20138416", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-new-parent-team", + "members_url": "https://api.github.com/organizations/7544739/team/20138416/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/20138416/repos", + "type": "organization", + "organization_id": 7544739, + "permission": "pull", + "created_at": "2026-10-16T10:47:40Z", + "updated_at": "2026-10-16T10:47:40Z", + "members_count": 1, + "repos_count": 0, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 27, + "public_gists": 0, + "followers": 2, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2025-08-05T00:53:03Z", + "archived_at": null, + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/5-o_h_t_dummy-team-to-update.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/5-o_h_t_dummy-team-to-update.json new file mode 100644 index 0000000000..f943c552ed --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/__files/5-o_h_t_dummy-team-to-update.json @@ -0,0 +1,68 @@ +{ + "name": "dummy-team-updated", + "id": 20138402, + "node_id": "T_kwDOAHMfo84BM0mi", + "slug": "dummy-team-updated", + "description": "Updated by GHTeamUpdateBuilderTest", + "privacy": "closed", + "notification_setting": "notifications_disabled", + "url": "https://api.github.com/organizations/7544739/team/20138402", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team-updated", + "members_url": "https://api.github.com/organizations/7544739/team/20138402/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/20138402/repos", + "type": "organization", + "organization_id": 7544739, + "permission": "push", + "created_at": "2026-10-16T10:46:58Z", + "updated_at": "2026-10-16T10:52:28Z", + "members_count": 1, + "repos_count": 0, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 27, + "public_gists": 0, + "followers": 2, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2025-08-05T00:53:03Z", + "archived_at": null, + "type": "Organization" + }, + "parent": { + "name": "dummy-new-parent-team", + "id": 20138416, + "node_id": "T_kwDOAHMfo84BM0mw", + "slug": "dummy-new-parent-team", + "description": "hub4j/github-api#2249", + "privacy": "closed", + "notification_setting": "notifications_disabled", + "url": "https://api.github.com/organizations/7544739/team/20138416", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-new-parent-team", + "members_url": "https://api.github.com/organizations/7544739/team/20138416/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/20138416/repos", + "type": "organization", + "organization_id": 7544739, + "permission": "pull" + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/1-user.json new file mode 100644 index 0000000000..5ebd108a38 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/1-user.json @@ -0,0 +1,48 @@ +{ + "id": "82f8d4e8-7d14-454a-b425-7e71580b7941", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Fri, 16 Oct 2026 10:52:26 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"e8952fb82cf6b462ba11f814e7a8efba99abe678c7c024895ff65fed1268ddc8\"", + "Last-Modified": "Mon, 21 Sep 2026 10:04:39 GMT", + "github-authentication-token-expiration": "2026-11-15 11:34:00 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-accepted-github-permissions": "allows_permissionless_access=true", + "x-github-api-version-selected": "2022-11-28", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset, Warning", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4969", + "X-RateLimit-Reset": "1792150820", + "X-RateLimit-Used": "31", + "X-RateLimit-Resource": "core", + "X-GitHub-Request-Id": "29D4:24E30C:8AED31:D3D1FE:6AD201EA", + "x-github-edge-region": "uksouth" + } + }, + "uuid": "82f8d4e8-7d14-454a-b425-7e71580b7941", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..0ec994ca13 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/2-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "837a7eb0-1f7b-490a-852f-c90ab96e3b10", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-orgs_hub4j-test-org.json", + "headers": { + "Date": "Fri, 16 Oct 2026 10:52:27 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"61f69c4f3a4a51a411f8aa42bf74b5e40bc0a88740afff0fe930aea738981a2f\"", + "Last-Modified": "Tue, 05 Aug 2025 00:53:03 GMT", + "github-authentication-token-expiration": "2026-11-15 11:34:00 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-accepted-github-permissions": "allows_permissionless_access=true", + "x-github-api-version-selected": "2022-11-28", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset, Warning", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4967", + "X-RateLimit-Reset": "1792150820", + "X-RateLimit-Used": "33", + "X-RateLimit-Resource": "core", + "X-GitHub-Request-Id": "2EA4:2593F4:8957AD:D23F5B:6AD201EB", + "x-github-edge-region": "uksouth" + } + }, + "uuid": "837a7eb0-1f7b-490a-852f-c90ab96e3b10", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/3-o_h_t_dummy-team-to-update.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/3-o_h_t_dummy-team-to-update.json new file mode 100644 index 0000000000..530cb41263 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/3-o_h_t_dummy-team-to-update.json @@ -0,0 +1,48 @@ +{ + "id": "2d2fdf89-6e24-4bfb-8266-d4b7036ebe27", + "name": "orgs_hub4j-test-org_teams_dummy-team-to-update", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team-to-update", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-o_h_t_dummy-team-to-update.json", + "headers": { + "Date": "Fri, 16 Oct 2026 10:52:28 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"0bab63a2a26eae88b4d39acff2cda328be098c6fc3b6939a1b9e59d969d69360\"", + "Last-Modified": "Fri, 16 Oct 2026 10:51:13 GMT", + "github-authentication-token-expiration": "2026-11-15 11:34:00 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-accepted-github-permissions": "members=read", + "x-github-api-version-selected": "2022-11-28", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset, Warning", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4966", + "X-RateLimit-Reset": "1792150820", + "X-RateLimit-Used": "34", + "X-RateLimit-Resource": "core", + "X-GitHub-Request-Id": "23BD:3E2151:888E2A:D17060:6AD201EB", + "x-github-edge-region": "uksouth" + } + }, + "uuid": "2d2fdf89-6e24-4bfb-8266-d4b7036ebe27", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/4-o_h_t_dummy-new-parent-team.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/4-o_h_t_dummy-new-parent-team.json new file mode 100644 index 0000000000..cb0241c0e2 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/4-o_h_t_dummy-new-parent-team.json @@ -0,0 +1,48 @@ +{ + "id": "bbe3602e-b5f0-4d4c-89e6-c4dfe331cb19", + "name": "orgs_hub4j-test-org_teams_dummy-new-parent-team", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-new-parent-team", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "4-o_h_t_dummy-new-parent-team.json", + "headers": { + "Date": "Fri, 16 Oct 2026 10:52:28 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"1b0f2d553e6b0f51cb498ac84f26c09244cecda0c6e1e98de207fb22b89d3d95\"", + "Last-Modified": "Fri, 16 Oct 2026 10:47:40 GMT", + "github-authentication-token-expiration": "2026-11-15 11:34:00 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-accepted-github-permissions": "members=read", + "x-github-api-version-selected": "2022-11-28", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset, Warning", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4965", + "X-RateLimit-Reset": "1792150820", + "X-RateLimit-Used": "35", + "X-RateLimit-Resource": "core", + "X-GitHub-Request-Id": "21C6:1E492F:8D64E6:D62927:6AD201EC", + "x-github-edge-region": "uksouth" + } + }, + "uuid": "bbe3602e-b5f0-4d4c-89e6-c4dfe331cb19", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/5-o_h_t_dummy-team-to-update.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/5-o_h_t_dummy-team-to-update.json new file mode 100644 index 0000000000..53833253f2 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNewParentTeam/mappings/5-o_h_t_dummy-team-to-update.json @@ -0,0 +1,54 @@ +{ + "id": "744014e7-31fb-45c1-932b-7d1b309c6442", + "name": "orgs_hub4j-test-org_teams_dummy-team-to-update", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team-to-update", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"parent_team_id\":20138416,\"name\":\"dummy-team-updated\",\"description\":\"Updated by GHTeamUpdateBuilderTest\",\"privacy\":\"closed\",\"permission\":\"push\",\"notification_setting\":\"notifications-disabled\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "5-o_h_t_dummy-team-to-update.json", + "headers": { + "Date": "Fri, 16 Oct 2026 10:52:28 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"77065f291f51fe05ec5d4cd8d662ff2910e7dd490654d180a01ee8be14ea2735\"", + "github-authentication-token-expiration": "2026-11-15 11:34:00 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-accepted-github-permissions": "members=write", + "x-github-api-version-selected": "2022-11-28", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset, Warning", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4993", + "X-RateLimit-Reset": "1792151320", + "X-RateLimit-Used": "7", + "X-RateLimit-Resource": "core", + "X-GitHub-Request-Id": "3ACE:2890E0:8C4A81:D51663:6AD201EC", + "x-github-edge-region": "uksouth" + } + }, + "uuid": "744014e7-31fb-45c1-932b-7d1b309c6442", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file From 4d680efbb177b4ea300814bcfa9f164431efddc1 Mon Sep 17 00:00:00 2001 From: Rory Kelly Date: Fri, 16 Oct 2026 11:57:57 +0100 Subject: [PATCH 07/13] Add wiremocks for `testUpdateTeamWithNoChangeToParentTeam`. --- .../__files/1-user.json | 36 ++++++++++ .../__files/2-orgs_hub4j-test-org.json | 67 +++++++++++++++++++ .../__files/3-o_h_t_dummy-team-to-update.json | 53 +++++++++++++++ .../__files/4-o_h_t_dummy-team-to-update.json | 53 +++++++++++++++ .../mappings/1-user.json | 48 +++++++++++++ .../mappings/2-orgs_hub4j-test-org.json | 48 +++++++++++++ .../3-o_h_t_dummy-team-to-update.json | 48 +++++++++++++ .../4-o_h_t_dummy-team-to-update.json | 54 +++++++++++++++ 8 files changed, 407 insertions(+) create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/__files/1-user.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/__files/2-orgs_hub4j-test-org.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/__files/3-o_h_t_dummy-team-to-update.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/__files/4-o_h_t_dummy-team-to-update.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/mappings/1-user.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/mappings/2-orgs_hub4j-test-org.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/mappings/3-o_h_t_dummy-team-to-update.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/mappings/4-o_h_t_dummy-team-to-update.json diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/__files/1-user.json new file mode 100644 index 0000000000..65da4e72ab --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/__files/1-user.json @@ -0,0 +1,36 @@ +{ + "login": "rozza-sb", + "id": 136339038, + "node_id": "U_kgDOCCBeXg", + "avatar_url": "https://avatars.githubusercontent.com/u/136339038?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/rozza-sb", + "html_url": "https://github.com/rozza-sb", + "followers_url": "https://api.github.com/users/rozza-sb/followers", + "following_url": "https://api.github.com/users/rozza-sb/following{/other_user}", + "gists_url": "https://api.github.com/users/rozza-sb/gists{/gist_id}", + "starred_url": "https://api.github.com/users/rozza-sb/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/rozza-sb/subscriptions", + "organizations_url": "https://api.github.com/users/rozza-sb/orgs", + "repos_url": "https://api.github.com/users/rozza-sb/repos", + "events_url": "https://api.github.com/users/rozza-sb/events{/privacy}", + "received_events_url": "https://api.github.com/users/rozza-sb/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false, + "name": "Rory Kelly", + "company": null, + "blog": "", + "location": null, + "email": null, + "hireable": null, + "bio": null, + "twitter_username": null, + "notification_email": null, + "public_repos": 2, + "public_gists": 1, + "followers": 0, + "following": 0, + "created_at": "2023-06-12T12:41:11Z", + "updated_at": "2026-09-21T10:04:39Z" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/__files/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/__files/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..eea7b7303a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/__files/2-orgs_hub4j-test-org.json @@ -0,0 +1,67 @@ +{ + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 27, + "public_gists": 0, + "followers": 2, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2025-08-05T00:53:03Z", + "archived_at": null, + "type": "Organization", + "total_private_repos": 8, + "owned_private_repos": 8, + "private_gists": null, + "disk_usage": null, + "collaborators": null, + "billing_email": null, + "default_repository_permission": null, + "members_can_create_repositories": false, + "two_factor_requirement_enabled": null, + "members_allowed_repository_creation_type": "none", + "members_can_create_public_repositories": false, + "members_can_create_private_repositories": false, + "members_can_create_internal_repositories": false, + "members_can_create_pages": true, + "members_can_fork_private_repositories": false, + "web_commit_signoff_required": false, + "deploy_keys_enabled_for_repositories": false, + "members_can_delete_repositories": true, + "members_can_change_repo_visibility": true, + "members_can_invite_outside_collaborators": true, + "members_can_delete_issues": false, + "display_commenter_full_name_setting_enabled": false, + "readers_can_create_discussions": true, + "members_can_create_teams": true, + "members_can_view_dependency_insights": true, + "default_repository_branch": "main", + "members_can_create_public_pages": true, + "members_can_create_private_pages": true, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 10000, + "filled_seats": 54, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/__files/3-o_h_t_dummy-team-to-update.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/__files/3-o_h_t_dummy-team-to-update.json new file mode 100644 index 0000000000..43c2410fa0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/__files/3-o_h_t_dummy-team-to-update.json @@ -0,0 +1,53 @@ +{ + "name": "dummy-team-to-update", + "id": 20138402, + "node_id": "T_kwDOAHMfo84BM0mi", + "slug": "dummy-team-to-update", + "description": "hub4j/github-api#2249", + "privacy": "secret", + "notification_setting": "notifications_disabled", + "url": "https://api.github.com/organizations/7544739/team/20138402", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team-to-update", + "members_url": "https://api.github.com/organizations/7544739/team/20138402/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/20138402/repos", + "type": "organization", + "organization_id": 7544739, + "permission": "push", + "created_at": "2026-10-16T10:46:58Z", + "updated_at": "2026-10-16T10:54:47Z", + "members_count": 1, + "repos_count": 0, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 27, + "public_gists": 0, + "followers": 2, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2025-08-05T00:53:03Z", + "archived_at": null, + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/__files/4-o_h_t_dummy-team-to-update.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/__files/4-o_h_t_dummy-team-to-update.json new file mode 100644 index 0000000000..183593285f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/__files/4-o_h_t_dummy-team-to-update.json @@ -0,0 +1,53 @@ +{ + "name": "dummy-team-updated", + "id": 20138402, + "node_id": "T_kwDOAHMfo84BM0mi", + "slug": "dummy-team-updated", + "description": "Updated by GHTeamUpdateBuilderTest", + "privacy": "closed", + "notification_setting": "notifications_disabled", + "url": "https://api.github.com/organizations/7544739/team/20138402", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team-updated", + "members_url": "https://api.github.com/organizations/7544739/team/20138402/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/20138402/repos", + "type": "organization", + "organization_id": 7544739, + "permission": "push", + "created_at": "2026-10-16T10:46:58Z", + "updated_at": "2026-10-16T10:57:22Z", + "members_count": 1, + "repos_count": 0, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 27, + "public_gists": 0, + "followers": 2, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2025-08-05T00:53:03Z", + "archived_at": null, + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/mappings/1-user.json new file mode 100644 index 0000000000..53ad3d6036 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/mappings/1-user.json @@ -0,0 +1,48 @@ +{ + "id": "17af6e63-e902-4e66-b9dc-1e2abc43633f", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Fri, 16 Oct 2026 10:57:20 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"e8952fb82cf6b462ba11f814e7a8efba99abe678c7c024895ff65fed1268ddc8\"", + "Last-Modified": "Mon, 21 Sep 2026 10:04:39 GMT", + "github-authentication-token-expiration": "2026-11-15 11:34:00 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-accepted-github-permissions": "allows_permissionless_access=true", + "x-github-api-version-selected": "2022-11-28", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset, Warning", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4964", + "X-RateLimit-Reset": "1792150820", + "X-RateLimit-Used": "36", + "X-RateLimit-Resource": "core", + "X-GitHub-Request-Id": "30FA:32CE4B:935F7C:DD40AC:6AD20310", + "x-github-edge-region": "uksouth" + } + }, + "uuid": "17af6e63-e902-4e66-b9dc-1e2abc43633f", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/mappings/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/mappings/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..4a4478c554 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/mappings/2-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "d2b54cf0-e80c-4e06-93c4-9746972d974a", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-orgs_hub4j-test-org.json", + "headers": { + "Date": "Fri, 16 Oct 2026 10:57:21 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"61f69c4f3a4a51a411f8aa42bf74b5e40bc0a88740afff0fe930aea738981a2f\"", + "Last-Modified": "Tue, 05 Aug 2025 00:53:03 GMT", + "github-authentication-token-expiration": "2026-11-15 11:34:00 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-accepted-github-permissions": "allows_permissionless_access=true", + "x-github-api-version-selected": "2022-11-28", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset, Warning", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4962", + "X-RateLimit-Reset": "1792150820", + "X-RateLimit-Used": "38", + "X-RateLimit-Resource": "core", + "X-GitHub-Request-Id": "2803:3F9E54:90075D:DA0C5E:6AD20311", + "x-github-edge-region": "uksouth" + } + }, + "uuid": "d2b54cf0-e80c-4e06-93c4-9746972d974a", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/mappings/3-o_h_t_dummy-team-to-update.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/mappings/3-o_h_t_dummy-team-to-update.json new file mode 100644 index 0000000000..dc199f5f96 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/mappings/3-o_h_t_dummy-team-to-update.json @@ -0,0 +1,48 @@ +{ + "id": "4e53462b-15a3-4b3a-a50c-80cbb63fa964", + "name": "orgs_hub4j-test-org_teams_dummy-team-to-update", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team-to-update", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-o_h_t_dummy-team-to-update.json", + "headers": { + "Date": "Fri, 16 Oct 2026 10:57:21 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"b8ea447862ebc5de3917b8f65e27e109accef10ec196315e883ef0d94c71d74f\"", + "Last-Modified": "Fri, 16 Oct 2026 10:54:47 GMT", + "github-authentication-token-expiration": "2026-11-15 11:34:00 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-accepted-github-permissions": "members=read", + "x-github-api-version-selected": "2022-11-28", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset, Warning", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4961", + "X-RateLimit-Reset": "1792150820", + "X-RateLimit-Used": "39", + "X-RateLimit-Resource": "core", + "X-GitHub-Request-Id": "3489:17E0E0:8DB0D6:D7A816:6AD20311", + "x-github-edge-region": "uksouth" + } + }, + "uuid": "4e53462b-15a3-4b3a-a50c-80cbb63fa964", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/mappings/4-o_h_t_dummy-team-to-update.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/mappings/4-o_h_t_dummy-team-to-update.json new file mode 100644 index 0000000000..c2194e89ed --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithNoChangeToParentTeam/mappings/4-o_h_t_dummy-team-to-update.json @@ -0,0 +1,54 @@ +{ + "id": "62b58c40-6c2c-48ba-ba71-9233237d0825", + "name": "orgs_hub4j-test-org_teams_dummy-team-to-update", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team-to-update", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"name\":\"dummy-team-updated\",\"description\":\"Updated by GHTeamUpdateBuilderTest\",\"privacy\":\"closed\",\"permission\":\"push\",\"notification_setting\":\"notifications-disabled\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "4-o_h_t_dummy-team-to-update.json", + "headers": { + "Date": "Fri, 16 Oct 2026 10:57:22 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"bc7607ca3ff05ab001b8000503fc86c63ad16d4fad3aca7c4cdd40019b19430e\"", + "github-authentication-token-expiration": "2026-11-15 11:34:00 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-accepted-github-permissions": "members=write", + "x-github-api-version-selected": "2022-11-28", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset, Warning", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1792151320", + "X-RateLimit-Used": "16", + "X-RateLimit-Resource": "core", + "X-GitHub-Request-Id": "2617:11EBC0:8E4B71:D81F07:6AD20311", + "x-github-edge-region": "uksouth" + } + }, + "uuid": "62b58c40-6c2c-48ba-ba71-9233237d0825", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file From 4b41eac96a2de4231bc13c2fc560a0cb532c4ddd Mon Sep 17 00:00:00 2001 From: Rory Kelly Date: Fri, 16 Oct 2026 11:59:48 +0100 Subject: [PATCH 08/13] Add wiremocks for `testUpdateTeamWithRemovedParentTeam`. --- .../__files/1-user.json | 36 ++++++++++ .../__files/2-orgs_hub4j-test-org.json | 67 ++++++++++++++++++ .../__files/3-o_h_t_dummy-team-to-update.json | 68 +++++++++++++++++++ .../__files/4-o_h_t_dummy-team-to-update.json | 68 +++++++++++++++++++ .../mappings/1-user.json | 48 +++++++++++++ .../mappings/2-orgs_hub4j-test-org.json | 48 +++++++++++++ .../3-o_h_t_dummy-team-to-update.json | 48 +++++++++++++ .../4-o_h_t_dummy-team-to-update.json | 54 +++++++++++++++ 8 files changed, 437 insertions(+) create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/__files/1-user.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/__files/2-orgs_hub4j-test-org.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/__files/3-o_h_t_dummy-team-to-update.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/__files/4-o_h_t_dummy-team-to-update.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/mappings/1-user.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/mappings/2-orgs_hub4j-test-org.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/mappings/3-o_h_t_dummy-team-to-update.json create mode 100644 src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/mappings/4-o_h_t_dummy-team-to-update.json diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/__files/1-user.json new file mode 100644 index 0000000000..65da4e72ab --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/__files/1-user.json @@ -0,0 +1,36 @@ +{ + "login": "rozza-sb", + "id": 136339038, + "node_id": "U_kgDOCCBeXg", + "avatar_url": "https://avatars.githubusercontent.com/u/136339038?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/rozza-sb", + "html_url": "https://github.com/rozza-sb", + "followers_url": "https://api.github.com/users/rozza-sb/followers", + "following_url": "https://api.github.com/users/rozza-sb/following{/other_user}", + "gists_url": "https://api.github.com/users/rozza-sb/gists{/gist_id}", + "starred_url": "https://api.github.com/users/rozza-sb/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/rozza-sb/subscriptions", + "organizations_url": "https://api.github.com/users/rozza-sb/orgs", + "repos_url": "https://api.github.com/users/rozza-sb/repos", + "events_url": "https://api.github.com/users/rozza-sb/events{/privacy}", + "received_events_url": "https://api.github.com/users/rozza-sb/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false, + "name": "Rory Kelly", + "company": null, + "blog": "", + "location": null, + "email": null, + "hireable": null, + "bio": null, + "twitter_username": null, + "notification_email": null, + "public_repos": 2, + "public_gists": 1, + "followers": 0, + "following": 0, + "created_at": "2023-06-12T12:41:11Z", + "updated_at": "2026-09-21T10:04:39Z" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/__files/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/__files/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..eea7b7303a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/__files/2-orgs_hub4j-test-org.json @@ -0,0 +1,67 @@ +{ + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 27, + "public_gists": 0, + "followers": 2, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2025-08-05T00:53:03Z", + "archived_at": null, + "type": "Organization", + "total_private_repos": 8, + "owned_private_repos": 8, + "private_gists": null, + "disk_usage": null, + "collaborators": null, + "billing_email": null, + "default_repository_permission": null, + "members_can_create_repositories": false, + "two_factor_requirement_enabled": null, + "members_allowed_repository_creation_type": "none", + "members_can_create_public_repositories": false, + "members_can_create_private_repositories": false, + "members_can_create_internal_repositories": false, + "members_can_create_pages": true, + "members_can_fork_private_repositories": false, + "web_commit_signoff_required": false, + "deploy_keys_enabled_for_repositories": false, + "members_can_delete_repositories": true, + "members_can_change_repo_visibility": true, + "members_can_invite_outside_collaborators": true, + "members_can_delete_issues": false, + "display_commenter_full_name_setting_enabled": false, + "readers_can_create_discussions": true, + "members_can_create_teams": true, + "members_can_view_dependency_insights": true, + "default_repository_branch": "main", + "members_can_create_public_pages": true, + "members_can_create_private_pages": true, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 10000, + "filled_seats": 54, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/__files/3-o_h_t_dummy-team-to-update.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/__files/3-o_h_t_dummy-team-to-update.json new file mode 100644 index 0000000000..b024ef3bf5 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/__files/3-o_h_t_dummy-team-to-update.json @@ -0,0 +1,68 @@ +{ + "name": "dummy-team-to-update", + "id": 20138402, + "node_id": "T_kwDOAHMfo84BM0mi", + "slug": "dummy-team-to-update", + "description": "hub4j/github-api#2249", + "privacy": "closed", + "notification_setting": "notifications_disabled", + "url": "https://api.github.com/organizations/7544739/team/20138402", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team-to-update", + "members_url": "https://api.github.com/organizations/7544739/team/20138402/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/20138402/repos", + "type": "organization", + "organization_id": 7544739, + "permission": "push", + "created_at": "2026-10-16T10:46:58Z", + "updated_at": "2026-10-16T10:59:03Z", + "members_count": 1, + "repos_count": 0, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 27, + "public_gists": 0, + "followers": 2, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2025-08-05T00:53:03Z", + "archived_at": null, + "type": "Organization" + }, + "parent": { + "name": "dummy-new-parent-team", + "id": 20138416, + "node_id": "T_kwDOAHMfo84BM0mw", + "slug": "dummy-new-parent-team", + "description": "hub4j/github-api#2249", + "privacy": "closed", + "notification_setting": "notifications_disabled", + "url": "https://api.github.com/organizations/7544739/team/20138416", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-new-parent-team", + "members_url": "https://api.github.com/organizations/7544739/team/20138416/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/20138416/repos", + "type": "organization", + "organization_id": 7544739, + "permission": "pull" + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/__files/4-o_h_t_dummy-team-to-update.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/__files/4-o_h_t_dummy-team-to-update.json new file mode 100644 index 0000000000..bd56c06042 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/__files/4-o_h_t_dummy-team-to-update.json @@ -0,0 +1,68 @@ +{ + "name": "dummy-team-updated", + "id": 20138402, + "node_id": "T_kwDOAHMfo84BM0mi", + "slug": "dummy-team-updated", + "description": "Updated by GHTeamUpdateBuilderTest", + "privacy": "closed", + "notification_setting": "notifications_disabled", + "url": "https://api.github.com/organizations/7544739/team/20138402", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team-updated", + "members_url": "https://api.github.com/organizations/7544739/team/20138402/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/20138402/repos", + "type": "organization", + "organization_id": 7544739, + "permission": "push", + "created_at": "2026-10-16T10:46:58Z", + "updated_at": "2026-10-16T10:59:36Z", + "members_count": 1, + "repos_count": 0, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 27, + "public_gists": 0, + "followers": 2, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2025-08-05T00:53:03Z", + "archived_at": null, + "type": "Organization" + }, + "parent": { + "name": "dummy-new-parent-team", + "id": 20138416, + "node_id": "T_kwDOAHMfo84BM0mw", + "slug": "dummy-new-parent-team", + "description": "hub4j/github-api#2249", + "privacy": "closed", + "notification_setting": "notifications_disabled", + "url": "https://api.github.com/organizations/7544739/team/20138416", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-new-parent-team", + "members_url": "https://api.github.com/organizations/7544739/team/20138416/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/20138416/repos", + "type": "organization", + "organization_id": 7544739, + "permission": "pull" + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/mappings/1-user.json new file mode 100644 index 0000000000..5abeb1c582 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/mappings/1-user.json @@ -0,0 +1,48 @@ +{ + "id": "3a616706-12b5-4a14-9488-8caaabcf0a15", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Fri, 16 Oct 2026 10:59:35 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"e8952fb82cf6b462ba11f814e7a8efba99abe678c7c024895ff65fed1268ddc8\"", + "Last-Modified": "Mon, 21 Sep 2026 10:04:39 GMT", + "github-authentication-token-expiration": "2026-11-15 11:34:00 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-accepted-github-permissions": "allows_permissionless_access=true", + "x-github-api-version-selected": "2022-11-28", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset, Warning", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4960", + "X-RateLimit-Reset": "1792150820", + "X-RateLimit-Used": "40", + "X-RateLimit-Resource": "core", + "X-GitHub-Request-Id": "2EAE:6296E:8C1EE1:D67E32:6AD20397", + "x-github-edge-region": "uksouth" + } + }, + "uuid": "3a616706-12b5-4a14-9488-8caaabcf0a15", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/mappings/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/mappings/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..bedd74a9e2 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/mappings/2-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "67e8784b-9761-49c9-b043-71c97ebd6520", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-orgs_hub4j-test-org.json", + "headers": { + "Date": "Fri, 16 Oct 2026 10:59:36 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"61f69c4f3a4a51a411f8aa42bf74b5e40bc0a88740afff0fe930aea738981a2f\"", + "Last-Modified": "Tue, 05 Aug 2025 00:53:03 GMT", + "github-authentication-token-expiration": "2026-11-15 11:34:00 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-accepted-github-permissions": "allows_permissionless_access=true", + "x-github-api-version-selected": "2022-11-28", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset, Warning", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4958", + "X-RateLimit-Reset": "1792150820", + "X-RateLimit-Used": "42", + "X-RateLimit-Resource": "core", + "X-GitHub-Request-Id": "254E:186748:8E6A60:D8D2EF:6AD20397", + "x-github-edge-region": "uksouth" + } + }, + "uuid": "67e8784b-9761-49c9-b043-71c97ebd6520", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/mappings/3-o_h_t_dummy-team-to-update.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/mappings/3-o_h_t_dummy-team-to-update.json new file mode 100644 index 0000000000..633309a5fb --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/mappings/3-o_h_t_dummy-team-to-update.json @@ -0,0 +1,48 @@ +{ + "id": "407062ed-b4c4-4ba8-8121-6c4dfcd3973e", + "name": "orgs_hub4j-test-org_teams_dummy-team-to-update", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team-to-update", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-o_h_t_dummy-team-to-update.json", + "headers": { + "Date": "Fri, 16 Oct 2026 10:59:36 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"b6600333381fce20748562135f8c71aad01428dea429defa59448d282ff6c8ae\"", + "Last-Modified": "Fri, 16 Oct 2026 10:59:03 GMT", + "github-authentication-token-expiration": "2026-11-15 11:34:00 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-accepted-github-permissions": "members=read", + "x-github-api-version-selected": "2022-11-28", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset, Warning", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4957", + "X-RateLimit-Reset": "1792150820", + "X-RateLimit-Used": "43", + "X-RateLimit-Resource": "core", + "X-GitHub-Request-Id": "202C:361180:8FC0D5:DA2E19:6AD20398", + "x-github-edge-region": "uksouth" + } + }, + "uuid": "407062ed-b4c4-4ba8-8121-6c4dfcd3973e", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/mappings/4-o_h_t_dummy-team-to-update.json b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/mappings/4-o_h_t_dummy-team-to-update.json new file mode 100644 index 0000000000..f9af8e2304 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamUpdateBuilderTest/wiremock/testUpdateTeamWithRemovedParentTeam/mappings/4-o_h_t_dummy-team-to-update.json @@ -0,0 +1,54 @@ +{ + "id": "8bdb3628-8aae-4b2e-a87a-bfddb73c3b3f", + "name": "orgs_hub4j-test-org_teams_dummy-team-to-update", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team-to-update", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"name\":\"dummy-team-updated\",\"description\":\"Updated by GHTeamUpdateBuilderTest\",\"privacy\":\"closed\",\"permission\":\"push\",\"notification_setting\":\"notifications-disabled\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "4-o_h_t_dummy-team-to-update.json", + "headers": { + "Date": "Fri, 16 Oct 2026 10:59:37 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"c864ba1413ecc75d216560e128ca85980f24f604c03a889274bf622f50a477fe\"", + "github-authentication-token-expiration": "2026-11-15 11:34:00 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-accepted-github-permissions": "members=write", + "x-github-api-version-selected": "2022-11-28", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset, Warning", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1792151320", + "X-RateLimit-Used": "17", + "X-RateLimit-Resource": "core", + "X-GitHub-Request-Id": "29AE:1411E2:8B9DAF:D5FF24:6AD20398", + "x-github-edge-region": "uksouth" + } + }, + "uuid": "8bdb3628-8aae-4b2e-a87a-bfddb73c3b3f", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file From e5d88880b38b54352ea7701013655f9f9687a48f Mon Sep 17 00:00:00 2001 From: Rory Kelly Date: Fri, 16 Oct 2026 13:34:30 +0100 Subject: [PATCH 09/13] Fix enum test for GHTeam.Role. --- src/test/java/org/kohsuke/github/EnumTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/kohsuke/github/EnumTest.java b/src/test/java/org/kohsuke/github/EnumTest.java index b008c488ed..f19fc58b46 100644 --- a/src/test/java/org/kohsuke/github/EnumTest.java +++ b/src/test/java/org/kohsuke/github/EnumTest.java @@ -111,7 +111,7 @@ public void touchEnums() { assertThat(GHTargetType.values().length, equalTo(3)); - assertThat(GHTeam.Role.values().length, equalTo(2)); + assertThat(GHTeam.Role.values().length, equalTo(3)); assertThat(GHTeam.Privacy.values().length, equalTo(3)); assertThat(GHUserSearchBuilder.Sort.values().length, equalTo(3)); From e08b0302cad885ea6cebab47fe0b07ccddc3f233 Mon Sep 17 00:00:00 2001 From: Rory Kelly Date: Fri, 16 Oct 2026 13:37:32 +0100 Subject: [PATCH 10/13] Add entry in enum test for GHTeam.NotificationSetting. --- src/test/java/org/kohsuke/github/EnumTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/org/kohsuke/github/EnumTest.java b/src/test/java/org/kohsuke/github/EnumTest.java index f19fc58b46..ac350d6fcb 100644 --- a/src/test/java/org/kohsuke/github/EnumTest.java +++ b/src/test/java/org/kohsuke/github/EnumTest.java @@ -111,6 +111,7 @@ public void touchEnums() { assertThat(GHTargetType.values().length, equalTo(3)); + assertThat(GHTeam.NotificationSetting.values().length, equalTo(3)); assertThat(GHTeam.Role.values().length, equalTo(3)); assertThat(GHTeam.Privacy.values().length, equalTo(3)); From 99c7c5f4151de433b8ff71ba031497cd852c9e0a Mon Sep 17 00:00:00 2001 From: Rory Kelly Date: Fri, 16 Oct 2026 13:48:10 +0100 Subject: [PATCH 11/13] Rename private assert method to avoid false-positive CI test failure. --- .../java/org/kohsuke/github/GHTeamUpdateBuilderTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java b/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java index 68539b881a..1f20ac5ef2 100644 --- a/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java +++ b/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java @@ -50,7 +50,7 @@ public void testUpdateTeamWithNewParentTeam() throws IOException { // Update team with different parent team GHTeam updatedTeam = getCommonBuilder(teamToUpdate).parentTeamId(newParentTeam.getId()).update(); - assertUpdatedTeam(updatedTeam); + validateUpdatedTeam(updatedTeam); // assertThat(updatedTeam.getParentTeam().getId(), equalTo(newParentTeam.getId())); } @@ -71,7 +71,7 @@ public void testUpdateTeamWithNoChangeToParentTeam() throws IOException { // update team with no change to parent team GHTeam updatedTeam = getCommonBuilder(teamToUpdate).update(); - assertUpdatedTeam(updatedTeam); + validateUpdatedTeam(updatedTeam); // assertThat(teamToUpdate.getParentTeam().getId(), equalTo(existingParentTeam.getId())); } @@ -90,7 +90,7 @@ public void testUpdateTeamWithRemovedParentTeam() throws IOException { // Update team with removed parent team GHTeam updatedTeam = getCommonBuilder(teamToUpdate).parentTeamId(null).update(); - assertUpdatedTeam(updatedTeam); + validateUpdatedTeam(updatedTeam); // assertThat(teamToUpdate.getParentTeam(), equalTo(null)); } @@ -100,7 +100,7 @@ public void testUpdateTeamWithRemovedParentTeam() throws IOException { * @param updatedTeam * the team to assert the updated values on */ - private void assertUpdatedTeam(GHTeam updatedTeam) { + private void validateUpdatedTeam(GHTeam updatedTeam) { assertThat(updatedTeam.getName(), equalTo(TEAM_TO_UPDATE_NEW_NAME)); assertThat(updatedTeam.getDescription(), equalTo(TEAM_TO_UPDATE_NEW_DESCRIPTION)); assertThat(updatedTeam.getPrivacy(), equalTo(TEAM_TO_UPDATE_NEW_PRIVACY)); From b21e14ea14d4730a035a0b2037d8a55b26fd5049 Mon Sep 17 00:00:00 2001 From: Rory Kelly Date: Fri, 16 Oct 2026 13:51:58 +0100 Subject: [PATCH 12/13] Run spotless. --- .../github/GHTeamUpdateBuilderTest.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java b/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java index 1f20ac5ef2..8e4f11d5fd 100644 --- a/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java +++ b/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java @@ -94,20 +94,6 @@ public void testUpdateTeamWithRemovedParentTeam() throws IOException { // assertThat(teamToUpdate.getParentTeam(), equalTo(null)); } - /** - * Assert that the updated team has the expected updated values. - * - * @param updatedTeam - * the team to assert the updated values on - */ - private void validateUpdatedTeam(GHTeam updatedTeam) { - assertThat(updatedTeam.getName(), equalTo(TEAM_TO_UPDATE_NEW_NAME)); - assertThat(updatedTeam.getDescription(), equalTo(TEAM_TO_UPDATE_NEW_DESCRIPTION)); - assertThat(updatedTeam.getPrivacy(), equalTo(TEAM_TO_UPDATE_NEW_PRIVACY)); - // assertThat(updatedTeam.getNotificationSetting(), equalTo(TEAM_TO_UPDATE_NEW_NOTIFICATIONS)); - assertThat(updatedTeam.getPermission(), equalTo(TEAM_TO_UPDATE_NEW_PERMISSIONS.name().toLowerCase())); - } - /** * Get the GHTeamUpdateBuilder instance with the common fields set for updating a team, to be used in the different * update scenarios. @@ -124,4 +110,18 @@ private GHTeamUpdateBuilder getCommonBuilder(GHTeam teamToUpdate) { .notifications(TEAM_TO_UPDATE_NEW_NOTIFICATIONS) .permission(TEAM_TO_UPDATE_NEW_PERMISSIONS); } + + /** + * Assert that the updated team has the expected updated values. + * + * @param updatedTeam + * the team to assert the updated values on + */ + private void validateUpdatedTeam(GHTeam updatedTeam) { + assertThat(updatedTeam.getName(), equalTo(TEAM_TO_UPDATE_NEW_NAME)); + assertThat(updatedTeam.getDescription(), equalTo(TEAM_TO_UPDATE_NEW_DESCRIPTION)); + assertThat(updatedTeam.getPrivacy(), equalTo(TEAM_TO_UPDATE_NEW_PRIVACY)); + // assertThat(updatedTeam.getNotificationSetting(), equalTo(TEAM_TO_UPDATE_NEW_NOTIFICATIONS)); + assertThat(updatedTeam.getPermission(), equalTo(TEAM_TO_UPDATE_NEW_PERMISSIONS.name().toLowerCase())); + } } From ed00d8657bbabbf2bc805a4ac8b8a2d45cae31f2 Mon Sep 17 00:00:00 2001 From: Rory Kelly Date: Fri, 16 Oct 2026 14:03:02 +0100 Subject: [PATCH 13/13] Add new builder and enum classes to reflect-config.json. --- .../github-api/reflect-config.json | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/main/resources/META-INF/native-image/org.kohsuke/github-api/reflect-config.json b/src/main/resources/META-INF/native-image/org.kohsuke/github-api/reflect-config.json index bb5b85772f..9f1af99d34 100644 --- a/src/main/resources/META-INF/native-image/org.kohsuke/github-api/reflect-config.json +++ b/src/main/resources/META-INF/native-image/org.kohsuke/github-api/reflect-config.json @@ -5804,6 +5804,21 @@ "allPublicClasses": true, "allDeclaredClasses": true }, + { + "name": "org.kohsuke.github.GHTeam$NotificationSetting", + "allPublicFields": true, + "allDeclaredFields": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredConstructors": true, + "queryAllPublicMethods": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredMethods": true, + "allPublicClasses": true, + "allDeclaredClasses": true + }, { "name": "org.kohsuke.github.GHTeam$Privacy", "allPublicFields": true, @@ -5939,6 +5954,21 @@ "allPublicClasses": true, "allDeclaredClasses": true }, + { + "name": "org.kohsuke.github.GHTeamUpdateBuilder", + "allPublicFields": true, + "allDeclaredFields": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredConstructors": true, + "queryAllPublicMethods": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredMethods": true, + "allPublicClasses": true, + "allDeclaredClasses": true + }, { "name": "org.kohsuke.github.GHThread", "allPublicFields": true,