diff --git a/src/main/java/org/kohsuke/github/GHTeam.java b/src/main/java/org/kohsuke/github/GHTeam.java index 49be640321..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. */ @@ -45,7 +63,9 @@ public enum Role { */ MAINTAINER, /** A normal member of the team. */ - MEMBER + MEMBER, + /** Unknown role. */ + UNKNOWN } /** @@ -511,6 +531,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..b877ba2ef3 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHTeamUpdateBuilder.java @@ -0,0 +1,125 @@ +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 existingName; + private final String orgName; + /** 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(); + } + + /** + * 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; + } + + /** + * 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; + } + + /** + * 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; + } + + /** + * 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 + public GHTeamUpdateBuilder permission(GHOrganization.Permission permission) { + this.builder.with("permission", permission); + 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; + } + + /** + * 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/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, diff --git a/src/test/java/org/kohsuke/github/EnumTest.java b/src/test/java/org/kohsuke/github/EnumTest.java index b008c488ed..ac350d6fcb 100644 --- a/src/test/java/org/kohsuke/github/EnumTest.java +++ b/src/test/java/org/kohsuke/github/EnumTest.java @@ -111,7 +111,8 @@ public void touchEnums() { assertThat(GHTargetType.values().length, equalTo(3)); - assertThat(GHTeam.Role.values().length, equalTo(2)); + assertThat(GHTeam.NotificationSetting.values().length, equalTo(3)); + assertThat(GHTeam.Role.values().length, equalTo(3)); assertThat(GHTeam.Privacy.values().length, equalTo(3)); assertThat(GHUserSearchBuilder.Sort.values().length, equalTo(3)); 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..8e4f11d5fd --- /dev/null +++ b/src/test/java/org/kohsuke/github/GHTeamUpdateBuilderTest.java @@ -0,0 +1,127 @@ +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 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 = "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.CLOSED; + + private static final String TEAM_TO_UPDATE_SLUG = "dummy-team-to-update"; + + /** + * Create default GHTeamBuilderTest instance + */ + 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 + */ + @Test + public void testUpdateTeamWithNewParentTeam() throws IOException { + // 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(); + + validateUpdatedTeam(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 + */ + @Test + public void testUpdateTeamWithNoChangeToParentTeam() throws IOException { + // 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(); + + validateUpdatedTeam(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(); + + validateUpdatedTeam(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. + * + * @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) + .description(TEAM_TO_UPDATE_NEW_DESCRIPTION) + .privacy(TEAM_TO_UPDATE_NEW_PRIVACY) + .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())); + } +} 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 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 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