diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 030b62af7d..767df3152e 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -86,7 +86,7 @@ jobs: run: mvn -B clean install -D enable-ci --file pom.xml "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED" - name: Codecov Report if: matrix.os == 'ubuntu' && matrix.java == '17' - uses: codecov/codecov-action@v4.1.0 + uses: codecov/codecov-action@v4.4.1 test-java-8: name: test Java 8 (no-build) diff --git a/pom.xml b/pom.xml index 2e3cdfd1d2..a8c2f5ef71 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.kohsuke github-api-unbridged - 1.321 + 1.322 GitHub API for Java https://github-api.kohsuke.org/ GitHub API for Java @@ -44,7 +44,7 @@ 0.50 false - 0.12.3 + 0.12.5 @@ -226,7 +226,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.4.1 + 3.6.3 8 true @@ -353,7 +353,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.3.0 + 3.4.1 @@ -519,7 +519,7 @@ org.awaitility awaitility - 4.2.0 + 4.2.1 test diff --git a/src/main/java/org/kohsuke/github/EnterpriseManagedSupport.java b/src/main/java/org/kohsuke/github/EnterpriseManagedSupport.java new file mode 100644 index 0000000000..5b4c62be6b --- /dev/null +++ b/src/main/java/org/kohsuke/github/EnterpriseManagedSupport.java @@ -0,0 +1,69 @@ +package org.kohsuke.github; + +import com.fasterxml.jackson.core.JsonProcessingException; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Optional; +import java.util.logging.Logger; + +/** + * Utility class for helping with operations for enterprise managed resources. + * + * @author Miguel Esteban Gutiérrez + */ +class EnterpriseManagedSupport { + + static final String COULD_NOT_RETRIEVE_ORGANIZATION_EXTERNAL_GROUPS = "Could not retrieve organization external groups"; + static final String NOT_PART_OF_EXTERNALLY_MANAGED_ENTERPRISE_ERROR = "This organization is not part of externally managed enterprise."; + static final String TEAM_CANNOT_BE_EXTERNALLY_MANAGED_ERROR = "This team cannot be externally managed since it has explicit members."; + + private static final Logger LOGGER = Logger.getLogger(EnterpriseManagedSupport.class.getName()); + + private final GHOrganization organization; + + private EnterpriseManagedSupport(GHOrganization organization) { + this.organization = organization; + } + + Optional filterException(final HttpException he, final String scenario) { + if (he.getResponseCode() == 400) { + final String responseMessage = he.getMessage(); + try { + final GHError error = GitHubClient.getMappingObjectReader(this.organization.root()) + .forType(GHError.class) + .readValue(responseMessage); + if (NOT_PART_OF_EXTERNALLY_MANAGED_ENTERPRISE_ERROR.equals(error.getMessage())) { + return Optional.of(new GHNotExternallyManagedEnterpriseException(scenario, error, he)); + } else if (TEAM_CANNOT_BE_EXTERNALLY_MANAGED_ERROR.equals(error.getMessage())) { + return Optional.of(new GHTeamCannotBeExternallyManagedException(scenario, error, he)); + } + } catch (final JsonProcessingException e) { + // We can ignore it + LOGGER.warning(() -> logUnexpectedFailure(e, responseMessage)); + } + } + return Optional.empty(); + } + + Optional filterException(final GHException e) { + if (e.getCause() instanceof HttpException) { + final HttpException he = (HttpException) e.getCause(); + return filterException(he, COULD_NOT_RETRIEVE_ORGANIZATION_EXTERNAL_GROUPS) + .map(translated -> new GHException(COULD_NOT_RETRIEVE_ORGANIZATION_EXTERNAL_GROUPS, translated)); + } + return Optional.empty(); + } + + static EnterpriseManagedSupport forOrganization(final GHOrganization org) { + return new EnterpriseManagedSupport(org); + } + + private static String logUnexpectedFailure(final JsonProcessingException exception, final String payload) { + final StringWriter sw = new StringWriter(); + final PrintWriter pw = new PrintWriter(sw); + exception.printStackTrace(pw); + return String.format("Could not parse GitHub error response: '%s'. Full stacktrace follows:%n%s", payload, sw); + } + +} diff --git a/src/main/java/org/kohsuke/github/GHBranchProtection.java b/src/main/java/org/kohsuke/github/GHBranchProtection.java index 834544944f..bdffc62f5b 100644 --- a/src/main/java/org/kohsuke/github/GHBranchProtection.java +++ b/src/main/java/org/kohsuke/github/GHBranchProtection.java @@ -1,5 +1,6 @@ package org.kohsuke.github; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -221,6 +222,55 @@ public boolean isEnabled() { } } + /** + * The type Check. + */ + public static class Check { + private String context; + + @JsonInclude(JsonInclude.Include.NON_NULL) + private Integer appId; + + /** + * no-arg constructor for the serializer + */ + public Check() { + } + + /** + * Regular constructor for use in user business logic + * + * @param context + * the context string of the check + * @param appId + * the application ID the check is supposed to come from. Pass "-1" to explicitly allow any app to + * set the status. Pass "null" to automatically select the GitHub App that has recently provided this + * check. + */ + public Check(String context, Integer appId) { + this.context = context; + this.appId = appId; + } + + /** + * The context string of the check + * + * @return the string + */ + public String getContext() { + return context; + } + + /** + * The application ID the check is supposed to come from. The value "-1" indicates "any source". + * + * @return the integer + */ + public Integer getAppId() { + return appId; + } + } + /** * The type AllowForcePushes. */ @@ -462,6 +512,9 @@ public static class RequiredStatusChecks { @JsonProperty private Collection contexts; + @JsonProperty + private Collection checks; + @JsonProperty private boolean strict; @@ -477,6 +530,15 @@ public Collection getContexts() { return Collections.unmodifiableCollection(contexts); } + /** + * Gets checks. + * + * @return the checks + */ + public Collection getChecks() { + return Collections.unmodifiableCollection(checks); + } + /** * Gets url. * diff --git a/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java b/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java index ec21b3168c..a496cbb0c3 100644 --- a/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java +++ b/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java @@ -11,6 +11,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; import static org.kohsuke.github.internal.Previews.LUKE_CAGE; @@ -50,8 +51,23 @@ public class GHBranchProtectionBuilder { * the checks * @return the gh branch protection builder */ + public GHBranchProtectionBuilder addRequiredStatusChecks(Collection checks) { + getStatusChecks().checks.addAll(checks); + return this; + } + + /** + * Add required checks gh branch protection builder. + * + * @param checks + * the checks + * @return the gh branch protection builder + */ + @Deprecated public GHBranchProtectionBuilder addRequiredChecks(Collection checks) { - getStatusChecks().contexts.addAll(checks); + getStatusChecks().checks.addAll(checks.stream() + .map(context -> new GHBranchProtection.Check(context, null)) + .collect(Collectors.toList())); return this; } @@ -62,11 +78,24 @@ public GHBranchProtectionBuilder addRequiredChecks(Collection checks) { * the checks * @return the gh branch protection builder */ + @Deprecated public GHBranchProtectionBuilder addRequiredChecks(String... checks) { addRequiredChecks(Arrays.asList(checks)); return this; } + /** + * Add required checks gh branch protection builder. + * + * @param checks + * the checks + * @return the gh branch protection builder + */ + public GHBranchProtectionBuilder addRequiredChecks(GHBranchProtection.Check... checks) { + addRequiredStatusChecks(Arrays.asList(checks)); + return this; + } + /** * Allow deletion of the protected branch. * @@ -547,7 +576,7 @@ private static class Restrictions { } private static class StatusChecks { - final List contexts = new ArrayList(); + final List checks = new ArrayList<>(); boolean strict; } } diff --git a/src/main/java/org/kohsuke/github/GHEnterpriseManagedUsersException.java b/src/main/java/org/kohsuke/github/GHEnterpriseManagedUsersException.java new file mode 100644 index 0000000000..9f237da599 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHEnterpriseManagedUsersException.java @@ -0,0 +1,44 @@ +package org.kohsuke.github; + +/** + * Failure related to Enterprise Managed Users operations. + * + * @author Miguel Esteban Gutiérrez + */ +public class GHEnterpriseManagedUsersException extends GHIOException { + + /** + * The serial version UID of the exception. + */ + private static final long serialVersionUID = 1980051901L; + + /** + * The error that caused the exception. + */ + private final GHError error; + + /** + * Instantiates a new exception. + * + * @param message + * the message + * @param error + * the error that caused the exception + * @param cause + * the cause + */ + public GHEnterpriseManagedUsersException(final String message, final GHError error, final Throwable cause) { + super(message, cause); + this.error = error; + } + + /** + * Get the error that caused the exception. + * + * @return the error + */ + public GHError getError() { + return error; + } + +} diff --git a/src/main/java/org/kohsuke/github/GHError.java b/src/main/java/org/kohsuke/github/GHError.java new file mode 100644 index 0000000000..ed2e52502c --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHError.java @@ -0,0 +1,52 @@ +package org.kohsuke.github; + +import com.fasterxml.jackson.annotation.JsonProperty; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + +import java.io.Serializable; +import java.net.URL; + +/** + * Represents an error from GitHub. + * + * @author Miguel Esteban Gutiérrez + */ +public class GHError implements Serializable { + + /** + * The serial version UID of the error + */ + private static final long serialVersionUID = 2008071901; + + /** + * The error message. + */ + @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization") + private String message; + + /** + * The URL to the documentation for the error. + */ + @JsonProperty("documentation_url") + @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization") + private String documentation; + + /** + * Get the error message. + * + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * Get the URL to the documentation for the error. + * + * @return the url + */ + public URL getDocumentationUrl() { + return GitHubClient.parseURL(documentation); + } + +} diff --git a/src/main/java/org/kohsuke/github/GHEventPayload.java b/src/main/java/org/kohsuke/github/GHEventPayload.java index 91cbde47ac..2e34daa299 100644 --- a/src/main/java/org/kohsuke/github/GHEventPayload.java +++ b/src/main/java/org/kohsuke/github/GHEventPayload.java @@ -1445,6 +1445,16 @@ public void setRelease(GHRelease release) { * @see Repositories */ public static class Repository extends GHEventPayload { + private GHRepositoryChanges changes; + + /** + * Get changes. + * + * @return GHRepositoryChanges + */ + public GHRepositoryChanges getChanges() { + return changes; + } } diff --git a/src/main/java/org/kohsuke/github/GHExternalGroup.java b/src/main/java/org/kohsuke/github/GHExternalGroup.java new file mode 100644 index 0000000000..b5bba0f266 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHExternalGroup.java @@ -0,0 +1,253 @@ +package org.kohsuke.github; + +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + +import java.io.IOException; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +/** + * An external group available in a GitHub organization. + * + * @author Miguel Esteban Gutiérrez + */ +public class GHExternalGroup extends GitHubInteractiveObject implements Refreshable { + + /** + * A reference of a team linked to an external group + * + * @author Miguel Esteban Gutiérrez + */ + public static class GHLinkedTeam { + + /** + * The identifier of the team + */ + @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization") + private long teamId; + + /** + * The name of the team + */ + @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization") + private String teamName; + + /** + * Get the linked team identifier + * + * @return the id + */ + public long getId() { + return teamId; + } + + /** + * Get the linked team name + * + * @return the name + */ + public String getName() { + return teamName; + } + + } + + /** + * A reference of an external member linked to an external group + */ + public static class GHLinkedExternalMember { + + /** + * The internal user ID of the identity + */ + @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization") + private long memberId; + + /** + * The handle/login for the user + */ + @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization") + private String memberLogin; + + /** + * The user display name/profile name + */ + @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization") + private String memberName; + + /** + * The email attached to the user + */ + @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization") + private String memberEmail; + + /** + * Get the linked member identifier + * + * @return the id + */ + public long getId() { + return memberId; + } + + /** + * Get the linked member login + * + * @return the login + */ + public String getLogin() { + return memberLogin; + } + + /** + * Get the linked member name + * + * @return the name + */ + public String getName() { + return memberName; + } + + /** + * Get the linked member email + * + * @return the email + */ + public String getEmail() { + return memberEmail; + } + + } + + /** + * The identifier of the external group + */ + @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization") + private long groupId; + + /** + * The name of the external group + */ + @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization") + private String groupName; + + /** + * The date when the group was last updated at + */ + @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization") + private String updatedAt; + + /** + * The teams linked to this group + */ + @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization") + private List teams; + + /** + * The external members linked to this group + */ + @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization") + private List members; + + GHExternalGroup() { + this.teams = Collections.emptyList(); + this.members = Collections.emptyList(); + } + + private GHOrganization organization; + + /** + * Wrap up. + * + * @param owner + * the owner + */ + GHExternalGroup wrapUp(final GHOrganization owner) { + this.organization = owner; + return this; + } + + /** + * Wrap up. + * + * @param root + * the root + */ + void wrapUp(final GitHub root) { // auto-wrapUp when organization is known from GET /orgs/{org}/external-groups + wrapUp(organization); + } + + /** + * Gets organization. + * + * @return the organization + * @throws IOException + * the io exception + */ + @SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior") + public GHOrganization getOrganization() throws IOException { + return organization; + } + + /** + * Get the external group id. + * + * @return the id + */ + public long getId() { + return groupId; + } + + /** + * Get the external group name. + * + * @return the name + */ + public String getName() { + return groupName; + } + + /** + * Get the external group last update date. + * + * @return the date + */ + public Date getUpdatedAt() { + return GitHubClient.parseDate(updatedAt); + } + + /** + * Get the teams linked to this group. + * + * @return the teams + */ + public List getTeams() { + return Collections.unmodifiableList(teams); + } + + /** + * Get the external members linked to this group. + * + * @return the external members + */ + public List getMembers() { + return Collections.unmodifiableList(members); + } + + /** + * Refresh. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Override + public void refresh() throws IOException { + root().createRequest().withUrlPath(api("")).fetchInto(this).wrapUp(root()); + } + + private String api(final String tail) { + return "/orgs/" + organization.getLogin() + "/external-group/" + getId() + tail; + } + +} diff --git a/src/main/java/org/kohsuke/github/GHExternalGroupIterable.java b/src/main/java/org/kohsuke/github/GHExternalGroupIterable.java new file mode 100644 index 0000000000..f921fdd920 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHExternalGroupIterable.java @@ -0,0 +1,77 @@ +package org.kohsuke.github; + +import java.util.Arrays; +import java.util.Iterator; + +import javax.annotation.Nonnull; + +/** + * Iterable for external group listing. + * + * @author Miguel Esteban Gutiérrez + */ +class GHExternalGroupIterable extends PagedIterable { + + private final GHOrganization owner; + + private final GitHubRequest request; + + private GHExternalGroupPage result; + + /** + * Instantiates a new GH external groups iterable. + * + * @param owner + * the owner + * @param requestBuilder + * the request builder + */ + GHExternalGroupIterable(final GHOrganization owner, final GitHubRequest.Builder requestBuilder) { + this.owner = owner; + this.request = requestBuilder.build(); + } + + /** + * Iterator. + * + * @param pageSize + * the page size + * @return the paged iterator + */ + @Nonnull + @Override + public PagedIterator _iterator(int pageSize) { + return new PagedIterator<>( + adapt(GitHubPageIterator + .create(owner.root().getClient(), GHExternalGroupPage.class, request, pageSize)), + null); + } + + /** + * Adapt. + * + * @param base + * the base + * @return the iterator + */ + private Iterator adapt(final Iterator base) { + return new Iterator() { + public boolean hasNext() { + try { + return base.hasNext(); + } catch (final GHException e) { + throw EnterpriseManagedSupport.forOrganization(owner).filterException(e).orElse(e); + } + } + + public GHExternalGroup[] next() { + GHExternalGroupPage v = base.next(); + if (result == null) { + result = v; + } + Arrays.stream(v.getGroups()).forEach(g -> g.wrapUp(owner)); + return v.getGroups(); + } + }; + } +} diff --git a/src/main/java/org/kohsuke/github/GHExternalGroupPage.java b/src/main/java/org/kohsuke/github/GHExternalGroupPage.java new file mode 100644 index 0000000000..d47b49678c --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHExternalGroupPage.java @@ -0,0 +1,34 @@ +package org.kohsuke.github; + +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + +/** + * A list of external groups. + * + * @author Miguel Esteban Gutiérrez + */ +class GHExternalGroupPage { + + private static final GHExternalGroup[] GH_EXTERNAL_GROUPS = new GHExternalGroup[0]; + + private GHExternalGroup[] groups; + + GHExternalGroupPage() { + this(GH_EXTERNAL_GROUPS); + } + + GHExternalGroupPage(GHExternalGroup[] groups) { + this.groups = groups; + } + + /** + * Gets the groups. + * + * @return the groups + */ + @SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior") + public GHExternalGroup[] getGroups() { + return groups; + } + +} diff --git a/src/main/java/org/kohsuke/github/GHNotExternallyManagedEnterpriseException.java b/src/main/java/org/kohsuke/github/GHNotExternallyManagedEnterpriseException.java new file mode 100644 index 0000000000..252413d0e2 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHNotExternallyManagedEnterpriseException.java @@ -0,0 +1,29 @@ +package org.kohsuke.github; + +/** + * Failure when the operation cannot be carried out because the resource is not part of an externally managed + * enterprise. + * + * @author Miguel Esteban Gutiérrez + */ +public class GHNotExternallyManagedEnterpriseException extends GHEnterpriseManagedUsersException { + + /** + * The serial version UID of the exception. + */ + private static final long serialVersionUID = 1978052201L; + + /** + * Instantiates a new exception. + * + * @param message + * the message + * @param error + * the error that caused the exception + * @param cause + * the cause + */ + public GHNotExternallyManagedEnterpriseException(final String message, final GHError error, final Throwable cause) { + super(message, error, cause); + } +} diff --git a/src/main/java/org/kohsuke/github/GHOrganization.java b/src/main/java/org/kohsuke/github/GHOrganization.java index b0178971b6..45711792ed 100644 --- a/src/main/java/org/kohsuke/github/GHOrganization.java +++ b/src/main/java/org/kohsuke/github/GHOrganization.java @@ -2,17 +2,12 @@ import java.io.IOException; import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; +import java.util.*; import static org.kohsuke.github.internal.Previews.INERTIA; // TODO: Auto-generated Javadoc + /** * The type GHOrganization. * @@ -193,6 +188,63 @@ public GHTeam getTeamBySlug(String slug) throws IOException { .wrapUp(this); } + /** + * List up all the external groups. + * + * @return the paged iterable + * @throws IOException + * the io exception + * @see documentation + */ + public PagedIterable listExternalGroups() throws IOException { + return listExternalGroups(null); + } + + /** + * List up all the external groups with a given text in their name + * + * @param displayName + * the text that must be part of the returned groups name + * @return the paged iterable + * @throws IOException + * the io exception + * @see documentation + */ + public PagedIterable listExternalGroups(final String displayName) throws IOException { + final Requester requester = root().createRequest() + .withUrlPath(String.format("/orgs/%s/external-groups", login)); + if (displayName != null) { + requester.with("display_name", displayName); + } + return new GHExternalGroupIterable(this, requester); + } + + /** + * Gets a single external group by ID. + * + * @param groupId + * id of the external group that we want to query for + * @return the external group + * @throws IOException + * the io exception + * @see documentation + */ + public GHExternalGroup getExternalGroup(final long groupId) throws IOException { + try { + return root().createRequest() + .withUrlPath(String.format("/orgs/%s/external-group/%d", login, groupId)) + .fetch(GHExternalGroup.class) + .wrapUp(this); + } catch (final HttpException e) { + throw EnterpriseManagedSupport.forOrganization(this) + .filterException(e, "Could not retrieve organization external group") + .orElse(e); + } + } + /** * Member's role in an organization. */ @@ -240,6 +292,26 @@ public boolean hasMember(GHUser user) { } } + /** + * Obtains the object that represents the user membership. In order to get a user's membership with an organization, + * the authenticated user must be an organization member. The state parameter in the response can be used to + * identify the user's membership status. + * + * @param username + * the user's username + * @return the GHMembership if the username belongs to the organisation, otherwise null + * @throws IOException + * the io exception + * + * @see documentation + */ + public GHMembership getMembership(String username) throws IOException { + return root().createRequest() + .withUrlPath("/orgs/" + login + "/memberships/" + username) + .fetch(GHMembership.class); + } + /** * Remove a member of the organisation - which will remove them from all teams, and remove their access to the * organization’s repositories. @@ -378,6 +450,19 @@ private PagedIterable listMembers(final String suffix, final String filt .toIterable(GHUser[].class, null); } + /** + * List up all the security managers. + * + * @return the paged iterable + * @throws IOException + * the io exception + */ + public PagedIterable listSecurityManagers() throws IOException { + return root().createRequest() + .withUrlPath(String.format("/orgs/%s/security-managers", login)) + .toIterable(GHTeam[].class, item -> item.wrapUp(this)); + } + /** * Conceals the membership. * diff --git a/src/main/java/org/kohsuke/github/GHRepositoryChanges.java b/src/main/java/org/kohsuke/github/GHRepositoryChanges.java new file mode 100644 index 0000000000..9c9aa578d3 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHRepositoryChanges.java @@ -0,0 +1,106 @@ +package org.kohsuke.github; + +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + +/** + * Changes made to a repository. + */ +@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD" }, justification = "JSON API") +public class GHRepositoryChanges { + private FromRepository repository; + private Owner owner; + + /** + * Get outer owner object. + * + * @return Owner + */ + public Owner getOwner() { + return owner; + } + + /** + * Outer object of owner from whom this repository was transferred. + */ + public static class Owner { + private FromOwner from; + + /** + * Get in owner object. + * + * @return FromOwner + */ + public FromOwner getFrom() { + return from; + } + } + + /** + * Owner from whom this repository was transferred. + */ + public static class FromOwner { + private GHUser user; + private GHOrganization organization; + + /** + * Get user from which this repository was transferred. + * + * @return user + */ + @SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected") + public GHUser getUser() { + return user; + } + + /** + * Get organization from which this repository was transferred. + * + * @return GHOrganization + */ + @SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected") + public GHOrganization getOrganization() { + return organization; + } + } + + /** + * Get repository. + * + * @return FromRepository + */ + public FromRepository getRepository() { + return repository; + } + + /** + * Repository object from which the name was changed. + */ + public static class FromRepository { + private FromName name; + + /** + * Get top level object for the previous name of the repository. + * + * @return FromName + */ + public FromName getName() { + return name; + } + } + + /** + * Repository name that was changed. + */ + public static class FromName { + private String from; + + /** + * Get previous name of the repository before rename. + * + * @return String + */ + public String getFrom() { + return from; + } + } +} diff --git a/src/main/java/org/kohsuke/github/GHRequestedAction.java b/src/main/java/org/kohsuke/github/GHRequestedAction.java index b2a88757bf..db87a833ba 100644 --- a/src/main/java/org/kohsuke/github/GHRequestedAction.java +++ b/src/main/java/org/kohsuke/github/GHRequestedAction.java @@ -33,7 +33,7 @@ GHRequestedAction wrap(GHRepository owner) { * * @return the identifier */ - String getIdentifier() { + public String getIdentifier() { return identifier; } diff --git a/src/main/java/org/kohsuke/github/GHTeam.java b/src/main/java/org/kohsuke/github/GHTeam.java index 89bae4336a..4d94735aec 100644 --- a/src/main/java/org/kohsuke/github/GHTeam.java +++ b/src/main/java/org/kohsuke/github/GHTeam.java @@ -6,11 +6,7 @@ import java.io.IOException; import java.net.URL; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.TreeMap; +import java.util.*; import javax.annotation.Nonnull; @@ -23,6 +19,12 @@ * @author Kohsuke Kawaguchi */ public class GHTeam extends GHObject implements Refreshable { + + /** + * Path for external group-related operations + */ + private static final String EXTERNAL_GROUPS = "/external-groups"; + private String html_url; private String name; private String permission; @@ -409,6 +411,10 @@ private String api(String tail) { return "/organizations/" + organization.getId() + "/team/" + getId() + tail; } + private String publicApi(String tail) throws IOException { + return "/orgs/" + getOrganization().login + "/teams/" + getSlug() + tail; + } + /** * Begins the creation of a new instance. * @@ -424,6 +430,82 @@ public GHDiscussion.Creator createDiscussion(String title) throws IOException { return GHDiscussion.create(this).title(title); } + /** + * Get the external groups connected to the team + * + * @return the external groups + * @throws IOException + * the io exception + * @see documentation + */ + public List getExternalGroups() throws IOException { + try { + return Collections.unmodifiableList(Arrays.asList(root().createRequest() + .method("GET") + .withUrlPath(publicApi(EXTERNAL_GROUPS)) + .fetch(GHExternalGroupPage.class) + .getGroups())); + } catch (final HttpException e) { + throw EnterpriseManagedSupport.forOrganization(getOrganization()) + .filterException(e, "Could not retrieve team external groups") + .orElse(e); + } + } + + /** + * Connect an external group to the team + * + * @param group + * the group to connect + * @return the external group + * @throws IOException + * in case of failure + * @see documentation + */ + public GHExternalGroup connectToExternalGroup(final GHExternalGroup group) throws IOException { + return connectToExternalGroup(group.getId()); + } + + /** + * Connect an external group to the team + * + * @param group_id + * the identifier of the group to connect + * @return the external group + * @throws IOException + * in case of failure + * @see documentation + */ + public GHExternalGroup connectToExternalGroup(final long group_id) throws IOException { + try { + return root().createRequest() + .method("PATCH") + .with("group_id", group_id) + .withUrlPath(publicApi(EXTERNAL_GROUPS)) + .fetch(GHExternalGroup.class) + .wrapUp(getOrganization()); + } catch (final HttpException e) { + throw EnterpriseManagedSupport.forOrganization(getOrganization()) + .filterException(e, "Could not connect team to external group") + .orElse(e); + } + } + + /** + * Remove the connection of the team to an external group + * + * @throws IOException + * in case of failure + * @see documentation + */ + public void deleteExternalGroupConnection() throws IOException { + root().createRequest().method("DELETE").withUrlPath(publicApi(EXTERNAL_GROUPS)).send(); + } + /** * Gets organization. * @@ -488,4 +570,5 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash(name, getUrl(), permission, slug, description, privacy); } + } diff --git a/src/main/java/org/kohsuke/github/GHTeamCannotBeExternallyManagedException.java b/src/main/java/org/kohsuke/github/GHTeamCannotBeExternallyManagedException.java new file mode 100644 index 0000000000..42ca81c764 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHTeamCannotBeExternallyManagedException.java @@ -0,0 +1,28 @@ +package org.kohsuke.github; + +/** + * Failure when the operation cannot be carried out because the team cannot be externally managed. + * + * @author Kohsuke Kawaguchi + */ +public class GHTeamCannotBeExternallyManagedException extends GHEnterpriseManagedUsersException { + + /** + * The serial version UID of the exception. + */ + private static final long serialVersionUID = 2013101301L; + + /** + * Instantiates a new exception. + * + * @param message + * the message + * @param error + * the error that caused the exception + * @param cause + * the cause + */ + public GHTeamCannotBeExternallyManagedException(final String message, final GHError error, final Throwable cause) { + super(message, error, cause); + } +} diff --git a/src/main/java/org/kohsuke/github/GitHubAbuseLimitHandler.java b/src/main/java/org/kohsuke/github/GitHubAbuseLimitHandler.java index 4b40ff0b1c..0555ead239 100644 --- a/src/main/java/org/kohsuke/github/GitHubAbuseLimitHandler.java +++ b/src/main/java/org/kohsuke/github/GitHubAbuseLimitHandler.java @@ -28,9 +28,47 @@ public abstract class GitHubAbuseLimitHandler extends GitHubConnectorResponseErr * Signals that an I/O exception has occurred. */ @Override - boolean isError(@Nonnull GitHubConnectorResponse connectorResponse) throws IOException { - return connectorResponse.statusCode() == HttpURLConnection.HTTP_FORBIDDEN - && connectorResponse.header("Retry-After") != null; + boolean isError(@Nonnull GitHubConnectorResponse connectorResponse) { + return isForbidden(connectorResponse) && hasRetryOrLimitHeader(connectorResponse); + } + + /** + * Checks if the response status code is HTTP_FORBIDDEN (403). + * + * @param connectorResponse + * the response from the GitHub connector + * @return true if the status code is HTTP_FORBIDDEN + */ + private boolean isForbidden(GitHubConnectorResponse connectorResponse) { + return connectorResponse.statusCode() == HttpURLConnection.HTTP_FORBIDDEN; + } + + /** + * Checks if the response contains either "Retry-After" or "gh-limited-by" headers. GitHub does not guarantee the + * presence of the Retry-After header. However, the gh-limited-by header is included in the response when the error + * is due to rate limiting + * + * @param connectorResponse + * the response from the GitHub connector + * @return true if either "Retry-After" or "gh-limited-by" headers are present + * @see + */ + private boolean hasRetryOrLimitHeader(GitHubConnectorResponse connectorResponse) { + return hasHeader(connectorResponse, "Retry-After") || hasHeader(connectorResponse, "gh-limited-by"); + } + + /** + * Checks if the response contains a specific header. + * + * @param connectorResponse + * the response from the GitHub connector + * @param headerName + * the name of the header to check for + * @return true if the specified header is present + */ + private boolean hasHeader(GitHubConnectorResponse connectorResponse, String headerName) { + return connectorResponse.header(headerName) != null; } /** diff --git a/src/test/java/org/kohsuke/github/AbuseLimitHandlerTest.java b/src/test/java/org/kohsuke/github/AbuseLimitHandlerTest.java index 646eca6d00..2ffe762f70 100644 --- a/src/test/java/org/kohsuke/github/AbuseLimitHandlerTest.java +++ b/src/test/java/org/kohsuke/github/AbuseLimitHandlerTest.java @@ -307,4 +307,72 @@ public void onError(IOException e, HttpURLConnection uc) throws IOException { assertThat(mockGitHub.getRequestCount(), equalTo(4)); } + /** + * Tests the behavior of the GitHub API client when the abuse limit handler is set to WAIT then the handler waits + * appropriately when secondary rate limits are encountered. + * + * @throws Exception + * if any error occurs during the test execution. + */ + @Test + public void testHandler_Wait_Secondary_Limits() throws Exception { + // Customized response that templates the date to keep things working + snapshotNotAllowed(); + final HttpURLConnection[] savedConnection = new HttpURLConnection[1]; + gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl()) + .withAbuseLimitHandler(new AbuseLimitHandler() { + /** + * Overriding method because the actual method will wait for one minute causing slowness in unit + * tests + */ + @Override + public void onError(IOException e, HttpURLConnection uc) throws IOException { + savedConnection[0] = uc; + // Verify + assertThat(uc.getDate(), Matchers.greaterThanOrEqualTo(new Date().getTime() - 10000)); + assertThat(uc.getExpiration(), equalTo(0L)); + assertThat(uc.getIfModifiedSince(), equalTo(0L)); + assertThat(uc.getLastModified(), equalTo(1581014017000L)); + assertThat(uc.getRequestMethod(), equalTo("GET")); + assertThat(uc.getResponseCode(), equalTo(403)); + assertThat(uc.getResponseMessage(), containsString("Forbidden")); + assertThat(uc.getURL().toString(), + endsWith("/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits")); + assertThat(uc.getHeaderFieldInt("X-RateLimit-Limit", 10), equalTo(5000)); + assertThat(uc.getHeaderFieldInt("X-RateLimit-Remaining", 10), equalTo(4000)); + assertThat(uc.getHeaderFieldInt("X-Foo", 20), equalTo(20)); + assertThat(uc.getHeaderFieldLong("X-RateLimit-Limit", 15L), equalTo(5000L)); + assertThat(uc.getHeaderFieldLong("X-RateLimit-Remaining", 15L), equalTo(4000L)); + assertThat(uc.getHeaderFieldLong("X-Foo", 20L), equalTo(20L)); + assertThat(uc.getHeaderField("gh-limited-by"), equalTo("search-elapsed-time-shared-grouped")); + assertThat(uc.getContentEncoding(), nullValue()); + assertThat(uc.getContentType(), equalTo("application/json; charset=utf-8")); + assertThat(uc.getContentLength(), equalTo(-1)); + assertThat(uc.getHeaderFields(), instanceOf(Map.class)); + assertThat(uc.getHeaderFields().size(), Matchers.greaterThan(25)); + assertThat(uc.getHeaderField("Status"), equalTo("403 Forbidden")); + + try (InputStream errorStream = uc.getErrorStream()) { + assertThat(errorStream, notNullValue()); + String errorString = IOUtils.toString(errorStream, StandardCharsets.UTF_8); + assertThat(errorString, + containsString( + "You have exceeded a secondary rate limit. Please wait a few minutes before you try again")); + } + AbuseLimitHandler.FAIL.onError(e, uc); + } + }) + .build(); + + gitHub.getMyself(); + assertThat(mockGitHub.getRequestCount(), equalTo(1)); + try { + getTempRepository(); + fail(); + } catch (Exception e) { + assertThat(e, instanceOf(HttpException.class)); + assertThat(e.getMessage(), equalTo("Abuse limit reached")); + } + assertThat(mockGitHub.getRequestCount(), equalTo(2)); + } } diff --git a/src/test/java/org/kohsuke/github/EnterpriseManagedSupportTest.java b/src/test/java/org/kohsuke/github/EnterpriseManagedSupportTest.java new file mode 100644 index 0000000000..9ddc72ea66 --- /dev/null +++ b/src/test/java/org/kohsuke/github/EnterpriseManagedSupportTest.java @@ -0,0 +1,184 @@ +package org.kohsuke.github; + +import org.junit.Test; + +import java.io.IOException; +import java.util.Optional; + +import static org.hamcrest.Matchers.*; + +// TODO: Auto-generated Javadoc + +/** + * The Class EnterpriseManagedSupportTest. + */ +public class EnterpriseManagedSupportTest extends AbstractGitHubWireMockTest { + + private static final String NOT_PART_OF_EXTERNALLY_MANAGED_ENTERPRISE_ERROR = "{\"message\":\"This organization is not part of externally managed enterprise.\"," + + "\"documentation_url\": \"https://docs.github.com/rest/teams/external-groups#list-external-groups-in-an-organization\"}"; + + private static final String UNKNOWN_ERROR = "{\"message\":\"Unknown error\"," + + "\"documentation_url\": \"https://docs.github.com/rest/unknown#unknown\"}"; + + private static final String TEAM_CANNOT_BE_EXTERNALLY_MANAGED_ERROR = "{\"message\":\"This team cannot be externally managed since it has explicit members.\"," + + "\"documentation_url\": \"https://docs.github.com/rest/teams/external-groups#list-a-connection-between-an-external-group-and-a-team\"}"; + + /** + * Test to ensure that only HttpExceptions are handled + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testIgnoreNonHttpException() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + final GHException inputCause = new GHException("Cause"); + final GHException inputException = new GHException("Test", inputCause); + + final Optional maybeException = EnterpriseManagedSupport.forOrganization(org) + .filterException(inputException); + + assertThat(maybeException.isPresent(), is(false)); + } + + /** + * Test to ensure that only BadRequests HttpExceptions are handled + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testIgnoreNonBadRequestExceptions() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + final HttpException inputCause = new HttpException(NOT_PART_OF_EXTERNALLY_MANAGED_ENTERPRISE_ERROR, + 404, + "Error", + org.getUrl().toString()); + final GHException inputException = new GHException("Test", inputCause); + + final Optional maybeException = EnterpriseManagedSupport.forOrganization(org) + .filterException(inputException); + + assertThat(maybeException.isPresent(), is(false)); + } + + /** + * Test to ensure that only BadRequests HttpExceptions with parseable JSON payload are handled + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testIgnoreBadRequestsWithUnparseableJson() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + final HttpException inputCause = new HttpException("Error", 400, "Error", org.getUrl().toString()); + final GHException inputException = new GHException("Test", inputCause); + + final Optional maybeException = EnterpriseManagedSupport.forOrganization(org) + .filterException(inputException); + + assertThat(maybeException.isPresent(), is(false)); + } + + /** + * Test to ensure that only BadRequests HttpExceptions with known error message are handled + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testIgnoreBadRequestsWithUnknownErrorMessage() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + final HttpException inputCause = new HttpException(UNKNOWN_ERROR, 400, "Error", org.getUrl().toString()); + final GHException inputException = new GHException("Test", inputCause); + + final Optional maybeException = EnterpriseManagedSupport.forOrganization(org) + .filterException(inputException); + + assertThat(maybeException.isPresent(), is(false)); + } + + /** + * Test to validate compliant use case. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testHandleEmbeddedNotPartOfExternallyManagedEnterpriseHttpException() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + final HttpException inputCause = new HttpException(NOT_PART_OF_EXTERNALLY_MANAGED_ENTERPRISE_ERROR, + 400, + "Error", + org.getUrl().toString()); + final GHException inputException = new GHException("Test", inputCause); + + final Optional maybeException = EnterpriseManagedSupport.forOrganization(org) + .filterException(inputException); + + assertThat(maybeException.isPresent(), is(true)); + + final GHException exception = maybeException.get(); + + assertThat(exception.getMessage(), + equalTo(EnterpriseManagedSupport.COULD_NOT_RETRIEVE_ORGANIZATION_EXTERNAL_GROUPS)); + + final Throwable cause = exception.getCause(); + + assertThat(cause, instanceOf(GHNotExternallyManagedEnterpriseException.class)); + + final GHNotExternallyManagedEnterpriseException failure = (GHNotExternallyManagedEnterpriseException) cause; + + assertThat(failure.getCause(), is(inputCause)); + assertThat(failure.getMessage(), + equalTo(EnterpriseManagedSupport.COULD_NOT_RETRIEVE_ORGANIZATION_EXTERNAL_GROUPS)); + + final GHError error = failure.getError(); + + assertThat(error, notNullValue()); + assertThat(error.getMessage(), + equalTo(EnterpriseManagedSupport.NOT_PART_OF_EXTERNALLY_MANAGED_ENTERPRISE_ERROR)); + assertThat(error.getDocumentationUrl(), notNullValue()); + } + + /** + * Test to validate another compliant use case. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testHandleTeamCannotBeExternallyManagedHttpException() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + final HttpException inputException = new HttpException(TEAM_CANNOT_BE_EXTERNALLY_MANAGED_ERROR, + 400, + "Error", + org.getUrl().toString()); + + final Optional maybeException = EnterpriseManagedSupport.forOrganization(org) + .filterException(inputException, "Scenario"); + + assertThat(maybeException.isPresent(), is(true)); + + final GHIOException exception = maybeException.get(); + + assertThat(exception.getMessage(), equalTo("Scenario")); + assertThat(exception.getCause(), is(inputException)); + + assertThat(exception, instanceOf(GHTeamCannotBeExternallyManagedException.class)); + + final GHTeamCannotBeExternallyManagedException failure = (GHTeamCannotBeExternallyManagedException) exception; + + final GHError error = failure.getError(); + + assertThat(error, notNullValue()); + assertThat(error.getMessage(), equalTo(EnterpriseManagedSupport.TEAM_CANNOT_BE_EXTERNALLY_MANAGED_ERROR)); + assertThat(error.getDocumentationUrl(), notNullValue()); + } +} diff --git a/src/test/java/org/kohsuke/github/ExternalGroupsTestingSupport.java b/src/test/java/org/kohsuke/github/ExternalGroupsTestingSupport.java new file mode 100644 index 0000000000..73cb162ec5 --- /dev/null +++ b/src/test/java/org/kohsuke/github/ExternalGroupsTestingSupport.java @@ -0,0 +1,99 @@ +package org.kohsuke.github; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; + +import java.util.List; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +/** + * Supporting stuff for testing external groups + */ +class ExternalGroupsTestingSupport { + + static GHExternalGroup findExternalGroup(List groups, Predicate predicate) { + return groups.stream().filter(predicate).findFirst().orElseThrow(AssertionError::new); + } + + static Predicate hasName(String anObject) { + return g -> g.getName().equals(anObject); + } + + static List groupSummary(List groups) { + return collect(groups, ExternalGroupsTestingSupport::describeGroup); + } + + static List teamSummary(GHExternalGroup sut) { + return collect(sut.getTeams(), ExternalGroupsTestingSupport::describeTeam); + } + + static List membersSummary(GHExternalGroup sut) { + return collect(sut.getMembers(), ExternalGroupsTestingSupport::describeMember); + } + + private static List collect(List collection, Function transformation) { + return collection.stream().map(transformation).collect(Collectors.toList()); + } + + private static String describeGroup(GHExternalGroup g) { + return String.format("%d:%s", g.getId(), g.getName()); + } + + private static String describeTeam(GHExternalGroup.GHLinkedTeam t) { + return String.format("%d:%s", t.getId(), t.getName()); + } + + private static String describeMember(GHExternalGroup.GHLinkedExternalMember m) { + return String.format("%d:%s:%s:%s", m.getId(), m.getLogin(), m.getName(), m.getEmail()); + } + + static class Matchers { + + static Matcher isExternalGroupSummary() { + return new IsExternalGroupSummary(); + } + + } + + private static class IsExternalGroupSummary extends TypeSafeDiagnosingMatcher { + @Override + protected boolean matchesSafely(GHExternalGroup group, Description mismatchDescription) { + boolean result = true; + if (group == null) { + mismatchDescription.appendText("group is null"); + result = false; + } + if (group.getName() == null) { + mismatchDescription.appendText("name is null"); + result = false; + } + if (group.getUpdatedAt() == null) { + mismatchDescription.appendText("updated at is null"); + result = false; + } + if (group.getTeams() == null) { + mismatchDescription.appendText("teams is null"); + result = false; + } else if (!group.getTeams().isEmpty()) { + mismatchDescription.appendText("has teams"); + result = false; + } + if (group.getMembers() == null) { + mismatchDescription.appendText("members is null"); + result = false; + } else if (!group.getMembers().isEmpty()) { + mismatchDescription.appendText("has members"); + result = false; + } + return result; + } + + @Override + public void describeTo(Description description) { + description.appendText("is a summary"); + } + } +} diff --git a/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java b/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java index 5254b3a707..bee19e8e0c 100755 --- a/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java +++ b/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java @@ -13,6 +13,8 @@ import org.kohsuke.github.GHBranchProtection.RequiredReviews; import org.kohsuke.github.GHBranchProtection.RequiredStatusChecks; +import java.util.ArrayList; + import static org.hamcrest.Matchers.*; // TODO: Auto-generated Javadoc @@ -189,6 +191,31 @@ public void testSignedCommits() throws Exception { assertThat(protection.getRequiredSignatures(), is(false)); } + /** + * Checks with app ids are being populated + * + * @throws Exception + * the exception + */ + @Test + public void testChecksWithAppIds() throws Exception { + GHBranchProtection protection = branch.enableProtection() + .addRequiredChecks(new GHBranchProtection.Check("context", -1), + new GHBranchProtection.Check("context2", 123), + new GHBranchProtection.Check("context3", null)) + .enable(); + + ArrayList resultChecks = new ArrayList<>( + protection.getRequiredStatusChecks().getChecks()); + + assertThat(resultChecks.size(), is(3)); + assertThat(resultChecks.get(0).getContext(), is("context")); + assertThat(resultChecks.get(0).getAppId(), nullValue()); + assertThat(resultChecks.get(1).getContext(), is("context2")); + assertThat(resultChecks.get(1).getAppId(), is(123)); + assertThat(resultChecks.get(2).getContext(), is("context3")); + } + /** * Test get protection. * diff --git a/src/test/java/org/kohsuke/github/GHEventPayloadTest.java b/src/test/java/org/kohsuke/github/GHEventPayloadTest.java index c346d368d5..1e1513c2e0 100644 --- a/src/test/java/org/kohsuke/github/GHEventPayloadTest.java +++ b/src/test/java/org/kohsuke/github/GHEventPayloadTest.java @@ -772,6 +772,57 @@ public void repository() throws Exception { assertThat(event.getSender().getLogin(), is("baxterthehacker")); } + /** + * Repository renamed. + * + * @throws Exception + * the exception + */ + @Test + public void repository_renamed() throws Exception { + final GHEventPayload.Repository event = GitHub.offline() + .parseEventPayload(payload.asReader(), GHEventPayload.Repository.class); + assertThat(event.getAction(), is("renamed")); + assertThat(event.getChanges().getRepository().getName().getFrom(), is("react-workshop")); + assertThat(event.getRepository().getName(), is("react-workshop-renamed")); + assertThat(event.getRepository().getOwner().getLogin(), is("EJG-Organization")); + assertThat(event.getOrganization().getLogin(), is("EJG-Organization")); + assertThat(event.getSender().getLogin(), is("eleanorgoh")); + } + + /** + * Repository ownership transferred to an organization. + * + * @throws Exception + * the exception + */ + @Test + public void repository_transferred_to_org() throws Exception { + final GHEventPayload.Repository event = GitHub.offline() + .parseEventPayload(payload.asReader(), GHEventPayload.Repository.class); + assertThat(event.getAction(), is("transferred")); + assertThat(event.getChanges().getOwner().getFrom().getUser().getLogin(), is("eleanorgoh")); + assertThat(event.getChanges().getOwner().getFrom().getUser().getId(), is(66235606L)); + assertThat(event.getChanges().getOwner().getFrom().getUser().getType(), is("User")); + } + + /** + * Repository ownership transferred to a user. + * + * @throws Exception + * the exception + */ + @Test + public void repository_transferred_to_user() throws Exception { + final GHEventPayload.Repository event = GitHub.offline() + .parseEventPayload(payload.asReader(), GHEventPayload.Repository.class); + assertThat(event.getAction(), is("transferred")); + assertThat(event.getChanges().getOwner().getFrom().getOrganization().getLogin(), is("EJG-Organization")); + assertThat(event.getChanges().getOwner().getFrom().getOrganization().getId(), is(168135412L)); + assertThat(event.getRepository().getOwner().getLogin(), is("eleanorgoh")); + assertThat(event.getRepository().getOwner().getType(), is("User")); + } + /** * Status. * diff --git a/src/test/java/org/kohsuke/github/GHExternalGroupTest.java b/src/test/java/org/kohsuke/github/GHExternalGroupTest.java new file mode 100644 index 0000000000..ef7e7ec7d8 --- /dev/null +++ b/src/test/java/org/kohsuke/github/GHExternalGroupTest.java @@ -0,0 +1,69 @@ +package org.kohsuke.github; + +import org.junit.Test; + +import java.io.IOException; +import java.util.List; + +import static org.hamcrest.Matchers.*; +import static org.kohsuke.github.ExternalGroupsTestingSupport.*; +import static org.kohsuke.github.ExternalGroupsTestingSupport.Matchers.*; + +// TODO: Auto-generated Javadoc + +/** + * The Class GHExternalGroupTest. + */ +public class GHExternalGroupTest extends AbstractGitHubWireMockTest { + + /** + * Test refresh bound external group. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testRefreshBoundExternalGroup() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + List groups = org.listExternalGroups().toList(); + final GHExternalGroup sut = findExternalGroup(groups, hasName("acme-developers")); + + assertThat(sut, isExternalGroupSummary()); + + sut.refresh(); + + assertThat(sut.getId(), equalTo(467431L)); + assertThat(sut.getName(), equalTo("acme-developers")); + assertThat(sut.getUpdatedAt(), notNullValue()); + + assertThat(sut.getMembers(), notNullValue()); + assertThat(membersSummary(sut), + hasItems("158311279:john-doe_acme:John Doe:john.doe@acme.corp", + "166731041:jane-doe_acme:Jane Doe:jane.doe@acme.corp")); + + assertThat(sut.getTeams(), notNullValue()); + assertThat(teamSummary(sut), hasItems("9891173:ACME-DEVELOPERS")); + } + + /** + * Test get organization. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testGetOrganization() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + List groups = org.listExternalGroups().toList(); + final GHExternalGroup sut = findExternalGroup(groups, hasName("acme-developers")); + + assertThat(sut, isExternalGroupSummary()); + + final GHOrganization other = sut.getOrganization(); + + assertThat(other, is(org)); + } + +} diff --git a/src/test/java/org/kohsuke/github/GHOrganizationTest.java b/src/test/java/org/kohsuke/github/GHOrganizationTest.java index 5bf71751a3..668c42f886 100644 --- a/src/test/java/org/kohsuke/github/GHOrganizationTest.java +++ b/src/test/java/org/kohsuke/github/GHOrganizationTest.java @@ -1,5 +1,6 @@ package org.kohsuke.github; +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -12,8 +13,11 @@ import static org.hamcrest.Matchers.*; import static org.junit.Assert.assertThrows; +import static org.kohsuke.github.ExternalGroupsTestingSupport.*; +import static org.kohsuke.github.ExternalGroupsTestingSupport.Matchers.*; // TODO: Auto-generated Javadoc + /** * The Class GHOrganizationTest. */ @@ -28,6 +32,16 @@ public class GHOrganizationTest extends AbstractGitHubWireMockTest { /** The Constant TEAM_NAME_CREATE. */ public static final String TEAM_NAME_CREATE = "create-team-test"; + /** + * Enable response templating to allow support validating pagination of external groups + * + * @return the updated WireMock options + */ + @Override + protected WireMockConfiguration getWireMockOptions() { + return super.getWireMockOptions().extensions(templating.newResponseTransformer()); + } + /** * Clean up team. * @@ -242,6 +256,25 @@ public void testInviteUser() throws IOException { // assertTrue(org.hasMember(user)); } + /** + * Test get user membership + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testGetMembership() throws IOException { + GHOrganization org = gitHub.getOrganization("hub4j-test-org"); + + GHMembership membership = org.getMembership("fv316"); + + assertThat(membership, notNullValue()); + assertThat(membership.getRole(), equalTo(GHMembership.Role.ADMIN)); + assertThat(membership.getState(), equalTo(GHMembership.State.ACTIVE)); + assertThat(membership.getUser().getLogin(), equalTo("fv316")); + assertThat(membership.getOrganization().login, equalTo("hub4j-test-org")); + } + /** * Test list members with filter. * @@ -302,6 +335,25 @@ public void testListMembersWithRole() throws IOException { "timja")); } + /** + * Test list security managers. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testListSecurityManagers() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + List securityManagers = org.listSecurityManagers().toList(); + + assertThat(securityManagers, notNullValue()); + // In case more are added in the future + assertThat(securityManagers.size(), greaterThanOrEqualTo(1)); + assertThat(securityManagers.stream().map(GHTeam::getName).collect(Collectors.toList()), + hasItems("security team")); + } + /** * Test list outside collaborators. * @@ -375,7 +427,7 @@ public void testCreateTeamWithRepoAccess() throws IOException { GHRepository repo = org.getRepository(REPO_NAME); // Create team with access to repository. Check access was granted. - GHTeam team = org.createTeam(TEAM_NAME_CREATE, GHOrganization.Permission.PUSH, repo); + GHTeam team = org.createTeam(TEAM_NAME_CREATE, Permission.PUSH, repo); assertThat(team.getRepositories().containsKey(REPO_NAME), is(true)); assertThat(team.getPermission(), equalTo(Permission.PUSH.toString().toLowerCase())); } @@ -424,7 +476,7 @@ public void testCreateTeamWithRepoPerm() throws Exception { // Create team with access to repository. Check access was granted. GHTeam team = org.createTeam(TEAM_NAME_CREATE).create(); - team.add(repo, GHOrganization.Permission.PUSH); + team.add(repo, Permission.PUSH); assertThat( repo.getTeams() @@ -453,7 +505,7 @@ public void testCreateTeamWithRepoRole() throws IOException { // Create team with access to repository. Check access was granted. GHTeam team = org.createTeam(TEAM_NAME_CREATE).create(); - RepositoryRole role = RepositoryRole.from(GHOrganization.Permission.TRIAGE); + RepositoryRole role = RepositoryRole.from(Permission.TRIAGE); team.add(repo, role); // 'getPermission' does not return triage even though the UI shows that value @@ -558,4 +610,150 @@ public void testEnableOrganizationProjects() throws IOException { // Assert assertThat(org.areOrganizationProjectsEnabled(), is(false)); } + + /** + * Test list external groups without pagination. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testListExternalGroupsWithoutPagination() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + List groups = org.listExternalGroups().toList(); + + assertThat(groups, notNullValue()); + // In case more are added in the future + assertThat(groups.size(), greaterThanOrEqualTo(4)); + assertThat(groupSummary(groups), + hasItems("467430:acme-asset-owners", + "467431:acme-developers", + "467432:acme-product-owners", + "467433:acme-technical-leads")); + + groups.forEach(group -> assertThat(group, isExternalGroupSummary())); + + // We are doing one request to get the organization and one to get the external groups + assertThat(mockGitHub.getRequestCount(), greaterThanOrEqualTo(2)); + } + + /** + * Test list external groups with pagination. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testListExternalGroupsWithPagination() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + List groups = org.listExternalGroups().withPageSize(2).toList(); + + assertThat(groups, notNullValue()); + // In case more are added in the future + assertThat(groups.size(), greaterThanOrEqualTo(4)); + assertThat(groupSummary(groups), + hasItems("467430:acme-asset-owners", + "467431:acme-developers", + "467432:acme-product-owners", + "467433:acme-technical-leads")); + + groups.forEach(group -> assertThat(group, isExternalGroupSummary())); + + // We are doing one request to get the organization and two to traverse the two pages + assertThat(mockGitHub.getRequestCount(), greaterThanOrEqualTo(3)); + } + + /** + * Test list external groups with name filtering. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testListExternalGroupsWithFilter() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + List groups = org.listExternalGroups("acme").toList(); + + assertThat(groups, notNullValue()); + // In case more are added in the future + assertThat(groups.size(), greaterThanOrEqualTo(4)); + assertThat(groupSummary(groups), + hasItems("467430:acme-asset-owners", + "467431:acme-developers", + "467432:acme-product-owners", + "467433:acme-technical-leads")); + + groups.forEach(group -> assertThat(group, isExternalGroupSummary())); + } + + /** + * Test list external groups without pagination for non enterprise managed organization. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testListExternalGroupsNotEnterpriseManagedOrganization() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + final GHNotExternallyManagedEnterpriseException failure = assertThrows( + GHNotExternallyManagedEnterpriseException.class, + () -> org.listExternalGroups().toList()); + + assertThat(failure.getMessage(), equalTo("Could not retrieve organization external groups")); + + final GHError error = failure.getError(); + + assertThat(error, notNullValue()); + assertThat(error.getMessage(), + equalTo(EnterpriseManagedSupport.NOT_PART_OF_EXTERNALLY_MANAGED_ENTERPRISE_ERROR)); + assertThat(error.getDocumentationUrl(), notNullValue()); + } + + /** + * Test get external group + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testGetExternalGroup() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + GHExternalGroup group = org.getExternalGroup(467431L); + + assertThat(group, not(isExternalGroupSummary())); + + assertThat(group.getId(), equalTo(467431L)); + assertThat(group.getName(), equalTo("acme-developers")); + assertThat(group.getUpdatedAt(), notNullValue()); + + assertThat(group.getMembers(), notNullValue()); + assertThat(membersSummary(group), + hasItems("158311279:john-doe_acme:John Doe:john.doe@acme.corp", + "166731041:jane-doe_acme:Jane Doe:jane.doe@acme.corp")); + + assertThat(group.getTeams(), notNullValue()); + assertThat(teamSummary(group), hasItems("9891173:ACME-DEVELOPERS")); + } + + /** + * Test get external group for not enterprise managed organization + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testGetExternalGroupNotEnterpriseManagedOrganization() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + final GHIOException failure = assertThrows(GHNotExternallyManagedEnterpriseException.class, + () -> org.getExternalGroup(12345)); + + assertThat(failure.getMessage(), equalTo("Could not retrieve organization external group")); + } + } diff --git a/src/test/java/org/kohsuke/github/GHTeamTest.java b/src/test/java/org/kohsuke/github/GHTeamTest.java index b1db8ddf0f..8deba28c2b 100644 --- a/src/test/java/org/kohsuke/github/GHTeamTest.java +++ b/src/test/java/org/kohsuke/github/GHTeamTest.java @@ -8,12 +8,13 @@ import java.util.List; import java.util.Set; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.empty; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.hasProperty; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; +import static com.github.tomakehurst.wiremock.client.WireMock.deleteRequestedFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.hasItems; +import static org.junit.Assert.assertThrows; +import static org.kohsuke.github.ExternalGroupsTestingSupport.*; +import static org.kohsuke.github.ExternalGroupsTestingSupport.Matchers.isExternalGroupSummary; // TODO: Auto-generated Javadoc /** @@ -263,4 +264,174 @@ public void addRemoveMember() throws IOException { } } } + + /** + * Test get external groups. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testGetExternalGroups() throws IOException { + String teamSlug = "acme-developers"; + + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + GHTeam team = org.getTeamBySlug(teamSlug); + final List groups = team.getExternalGroups(); + + assertThat(groups, notNullValue()); + assertThat(groups.size(), equalTo(1)); + assertThat(groupSummary(groups), hasItems("467431:acme-developers")); + + groups.forEach(group -> assertThat(group, isExternalGroupSummary())); + } + + /** + * Test get external groups from not enterprise managed organization. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testGetExternalGroupsNotEnterpriseManagedOrganization() throws IOException { + String teamSlug = "acme-developers"; + + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + GHTeam team = org.getTeamBySlug(teamSlug); + + final GHIOException failure = assertThrows(GHNotExternallyManagedEnterpriseException.class, + () -> team.getExternalGroups()); + assertThat(failure.getMessage(), equalTo("Could not retrieve team external groups")); + } + + /** + * Test get external groups from team that cannot be externally managed. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testGetExternalGroupsTeamCannotBeExternallyManaged() throws IOException { + String teamSlug = "acme-developers"; + + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + GHTeam team = org.getTeamBySlug(teamSlug); + + final GHIOException failure = assertThrows(GHTeamCannotBeExternallyManagedException.class, + () -> team.getExternalGroups()); + assertThat(failure.getMessage(), equalTo("Could not retrieve team external groups")); + } + + /** + * Test connect to external group by id. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testConnectToExternalGroupById() throws IOException { + String teamSlug = "acme-developers"; + + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + GHTeam team = org.getTeamBySlug(teamSlug); + + final GHExternalGroup group = team.connectToExternalGroup(467431); + + assertThat(group.getId(), equalTo(467431L)); + assertThat(group.getName(), equalTo("acme-developers")); + assertThat(group.getUpdatedAt(), notNullValue()); + + assertThat(group.getMembers(), notNullValue()); + assertThat(membersSummary(group), + hasItems("158311279:john-doe_acme:John Doe:john.doe@acme.corp", + "166731041:jane-doe_acme:Jane Doe:jane.doe@acme.corp")); + + assertThat(group.getTeams(), notNullValue()); + assertThat(teamSummary(group), hasItems("34519919:ACME-DEVELOPERS")); + } + + /** + * Test fail to connect to external group from other organization. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testConnectToExternalGroupByGroup() throws IOException { + String teamSlug = "acme-developers"; + + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + GHTeam team = org.getTeamBySlug(teamSlug); + GHExternalGroup group = org.getExternalGroup(467431); + + GHExternalGroup connectedGroup = team.connectToExternalGroup(group); + + assertThat(connectedGroup.getId(), equalTo(467431L)); + assertThat(connectedGroup.getName(), equalTo("acme-developers")); + assertThat(connectedGroup.getUpdatedAt(), notNullValue()); + + assertThat(connectedGroup.getMembers(), notNullValue()); + assertThat(membersSummary(connectedGroup), + hasItems("158311279:john-doe_acme:John Doe:john.doe@acme.corp", + "166731041:jane-doe_acme:Jane Doe:jane.doe@acme.corp")); + + assertThat(group.getTeams(), notNullValue()); + assertThat(teamSummary(connectedGroup), hasItems("34519919:ACME-DEVELOPERS")); + } + + /** + * Test failure when connecting to external group by id. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testFailConnectToExternalGroupWhenTeamHasMembers() throws IOException { + String teamSlug = "acme-developers"; + + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + GHTeam team = org.getTeamBySlug(teamSlug); + + final GHIOException failure = assertThrows(GHTeamCannotBeExternallyManagedException.class, + () -> team.connectToExternalGroup(467431)); + assertThat(failure.getMessage(), equalTo("Could not connect team to external group")); + } + + /** + * Test failure when connecting to external group by id. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testFailConnectToExternalGroupTeamIsNotAvailableInOrg() throws IOException { + String teamSlug = "acme-developers"; + + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + GHTeam team = org.getTeamBySlug(teamSlug); + + assertThrows(GHFileNotFoundException.class, () -> team.connectToExternalGroup(12345)); + } + + /** + * Test delete connection to external group + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testDeleteExternalGroupConnection() throws IOException { + String teamSlug = "acme-developers"; + + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + GHTeam team = org.getTeamBySlug(teamSlug); + + team.deleteExternalGroupConnection(); + + mockGitHub.apiServer() + .verify(1, + deleteRequestedFor(urlPathEqualTo("/orgs/" + team.getOrganization().getLogin() + "/teams/" + + team.getSlug() + "/external-groups"))); + } + } diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait_Secondary_Limits/__files/1-user.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait_Secondary_Limits/__files/1-user.json new file mode 100644 index 0000000000..467313f149 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait_Secondary_Limits/__files/1-user.json @@ -0,0 +1,45 @@ +{ + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": "https://twitter.com/bitwiseman", + "public_repos": 181, + "public_gists": 7, + "followers": 146, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2020-02-06T17:29:39Z", + "private_gists": 8, + "total_private_repos": 10, + "owned_private_repos": 0, + "disk_usage": 33697, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait_Secondary_Limits/__files/3-r_h_t_fail.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait_Secondary_Limits/__files/3-r_h_t_fail.json new file mode 100644 index 0000000000..f34a712687 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait_Secondary_Limits/__files/3-r_h_t_fail.json @@ -0,0 +1,126 @@ +{ + "id": 238757196, + "node_id": "MDEwOlJlcG9zaXRvcnkyMzg3NTcxOTY=", + "name": "temp-testHandler_Wait_Secondary_Limits", + "full_name": "hub4j-test-org/temp-testHandler_Wait_Secondary_Limits", + "private": false, + "owner": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits", + "description": "A test repository for testing the github-api project: temp-testHandler_Wait_Secondary_Limits", + "fork": false, + "url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits", + "forks_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits/deployments", + "created_at": "2020-02-06T18:33:39Z", + "updated_at": "2020-02-06T18:33:43Z", + "pushed_at": "2020-02-06T18:33:41Z", + "git_url": "git://github.com/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits.git", + "ssh_url": "git@github.com:hub4j-test-org/temp-testHandler_Wait_Secondary_Limits.git", + "clone_url": "https://github.com/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits.git", + "svn_url": "https://github.com/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits", + "homepage": "http://github-api.kohsuke.org/", + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "temp_clone_token": "", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "delete_branch_on_merge": false, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "network_count": 0, + "subscribers_count": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait_Secondary_Limits/mappings/1-user.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait_Secondary_Limits/mappings/1-user.json new file mode 100644 index 0000000000..5dc5b48064 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait_Secondary_Limits/mappings/1-user.json @@ -0,0 +1,48 @@ +{ + "id": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4930", + "X-RateLimit-Reset": "{{now offset='3 seconds' format='unix'}}", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"1cb30f031c67c499473b3aad01c7f7a5\"", + "Last-Modified": "Thu, 06 Feb 2020 17:29:39 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CC37:2605:3F884:4E941:5E3C5BFC" + } + }, + "uuid": "a60baf84-5b5c-4f86-af3d-cab0d609c7b2", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait_Secondary_Limits/mappings/2-r_h_t_fail.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait_Secondary_Limits/mappings/2-r_h_t_fail.json new file mode 100644 index 0000000000..98995b9730 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait_Secondary_Limits/mappings/2-r_h_t_fail.json @@ -0,0 +1,52 @@ +{ + "id": "79fb1092-8bf3-4274-bc8e-ca126c9d9261", + "name": "repos_hub4j-test-org_temp-testHandler_Wait_Secondary_Limits", + "request": { + "url": "/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 403, + "body": "{\"message\":\"You have exceeded a secondary rate limit. Please wait a few minutes before you try again\"}", + "headers": { + "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "403 Forbidden", + "gh-limited-by": "search-elapsed-time-shared-grouped", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4000", + "X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"7ff3c96399f7ddf6129622d675ca9935\"", + "Last-Modified": "Thu, 06 Feb 2020 18:33:37 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, gh-limited-by, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CC37:2605:3F982:4E949:5E3C5BFC" + } + }, + "uuid": "79fb1092-8bf3-4274-bc8e-ca126c9d9261", + "persistent": true, + "scenarioName": "scenario-1-repos-hub4j-test-org-temp-testHandler_Wait_Secondary_Limits", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-1-repos-hub4j-test-org-temp-testHandler_Wait_Secondary_Limits-2", + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait_Secondary_Limits/mappings/3-r_h_t_fail.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait_Secondary_Limits/mappings/3-r_h_t_fail.json new file mode 100644 index 0000000000..707123b2a8 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait_Secondary_Limits/mappings/3-r_h_t_fail.json @@ -0,0 +1,50 @@ +{ + "id": "574da117-6845-46d8-b2c1-4415546ca670", + "name": "repos_hub4j-test-org_temp-testHandler_Wait_Secondary_Limits", + "request": { + "url": "/repos/hub4j-test-org/temp-testHandler_Wait_Secondary_Limits", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-r_h_t_fail.json", + "headers": { + "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4922", + "X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"858224998ac7d1fd6dcd43f73d375297\"", + "Last-Modified": "Thu, 06 Feb 2020 18:33:43 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, gh-limited-by, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "CC37:2605:3FADC:4EA8C:5E3C5C02" + } + }, + "uuid": "574da117-6845-46d8-b2c1-4415546ca670", + "persistent": true, + "scenarioName": "scenario-1-repos-hub4j-test-org-temp-testHandler_Wait_Secondary_Limits", + "requiredScenarioState": "scenario-1-repos-hub4j-test-org-temp-testHandler_Wait_Secondary_Limits-2", + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testHandleEmbeddedNotPartOfExternallyManagedEnterpriseHttpException/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testHandleEmbeddedNotPartOfExternallyManagedEnterpriseHttpException/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testHandleEmbeddedNotPartOfExternallyManagedEnterpriseHttpException/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "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://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 11, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 12, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testHandleEmbeddedNotPartOfExternallyManagedEnterpriseHttpException/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testHandleEmbeddedNotPartOfExternallyManagedEnterpriseHttpException/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..88d93869d4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testHandleEmbeddedNotPartOfExternallyManagedEnterpriseHttpException/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF7E:786110:5E5531FF" + } + }, + "uuid": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testHandleTeamCannotBeExternallyManagedHttpException/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testHandleTeamCannotBeExternallyManagedHttpException/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testHandleTeamCannotBeExternallyManagedHttpException/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "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://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 11, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 12, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testHandleTeamCannotBeExternallyManagedHttpException/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testHandleTeamCannotBeExternallyManagedHttpException/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..88d93869d4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testHandleTeamCannotBeExternallyManagedHttpException/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF7E:786110:5E5531FF" + } + }, + "uuid": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreBadRequestsWithUnknownErrorMessage/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreBadRequestsWithUnknownErrorMessage/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreBadRequestsWithUnknownErrorMessage/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "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://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 11, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 12, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreBadRequestsWithUnknownErrorMessage/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreBadRequestsWithUnknownErrorMessage/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..88d93869d4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreBadRequestsWithUnknownErrorMessage/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF7E:786110:5E5531FF" + } + }, + "uuid": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreBadRequestsWithUnparseableJson/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreBadRequestsWithUnparseableJson/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreBadRequestsWithUnparseableJson/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "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://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 11, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 12, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreBadRequestsWithUnparseableJson/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreBadRequestsWithUnparseableJson/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..88d93869d4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreBadRequestsWithUnparseableJson/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF7E:786110:5E5531FF" + } + }, + "uuid": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreNonBadRequestExceptions/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreNonBadRequestExceptions/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreNonBadRequestExceptions/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "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://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 11, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 12, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreNonBadRequestExceptions/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreNonBadRequestExceptions/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..88d93869d4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreNonBadRequestExceptions/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF7E:786110:5E5531FF" + } + }, + "uuid": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreNonHttpException/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreNonHttpException/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreNonHttpException/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "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://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 11, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 12, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreNonHttpException/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreNonHttpException/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..88d93869d4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/EnterpriseManagedSupportTest/wiremock/testIgnoreNonHttpException/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF7E:786110:5E5531FF" + } + }, + "uuid": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/1-user.json new file mode 100644 index 0000000000..fa8689bad8 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/1-user.json @@ -0,0 +1,34 @@ +{ + "login": "tginiotis-at-work", + "id": 61763026, + "node_id": "MDQ6VXNlcjYxNzYzMDI2", + "avatar_url": "https://avatars.githubusercontent.com/u/61763026?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/tginiotis-at-work", + "html_url": "https://github.com/tginiotis-at-work", + "followers_url": "https://api.github.com/users/tginiotis-at-work/followers", + "following_url": "https://api.github.com/users/tginiotis-at-work/following{/other_user}", + "gists_url": "https://api.github.com/users/tginiotis-at-work/gists{/gist_id}", + "starred_url": "https://api.github.com/users/tginiotis-at-work/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/tginiotis-at-work/subscriptions", + "organizations_url": "https://api.github.com/users/tginiotis-at-work/orgs", + "repos_url": "https://api.github.com/users/tginiotis-at-work/repos", + "events_url": "https://api.github.com/users/tginiotis-at-work/events{/privacy}", + "received_events_url": "https://api.github.com/users/tginiotis-at-work/received_events", + "type": "User", + "site_admin": false, + "name": "Tadas Giniotis", + "company": "IBM Lietuva", + "blog": "", + "location": null, + "email": null, + "hireable": null, + "bio": null, + "twitter_username": null, + "public_repos": 12, + "public_gists": 0, + "followers": 0, + "following": 0, + "created_at": "2020-03-03T23:04:00Z", + "updated_at": "2024-05-15T15:03:51Z" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/2-r_h_temp-testcheckswithappids.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/2-r_h_temp-testcheckswithappids.json new file mode 100644 index 0000000000..4f8ad7ebdc --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/2-r_h_temp-testcheckswithappids.json @@ -0,0 +1,156 @@ +{ + "id": 802086844, + "node_id": "R_kgDOL87fvA", + "name": "temp-testChecksWithAppIds", + "full_name": "hub4j-test-org/temp-testChecksWithAppIds", + "private": false, + "owner": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j-test-org/temp-testChecksWithAppIds", + "description": "A test repository for testing the github-api project: temp-testChecksWithAppIds", + "fork": false, + "url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds", + "forks_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/deployments", + "created_at": "2024-05-17T13:51:56Z", + "updated_at": "2024-05-17T13:52:00Z", + "pushed_at": "2024-05-17T13:51:57Z", + "git_url": "git://github.com/hub4j-test-org/temp-testChecksWithAppIds.git", + "ssh_url": "git@github.com:hub4j-test-org/temp-testChecksWithAppIds.git", + "clone_url": "https://github.com/hub4j-test-org/temp-testChecksWithAppIds.git", + "svn_url": "https://github.com/hub4j-test-org/temp-testChecksWithAppIds", + "homepage": "http://github-api.kohsuke.org/", + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "main", + "permissions": { + "admin": true, + "maintain": true, + "push": true, + "triage": true, + "pull": true + }, + "temp_clone_token": "", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "custom_properties": {}, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "security_and_analysis": { + "secret_scanning": { + "status": "disabled" + }, + "secret_scanning_push_protection": { + "status": "disabled" + }, + "dependabot_security_updates": { + "status": "disabled" + }, + "secret_scanning_validity_checks": { + "status": "disabled" + } + }, + "network_count": 0, + "subscribers_count": 22 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/3-r_h_t_branches_main.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/3-r_h_t_branches_main.json new file mode 100644 index 0000000000..b51cb35137 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/3-r_h_t_branches_main.json @@ -0,0 +1,90 @@ +{ + "name": "main", + "commit": { + "sha": "301c76278622d97be24c9e6bf37306eb91984505", + "node_id": "C_kwDOL87fvNoAKDMwMWM3NjI3ODYyMmQ5N2JlMjRjOWU2YmYzNzMwNmViOTE5ODQ1MDU", + "commit": { + "author": { + "name": "Tadas Giniotis", + "email": "61763026+tginiotis-at-work@users.noreply.github.com", + "date": "2024-05-17T13:51:57Z" + }, + "committer": { + "name": "GitHub", + "email": "noreply@github.com", + "date": "2024-05-17T13:51:57Z" + }, + "message": "Initial commit", + "tree": { + "sha": "c53290e965014088d71812a1a0ef5453d5671047", + "url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/git/trees/c53290e965014088d71812a1a0ef5453d5671047" + }, + "url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/git/commits/301c76278622d97be24c9e6bf37306eb91984505", + "comment_count": 0, + "verification": { + "verified": true, + "reason": "valid", + "signature": "-----BEGIN PGP SIGNATURE-----\n\nwsFcBAABCAAQBQJmR2D9CRC1aQ7uu5UhlAAAiboQADXa0dYfU4xR7N7c1cq5KsqP\nK8v1iaP1CxfbZSqZQSt3TNA+Jtc9TJ505M+6b8Ex3RpNBmQX4YG+kGvs0sa4vdMD\nHxbR8HOW6J+ht8BaV829iu4eVwI4N+hABhSTHJv6EhZg2wgPqX72zQV9k4QZw/uL\nSONyFJgFmX+kU/YVr+ax0yLnjQLfBIAR4Q4/f7afG1p5e3a8oOxucnptQBEW86wK\n0aNN1VWhP0IA8+D7ftgubClHu+/RFH3DRXdjPU5cvphLvNUM5Ime9Xktm5cFkv32\nOtjet8GUesT/cJiAkSEMU9C5nCIaJXgjchnp/yA2l6Z31tXaEik/UhqizE3EQMeP\nVPZMhCIeh69JGOerpflqP0/os3THF57x054RaFN6KxG7I158ClsfmyGp5WzkLFJ4\nkqiPrFltZm2k9MvUQ2r8Ewd3/OkDt/bAV8B34qAa/xhJUF4D5iq15gKsHNZsCBw5\nddz0dOO2YWmF0eMGv+iV25qu/xwdRrPbrPDb7NHcbZdAoBlNJm/07YAVkG3x3qBn\nPelfba5XjD6RPke5jRejhukV8PGFNfKQ3m7zYflqay2H6e2a0RCdtuSzLiIhkgP8\nvXxd4+xRvMC6aLDd1f0Z60G72ATCFsZ2H60yRcS6uMcufdbAt9h5B0UcKw6xT4Zi\nKILbAvfbDMtXdTVfeeWM\n=p3Ka\n-----END PGP SIGNATURE-----\n", + "payload": "tree c53290e965014088d71812a1a0ef5453d5671047\nauthor Tadas Giniotis <61763026+tginiotis-at-work@users.noreply.github.com> 1715953917 +0300\ncommitter GitHub 1715953917 +0300\n\nInitial commit" + } + }, + "url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/commits/301c76278622d97be24c9e6bf37306eb91984505", + "html_url": "https://github.com/hub4j-test-org/temp-testChecksWithAppIds/commit/301c76278622d97be24c9e6bf37306eb91984505", + "comments_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/commits/301c76278622d97be24c9e6bf37306eb91984505/comments", + "author": { + "login": "tginiotis-at-work", + "id": 61763026, + "node_id": "MDQ6VXNlcjYxNzYzMDI2", + "avatar_url": "https://avatars.githubusercontent.com/u/61763026?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/tginiotis-at-work", + "html_url": "https://github.com/tginiotis-at-work", + "followers_url": "https://api.github.com/users/tginiotis-at-work/followers", + "following_url": "https://api.github.com/users/tginiotis-at-work/following{/other_user}", + "gists_url": "https://api.github.com/users/tginiotis-at-work/gists{/gist_id}", + "starred_url": "https://api.github.com/users/tginiotis-at-work/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/tginiotis-at-work/subscriptions", + "organizations_url": "https://api.github.com/users/tginiotis-at-work/orgs", + "repos_url": "https://api.github.com/users/tginiotis-at-work/repos", + "events_url": "https://api.github.com/users/tginiotis-at-work/events{/privacy}", + "received_events_url": "https://api.github.com/users/tginiotis-at-work/received_events", + "type": "User", + "site_admin": false + }, + "committer": { + "login": "web-flow", + "id": 19864447, + "node_id": "MDQ6VXNlcjE5ODY0NDQ3", + "avatar_url": "https://avatars.githubusercontent.com/u/19864447?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/web-flow", + "html_url": "https://github.com/web-flow", + "followers_url": "https://api.github.com/users/web-flow/followers", + "following_url": "https://api.github.com/users/web-flow/following{/other_user}", + "gists_url": "https://api.github.com/users/web-flow/gists{/gist_id}", + "starred_url": "https://api.github.com/users/web-flow/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/web-flow/subscriptions", + "organizations_url": "https://api.github.com/users/web-flow/orgs", + "repos_url": "https://api.github.com/users/web-flow/repos", + "events_url": "https://api.github.com/users/web-flow/events{/privacy}", + "received_events_url": "https://api.github.com/users/web-flow/received_events", + "type": "User", + "site_admin": false + }, + "parents": [] + }, + "_links": { + "self": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main", + "html": "https://github.com/hub4j-test-org/temp-testChecksWithAppIds/tree/main" + }, + "protected": false, + "protection": { + "enabled": false, + "required_status_checks": { + "enforcement_level": "off", + "contexts": [], + "checks": [] + } + }, + "protection_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/4-r_h_t_branches_main_protection.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/4-r_h_t_branches_main_protection.json new file mode 100644 index 0000000000..ded18db0fd --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/4-r_h_t_branches_main_protection.json @@ -0,0 +1,46 @@ +{ + "url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection", + "required_status_checks": { + "url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection/required_status_checks", + "strict": false, + "contexts": [ + "context" + ], + "contexts_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection/required_status_checks/contexts", + "checks": [ + { + "context": "context", + "app_id": null + } + ] + }, + "required_signatures": { + "url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection/required_signatures", + "enabled": false + }, + "enforce_admins": { + "url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection/enforce_admins", + "enabled": false + }, + "required_linear_history": { + "enabled": false + }, + "allow_force_pushes": { + "enabled": false + }, + "allow_deletions": { + "enabled": false + }, + "block_creations": { + "enabled": false + }, + "required_conversation_resolution": { + "enabled": false + }, + "lock_branch": { + "enabled": false + }, + "allow_fork_syncing": { + "enabled": false + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/5-r_h_t_branches_main_protection.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/5-r_h_t_branches_main_protection.json new file mode 100644 index 0000000000..47cafad876 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/5-r_h_t_branches_main_protection.json @@ -0,0 +1,51 @@ +{ + "url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection", + "required_status_checks": { + "url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection/required_status_checks", + "strict": false, + "contexts": [ + "context", + "context2" + ], + "contexts_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection/required_status_checks/contexts", + "checks": [ + { + "context": "context", + "app_id": null + }, + { + "context": "context2", + "app_id": 123 + } + ] + }, + "required_signatures": { + "url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection/required_signatures", + "enabled": false + }, + "enforce_admins": { + "url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection/enforce_admins", + "enabled": false + }, + "required_linear_history": { + "enabled": false + }, + "allow_force_pushes": { + "enabled": false + }, + "allow_deletions": { + "enabled": false + }, + "block_creations": { + "enabled": false + }, + "required_conversation_resolution": { + "enabled": false + }, + "lock_branch": { + "enabled": false + }, + "allow_fork_syncing": { + "enabled": false + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/6-r_h_t_branches_main_protection.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/6-r_h_t_branches_main_protection.json new file mode 100644 index 0000000000..264fb82da6 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/__files/6-r_h_t_branches_main_protection.json @@ -0,0 +1,56 @@ +{ + "url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection", + "required_status_checks": { + "url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection/required_status_checks", + "strict": false, + "contexts": [ + "context", + "context2", + "context3" + ], + "contexts_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection/required_status_checks/contexts", + "checks": [ + { + "context": "context", + "app_id": null + }, + { + "context": "context2", + "app_id": 123 + }, + { + "context": "context3", + "app_id": null + } + ] + }, + "required_signatures": { + "url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection/required_signatures", + "enabled": false + }, + "enforce_admins": { + "url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection/enforce_admins", + "enabled": false + }, + "required_linear_history": { + "enabled": false + }, + "allow_force_pushes": { + "enabled": false + }, + "allow_deletions": { + "enabled": false + }, + "block_creations": { + "enabled": false + }, + "required_conversation_resolution": { + "enabled": false + }, + "lock_branch": { + "enabled": false + }, + "allow_fork_syncing": { + "enabled": false + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/1-user.json new file mode 100644 index 0000000000..87b2ae222d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/1-user.json @@ -0,0 +1,51 @@ +{ + "id": "16ba959e-4ca0-4045-96d7-b674c75257cc", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 17 May 2024 13:42:18 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/\"ed6f9c0f0f69bfb3fe7121d8e7818b048619df4a2345915b7caadb8ca02e8531\"", + "Last-Modified": "Wed, 15 May 2024 15:03:51 GMT", + "X-OAuth-Scopes": "admin:org, repo", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2024-06-16 12:56:36 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4896", + "X-RateLimit-Reset": "1715954309", + "X-RateLimit-Used": "104", + "X-RateLimit-Resource": "core", + "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", + "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'", + "X-GitHub-Request-Id": "B8F4:2F7818:126699EC:128021C0:66475EBA" + } + }, + "uuid": "16ba959e-4ca0-4045-96d7-b674c75257cc", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/2-r_h_temp-testcheckswithappids.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/2-r_h_temp-testcheckswithappids.json new file mode 100644 index 0000000000..f126b906b0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/2-r_h_temp-testcheckswithappids.json @@ -0,0 +1,51 @@ +{ + "id": "f6e4620b-0ff9-4a0a-b356-fe1235bf6775", + "name": "repos_hub4j-test-org_temp-testcheckswithappids", + "request": { + "url": "/repos/hub4j-test-org/temp-testChecksWithAppIds", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-r_h_temp-testcheckswithappids.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 17 May 2024 13:52:00 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/\"41998d4abee4f59befaff51b16f2fe7a5437119b7f5ba4eef222ee7455281ed1\"", + "Last-Modified": "Fri, 17 May 2024 13:52:00 GMT", + "X-OAuth-Scopes": "admin:org, repo", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2024-06-16 12:56:36 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4868", + "X-RateLimit-Reset": "1715954309", + "X-RateLimit-Used": "132", + "X-RateLimit-Resource": "core", + "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", + "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'", + "X-GitHub-Request-Id": "8A9E:0EA0:12FE6324:1317F7B9:66476100" + } + }, + "uuid": "f6e4620b-0ff9-4a0a-b356-fe1235bf6775", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/3-r_h_t_branches_main.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/3-r_h_t_branches_main.json new file mode 100644 index 0000000000..4a9e5aca28 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/3-r_h_t_branches_main.json @@ -0,0 +1,50 @@ +{ + "id": "63418037-ee6f-474c-8421-8828326c5fe5", + "name": "repos_hub4j-test-org_temp-testcheckswithappids_branches_main", + "request": { + "url": "/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-r_h_t_branches_main.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 17 May 2024 13:52:01 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/\"ba95d66b4b3df8cd1dc17e866dc5d33585db49b9ed203b4a1aa18d8a8f2335d3\"", + "X-OAuth-Scopes": "admin:org, repo", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2024-06-16 12:56:36 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4867", + "X-RateLimit-Reset": "1715954309", + "X-RateLimit-Used": "133", + "X-RateLimit-Resource": "core", + "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", + "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'", + "X-GitHub-Request-Id": "8AAA:92EDF:130BCF1D:132597F0:66476101" + } + }, + "uuid": "63418037-ee6f-474c-8421-8828326c5fe5", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/4-r_h_t_branches_main_protection.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/4-r_h_t_branches_main_protection.json new file mode 100644 index 0000000000..593e01fa10 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/4-r_h_t_branches_main_protection.json @@ -0,0 +1,57 @@ +{ + "id": "963b8abe-5ece-4aaa-aeaa-18351841d6c2", + "name": "repos_hub4j-test-org_temp-testcheckswithappids_branches_main_protection", + "request": { + "url": "/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection", + "method": "PUT", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.luke-cage-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"required_pull_request_reviews\":null,\"required_status_checks\":{\"strict\":false,\"checks\":[{\"context\":\"context\",\"app_id\":-1}]},\"restrictions\":null,\"enforce_admins\":false}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "4-r_h_t_branches_main_protection.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 17 May 2024 13:52:01 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/\"05863b1a6c94ea9ceb3ef880c0b211bcdb5fb42c1aca535ec48bdadacd6a542b\"", + "X-OAuth-Scopes": "admin:org, repo", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2024-06-16 12:56:36 UTC", + "X-GitHub-Media-Type": "github.v3; param=luke-cage-preview; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4866", + "X-RateLimit-Reset": "1715954309", + "X-RateLimit-Used": "134", + "X-RateLimit-Resource": "core", + "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", + "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'", + "X-GitHub-Request-Id": "8AAC:0F85:813058E:81FDA8B:66476101" + } + }, + "uuid": "963b8abe-5ece-4aaa-aeaa-18351841d6c2", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/5-r_h_t_branches_main_protection.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/5-r_h_t_branches_main_protection.json new file mode 100644 index 0000000000..c97634d170 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/5-r_h_t_branches_main_protection.json @@ -0,0 +1,57 @@ +{ + "id": "630402b5-486c-41df-83e7-f9f1a715ea08", + "name": "repos_hub4j-test-org_temp-testcheckswithappids_branches_main_protection", + "request": { + "url": "/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection", + "method": "PUT", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.luke-cage-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"required_pull_request_reviews\":null,\"required_status_checks\":{\"strict\":false,\"checks\":[{\"context\":\"context\",\"app_id\":-1},{\"context\":\"context2\",\"app_id\":123}]},\"restrictions\":null,\"enforce_admins\":false}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "5-r_h_t_branches_main_protection.json", + "headers": { + "Server": "GitHub.com", + "Date": "Thu, 06 Jun 2024 08:33:48 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/\"eae3686ecc99456a89d4b1209c91dc3fefb1139da4cf8a9afbbd5c46ca4bb44c\"", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, copilot, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2024-06-16 12:56:36 UTC", + "X-GitHub-Media-Type": "github.v3; param=luke-cage-preview; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4995", + "X-RateLimit-Reset": "1717666423", + "X-RateLimit-Used": "5", + "X-RateLimit-Resource": "core", + "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", + "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'", + "X-GitHub-Request-Id": "B950:2575A0:9D3C7A6:9E339B3:6661746C" + } + }, + "uuid": "630402b5-486c-41df-83e7-f9f1a715ea08", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/6-r_h_t_branches_main_protection.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/6-r_h_t_branches_main_protection.json new file mode 100644 index 0000000000..c020cf1cae --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testChecksWithAppIds/mappings/6-r_h_t_branches_main_protection.json @@ -0,0 +1,57 @@ +{ + "id": "9f6f5be6-b5c5-4840-865c-ba84ad262118", + "name": "repos_hub4j-test-org_temp-testcheckswithappids_branches_main_protection", + "request": { + "url": "/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection", + "method": "PUT", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.luke-cage-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"required_pull_request_reviews\":null,\"required_status_checks\":{\"checks\":[{\"context\":\"context\",\"app_id\":-1},{\"context\":\"context2\",\"app_id\":123},{\"context\":\"context3\"}],\"strict\":false},\"restrictions\":null,\"enforce_admins\":false}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "6-r_h_t_branches_main_protection.json", + "headers": { + "Server": "GitHub.com", + "Date": "Thu, 13 Jun 2024 14:46:41 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/\"59d4b1a76c2903c6f8950aecee97ded98e0a0704a6ec06aebd22434d63b3a19c\"", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, copilot, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2024-06-16 12:56:36 UTC", + "X-GitHub-Media-Type": "github.v3; param=luke-cage-preview; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4966", + "X-RateLimit-Reset": "1718293429", + "X-RateLimit-Used": "34", + "X-RateLimit-Resource": "core", + "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", + "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'", + "X-GitHub-Request-Id": "C8E4:2DA98F:90511D4:9134847:666B0651" + } + }, + "uuid": "9f6f5be6-b5c5-4840-865c-ba84ad262118", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/2-r_h_temp-testenablebranchprotections.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/2-r_h_temp-tes.json similarity index 100% rename from src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/2-r_h_temp-testenablebranchprotections.json rename to src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/2-r_h_temp-tes.json diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/4-r_h_t_branches_main_protection.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/4-r_h_t_branches_main_protection.json index a793b4cefa..65e419eb00 100644 --- a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/4-r_h_t_branches_main_protection.json +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/4-r_h_t_branches_main_protection.json @@ -40,4 +40,4 @@ "required_linear_history": { "enabled": true } -} +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/5-r_h_t_branches_main_protection.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/5-r_h_t_branches_main_protection.json index a793b4cefa..65e419eb00 100644 --- a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/5-r_h_t_branches_main_protection.json +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/5-r_h_t_branches_main_protection.json @@ -40,4 +40,4 @@ "required_linear_history": { "enabled": true } -} +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/6-r_h_t_branches_main_protection.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/6-r_h_t_branches_main_protection.json new file mode 100644 index 0000000000..34ceb65785 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/__files/6-r_h_t_branches_main_protection.json @@ -0,0 +1,53 @@ +{ + "url": "https://api.github.com/repos/hub4j-test-org/temp-testEnableBranchProtections/branches/main/protection", + "required_status_checks": { + "url": "https://api.github.com/repos/hub4j-test-org/temp-testEnableBranchProtections/branches/main/protection/required_status_checks", + "strict": true, + "contexts": [ + "test-status-check" + ], + "contexts_url": "https://api.github.com/repos/hub4j-test-org/temp-testEnableBranchProtections/branches/main/protection/required_status_checks/contexts", + "checks": [ + { + "context": "test-status-check", + "app_id": null + } + ] + }, + "required_pull_request_reviews": { + "url": "https://api.github.com/repos/hub4j-test-org/temp-testEnableBranchProtections/branches/main/protection/required_pull_request_reviews", + "dismiss_stale_reviews": true, + "require_code_owner_reviews": true, + "require_last_push_approval": true, + "required_approving_review_count": 2 + }, + "required_signatures": { + "url": "https://api.github.com/repos/hub4j-test-org/temp-testEnableBranchProtections/branches/main/protection/required_signatures", + "enabled": false + }, + "enforce_admins": { + "url": "https://api.github.com/repos/hub4j-test-org/temp-testEnableBranchProtections/branches/main/protection/enforce_admins", + "enabled": true + }, + "required_linear_history": { + "enabled": true + }, + "allow_force_pushes": { + "enabled": true + }, + "allow_deletions": { + "enabled": true + }, + "block_creations": { + "enabled": true + }, + "required_conversation_resolution": { + "enabled": true + }, + "lock_branch": { + "enabled": true + }, + "allow_fork_syncing": { + "enabled": true + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/2-r_h_temp-testenablebranchprotections.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/2-r_h_temp-tes.json similarity index 96% rename from src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/2-r_h_temp-testenablebranchprotections.json rename to src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/2-r_h_temp-tes.json index 996bf7ece3..5c4d1b7a76 100644 --- a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/2-r_h_temp-testenablebranchprotections.json +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/2-r_h_temp-tes.json @@ -12,7 +12,7 @@ }, "response": { "status": 200, - "bodyFileName": "2-r_h_temp-testenablebranchprotections.json", + "bodyFileName": "2-r_h_temp-tes.json", "headers": { "Server": "GitHub.com", "Date": "Fri, 17 Jul 2020 17:40:28 GMT", diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/4-r_h_t_branches_main_protection.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/4-r_h_t_branches_main_protection.json index 4b4fdd00e6..0aa47d3f62 100644 --- a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/4-r_h_t_branches_main_protection.json +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/4-r_h_t_branches_main_protection.json @@ -49,4 +49,4 @@ "uuid": "3cdd44cf-a62c-43f6-abad-de7c8b65bfe3", "persistent": true, "insertionIndex": 4 -} +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/6-r_h_t_branches_main_protection.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/6-r_h_t_branches_main_protection.json new file mode 100644 index 0000000000..aee127f71c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testEnableBranchProtections/mappings/6-r_h_t_branches_main_protection.json @@ -0,0 +1,57 @@ +{ + "id": "854850d0-da4c-42f1-bfbd-01d8459b0639", + "name": "repos_hub4j-test-org_temp-testenablebranchprotections_branches_main_protection", + "request": { + "url": "/repos/hub4j-test-org/temp-testEnableBranchProtections/branches/main/protection", + "method": "PUT", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.luke-cage-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"lock_branch\":true,\"required_pull_request_reviews\":{\"required_approving_review_count\":2,\"require_code_owner_reviews\":true,\"dismiss_stale_reviews\":true,\"require_last_push_approval\":true},\"block_creations\":true,\"required_conversation_resolution\":true,\"required_status_checks\":{\"checks\":[{\"context\":\"test-status-check\"}],\"strict\":true},\"allow_fork_syncing\":true,\"required_linear_history\":true,\"restrictions\":null,\"enforce_admins\":true,\"allow_deletions\":true,\"allow_force_pushes\":true}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "6-r_h_t_branches_main_protection.json", + "headers": { + "Server": "GitHub.com", + "Date": "Thu, 13 Jun 2024 15:15: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/\"3a215bcd41d91bb045d01c04c1161c991f2b6588d859b06479dae7d4da689c3c\"", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, copilot, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2024-06-16 12:56:36 UTC", + "X-GitHub-Media-Type": "github.v3; param=luke-cage-preview; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4814", + "X-RateLimit-Reset": "1718293429", + "X-RateLimit-Used": "186", + "X-RateLimit-Resource": "core", + "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", + "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'", + "X-GitHub-Request-Id": "DA76:1147A1:89C7F36:8AAE569:666B0D0E" + } + }, + "uuid": "854850d0-da4c-42f1-bfbd-01d8459b0639", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHEventPayloadTest/repository_renamed.json b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/repository_renamed.json new file mode 100644 index 0000000000..bd278f0109 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/repository_renamed.json @@ -0,0 +1,149 @@ +{ + "action": "renamed", + "changes": { + "repository": { + "name": { + "from": "react-workshop" + } + } + }, + "repository": { + "id": 360319037, + "node_id": "MDEwOlJlcG9zaXRvcnkzNjAzMTkwMzc=", + "name": "react-workshop-renamed", + "full_name": "EJG-Organization/react-workshop-renamed", + "private": false, + "owner": { + "login": "EJG-Organization", + "id": 168135412, + "node_id": "O_kgDOCgWK9A", + "avatar_url": "https://avatars.githubusercontent.com/u/168135412?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/EJG-Organization", + "html_url": "https://github.com/EJG-Organization", + "followers_url": "https://api.github.com/users/EJG-Organization/followers", + "following_url": "https://api.github.com/users/EJG-Organization/following{/other_user}", + "gists_url": "https://api.github.com/users/EJG-Organization/gists{/gist_id}", + "starred_url": "https://api.github.com/users/EJG-Organization/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/EJG-Organization/subscriptions", + "organizations_url": "https://api.github.com/users/EJG-Organization/orgs", + "repos_url": "https://api.github.com/users/EJG-Organization/repos", + "events_url": "https://api.github.com/users/EJG-Organization/events{/privacy}", + "received_events_url": "https://api.github.com/users/EJG-Organization/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/EJG-Organization/react-workshop-renamed", + "description": null, + "fork": true, + "url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed", + "forks_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/forks", + "keys_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/teams", + "hooks_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/hooks", + "issue_events_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/issues/events{/number}", + "events_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/events", + "assignees_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/assignees{/user}", + "branches_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/branches{/branch}", + "tags_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/tags", + "blobs_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/statuses/{sha}", + "languages_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/languages", + "stargazers_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/stargazers", + "contributors_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/contributors", + "subscribers_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/subscribers", + "subscription_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/subscription", + "commits_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/contents/{+path}", + "compare_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/merges", + "archive_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/downloads", + "issues_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/issues{/number}", + "pulls_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/pulls{/number}", + "milestones_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/milestones{/number}", + "notifications_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/labels{/name}", + "releases_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/releases{/id}", + "deployments_url": "https://api.github.com/repos/EJG-Organization/react-workshop-renamed/deployments", + "created_at": "2021-04-21T22:09:16Z", + "updated_at": "2024-04-25T20:31:00Z", + "pushed_at": "2021-04-21T03:47:44Z", + "git_url": "git://github.com/EJG-Organization/react-workshop-renamed.git", + "ssh_url": "git@github.com:EJG-Organization/react-workshop-renamed.git", + "clone_url": "https://github.com/EJG-Organization/react-workshop-renamed.git", + "svn_url": "https://github.com/EJG-Organization/react-workshop-renamed", + "homepage": null, + "size": 196, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "main", + "custom_properties": { + + } + }, + "organization": { + "login": "EJG-Organization", + "id": 168135412, + "node_id": "O_kgDOCgWK9A", + "url": "https://api.github.com/orgs/EJG-Organization", + "repos_url": "https://api.github.com/orgs/EJG-Organization/repos", + "events_url": "https://api.github.com/orgs/EJG-Organization/events", + "hooks_url": "https://api.github.com/orgs/EJG-Organization/hooks", + "issues_url": "https://api.github.com/orgs/EJG-Organization/issues", + "members_url": "https://api.github.com/orgs/EJG-Organization/members{/member}", + "public_members_url": "https://api.github.com/orgs/EJG-Organization/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/168135412?v=4", + "description": null + }, + "sender": { + "login": "eleanorgoh", + "id": 66235606, + "node_id": "MDQ6VXNlcjY2MjM1NjA2", + "avatar_url": "https://avatars.githubusercontent.com/u/66235606?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/eleanorgoh", + "html_url": "https://github.com/eleanorgoh", + "followers_url": "https://api.github.com/users/eleanorgoh/followers", + "following_url": "https://api.github.com/users/eleanorgoh/following{/other_user}", + "gists_url": "https://api.github.com/users/eleanorgoh/gists{/gist_id}", + "starred_url": "https://api.github.com/users/eleanorgoh/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/eleanorgoh/subscriptions", + "organizations_url": "https://api.github.com/users/eleanorgoh/orgs", + "repos_url": "https://api.github.com/users/eleanorgoh/repos", + "events_url": "https://api.github.com/users/eleanorgoh/events{/privacy}", + "received_events_url": "https://api.github.com/users/eleanorgoh/received_events", + "type": "User", + "site_admin": false + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHEventPayloadTest/repository_transferred_to_org.json b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/repository_transferred_to_org.json new file mode 100644 index 0000000000..2e58148187 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/repository_transferred_to_org.json @@ -0,0 +1,168 @@ +{ + "action": "transferred", + "changes": { + "owner": { + "from": { + "user": { + "login": "eleanorgoh", + "id": 66235606, + "node_id": "MDQ6VXNlcjY2MjM1NjA2", + "avatar_url": "https://avatars.githubusercontent.com/u/66235606?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/eleanorgoh", + "html_url": "https://github.com/eleanorgoh", + "followers_url": "https://api.github.com/users/eleanorgoh/followers", + "following_url": "https://api.github.com/users/eleanorgoh/following{/other_user}", + "gists_url": "https://api.github.com/users/eleanorgoh/gists{/gist_id}", + "starred_url": "https://api.github.com/users/eleanorgoh/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/eleanorgoh/subscriptions", + "organizations_url": "https://api.github.com/users/eleanorgoh/orgs", + "repos_url": "https://api.github.com/users/eleanorgoh/repos", + "events_url": "https://api.github.com/users/eleanorgoh/events{/privacy}", + "received_events_url": "https://api.github.com/users/eleanorgoh/received_events", + "type": "User", + "site_admin": false + } + } + } + }, + "repository": { + "id": 360319037, + "node_id": "MDEwOlJlcG9zaXRvcnkzNjAzMTkwMzc=", + "name": "react-workshop", + "full_name": "EJG-Organization/react-workshop", + "private": false, + "owner": { + "login": "EJG-Organization", + "id": 168135412, + "node_id": "O_kgDOCgWK9A", + "avatar_url": "https://avatars.githubusercontent.com/u/168135412?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/EJG-Organization", + "html_url": "https://github.com/EJG-Organization", + "followers_url": "https://api.github.com/users/EJG-Organization/followers", + "following_url": "https://api.github.com/users/EJG-Organization/following{/other_user}", + "gists_url": "https://api.github.com/users/EJG-Organization/gists{/gist_id}", + "starred_url": "https://api.github.com/users/EJG-Organization/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/EJG-Organization/subscriptions", + "organizations_url": "https://api.github.com/users/EJG-Organization/orgs", + "repos_url": "https://api.github.com/users/EJG-Organization/repos", + "events_url": "https://api.github.com/users/EJG-Organization/events{/privacy}", + "received_events_url": "https://api.github.com/users/EJG-Organization/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/EJG-Organization/react-workshop", + "description": null, + "fork": true, + "url": "https://api.github.com/repos/EJG-Organization/react-workshop", + "forks_url": "https://api.github.com/repos/EJG-Organization/react-workshop/forks", + "keys_url": "https://api.github.com/repos/EJG-Organization/react-workshop/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/EJG-Organization/react-workshop/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/EJG-Organization/react-workshop/teams", + "hooks_url": "https://api.github.com/repos/EJG-Organization/react-workshop/hooks", + "issue_events_url": "https://api.github.com/repos/EJG-Organization/react-workshop/issues/events{/number}", + "events_url": "https://api.github.com/repos/EJG-Organization/react-workshop/events", + "assignees_url": "https://api.github.com/repos/EJG-Organization/react-workshop/assignees{/user}", + "branches_url": "https://api.github.com/repos/EJG-Organization/react-workshop/branches{/branch}", + "tags_url": "https://api.github.com/repos/EJG-Organization/react-workshop/tags", + "blobs_url": "https://api.github.com/repos/EJG-Organization/react-workshop/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/EJG-Organization/react-workshop/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/EJG-Organization/react-workshop/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/EJG-Organization/react-workshop/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/EJG-Organization/react-workshop/statuses/{sha}", + "languages_url": "https://api.github.com/repos/EJG-Organization/react-workshop/languages", + "stargazers_url": "https://api.github.com/repos/EJG-Organization/react-workshop/stargazers", + "contributors_url": "https://api.github.com/repos/EJG-Organization/react-workshop/contributors", + "subscribers_url": "https://api.github.com/repos/EJG-Organization/react-workshop/subscribers", + "subscription_url": "https://api.github.com/repos/EJG-Organization/react-workshop/subscription", + "commits_url": "https://api.github.com/repos/EJG-Organization/react-workshop/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/EJG-Organization/react-workshop/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/EJG-Organization/react-workshop/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/EJG-Organization/react-workshop/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/EJG-Organization/react-workshop/contents/{+path}", + "compare_url": "https://api.github.com/repos/EJG-Organization/react-workshop/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/EJG-Organization/react-workshop/merges", + "archive_url": "https://api.github.com/repos/EJG-Organization/react-workshop/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/EJG-Organization/react-workshop/downloads", + "issues_url": "https://api.github.com/repos/EJG-Organization/react-workshop/issues{/number}", + "pulls_url": "https://api.github.com/repos/EJG-Organization/react-workshop/pulls{/number}", + "milestones_url": "https://api.github.com/repos/EJG-Organization/react-workshop/milestones{/number}", + "notifications_url": "https://api.github.com/repos/EJG-Organization/react-workshop/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/EJG-Organization/react-workshop/labels{/name}", + "releases_url": "https://api.github.com/repos/EJG-Organization/react-workshop/releases{/id}", + "deployments_url": "https://api.github.com/repos/EJG-Organization/react-workshop/deployments", + "created_at": "2021-04-21T22:09:16Z", + "updated_at": "2024-04-25T20:28:46Z", + "pushed_at": "2021-04-21T03:47:44Z", + "git_url": "git://github.com/EJG-Organization/react-workshop.git", + "ssh_url": "git@github.com:EJG-Organization/react-workshop.git", + "clone_url": "https://github.com/EJG-Organization/react-workshop.git", + "svn_url": "https://github.com/EJG-Organization/react-workshop", + "homepage": null, + "size": 196, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "main", + "custom_properties": { + + } + }, + "organization": { + "login": "EJG-Organization", + "id": 168135412, + "node_id": "O_kgDOCgWK9A", + "url": "https://api.github.com/orgs/EJG-Organization", + "repos_url": "https://api.github.com/orgs/EJG-Organization/repos", + "events_url": "https://api.github.com/orgs/EJG-Organization/events", + "hooks_url": "https://api.github.com/orgs/EJG-Organization/hooks", + "issues_url": "https://api.github.com/orgs/EJG-Organization/issues", + "members_url": "https://api.github.com/orgs/EJG-Organization/members{/member}", + "public_members_url": "https://api.github.com/orgs/EJG-Organization/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/168135412?v=4", + "description": null + }, + "sender": { + "login": "eleanorgoh", + "id": 66235606, + "node_id": "MDQ6VXNlcjY2MjM1NjA2", + "avatar_url": "https://avatars.githubusercontent.com/u/66235606?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/eleanorgoh", + "html_url": "https://github.com/eleanorgoh", + "followers_url": "https://api.github.com/users/eleanorgoh/followers", + "following_url": "https://api.github.com/users/eleanorgoh/following{/other_user}", + "gists_url": "https://api.github.com/users/eleanorgoh/gists{/gist_id}", + "starred_url": "https://api.github.com/users/eleanorgoh/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/eleanorgoh/subscriptions", + "organizations_url": "https://api.github.com/users/eleanorgoh/orgs", + "repos_url": "https://api.github.com/users/eleanorgoh/repos", + "events_url": "https://api.github.com/users/eleanorgoh/events{/privacy}", + "received_events_url": "https://api.github.com/users/eleanorgoh/received_events", + "type": "User", + "site_admin": false + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHEventPayloadTest/repository_transferred_to_user.json b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/repository_transferred_to_user.json new file mode 100644 index 0000000000..57fbd55029 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/repository_transferred_to_user.json @@ -0,0 +1,145 @@ +{ + "action": "transferred", + "changes": { + "owner": { + "from": { + "organization": { + "login": "EJG-Organization", + "id": 168135412, + "node_id": "O_kgDOCgWK9A", + "url": "https://api.github.com/orgs/EJG-Organization", + "repos_url": "https://api.github.com/orgs/EJG-Organization/repos", + "events_url": "https://api.github.com/orgs/EJG-Organization/events", + "hooks_url": "https://api.github.com/orgs/EJG-Organization/hooks", + "issues_url": "https://api.github.com/orgs/EJG-Organization/issues", + "members_url": "https://api.github.com/orgs/EJG-Organization/members{/member}", + "public_members_url": "https://api.github.com/orgs/EJG-Organization/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/168135412?v=4", + "description": null + } + } + } + }, + "repository": { + "id": 360319037, + "node_id": "MDEwOlJlcG9zaXRvcnkzNjAzMTkwMzc=", + "name": "react-workshop-renamed", + "full_name": "eleanorgoh/react-workshop-renamed", + "private": false, + "owner": { + "login": "eleanorgoh", + "id": 66235606, + "node_id": "MDQ6VXNlcjY2MjM1NjA2", + "avatar_url": "https://avatars.githubusercontent.com/u/66235606?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/eleanorgoh", + "html_url": "https://github.com/eleanorgoh", + "followers_url": "https://api.github.com/users/eleanorgoh/followers", + "following_url": "https://api.github.com/users/eleanorgoh/following{/other_user}", + "gists_url": "https://api.github.com/users/eleanorgoh/gists{/gist_id}", + "starred_url": "https://api.github.com/users/eleanorgoh/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/eleanorgoh/subscriptions", + "organizations_url": "https://api.github.com/users/eleanorgoh/orgs", + "repos_url": "https://api.github.com/users/eleanorgoh/repos", + "events_url": "https://api.github.com/users/eleanorgoh/events{/privacy}", + "received_events_url": "https://api.github.com/users/eleanorgoh/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/eleanorgoh/react-workshop-renamed", + "description": null, + "fork": true, + "url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed", + "forks_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/forks", + "keys_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/teams", + "hooks_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/hooks", + "issue_events_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/issues/events{/number}", + "events_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/events", + "assignees_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/assignees{/user}", + "branches_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/branches{/branch}", + "tags_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/tags", + "blobs_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/statuses/{sha}", + "languages_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/languages", + "stargazers_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/stargazers", + "contributors_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/contributors", + "subscribers_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/subscribers", + "subscription_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/subscription", + "commits_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/contents/{+path}", + "compare_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/merges", + "archive_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/downloads", + "issues_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/issues{/number}", + "pulls_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/pulls{/number}", + "milestones_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/milestones{/number}", + "notifications_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/labels{/name}", + "releases_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/releases{/id}", + "deployments_url": "https://api.github.com/repos/eleanorgoh/react-workshop-renamed/deployments", + "created_at": "2021-04-21T22:09:16Z", + "updated_at": "2024-04-25T20:36:56Z", + "pushed_at": "2021-04-21T03:47:44Z", + "git_url": "git://github.com/eleanorgoh/react-workshop-renamed.git", + "ssh_url": "git@github.com:eleanorgoh/react-workshop-renamed.git", + "clone_url": "https://github.com/eleanorgoh/react-workshop-renamed.git", + "svn_url": "https://github.com/eleanorgoh/react-workshop-renamed", + "homepage": null, + "size": 196, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "main" + }, + "sender": { + "login": "eleanorgoh", + "id": 66235606, + "node_id": "MDQ6VXNlcjY2MjM1NjA2", + "avatar_url": "https://avatars.githubusercontent.com/u/66235606?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/eleanorgoh", + "html_url": "https://github.com/eleanorgoh", + "followers_url": "https://api.github.com/users/eleanorgoh/followers", + "following_url": "https://api.github.com/users/eleanorgoh/following{/other_user}", + "gists_url": "https://api.github.com/users/eleanorgoh/gists{/gist_id}", + "starred_url": "https://api.github.com/users/eleanorgoh/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/eleanorgoh/subscriptions", + "organizations_url": "https://api.github.com/users/eleanorgoh/orgs", + "repos_url": "https://api.github.com/users/eleanorgoh/repos", + "events_url": "https://api.github.com/users/eleanorgoh/events{/privacy}", + "received_events_url": "https://api.github.com/users/eleanorgoh/received_events", + "type": "User", + "site_admin": false + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testGetOrganization/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testGetOrganization/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testGetOrganization/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "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://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 11, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 12, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testGetOrganization/__files/2-o_h_external-groups.json b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testGetOrganization/__files/2-o_h_external-groups.json new file mode 100644 index 0000000000..6ca002d837 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testGetOrganization/__files/2-o_h_external-groups.json @@ -0,0 +1,24 @@ +{ + "groups": [ + { + "group_id": 467430, + "group_name": "acme-asset-owners", + "updated_at": "2023-09-13T16:41:29Z" + }, + { + "group_id": 467431, + "group_name": "acme-developers", + "updated_at": "2023-09-13T16:41:28Z" + }, + { + "group_id": 467432, + "group_name": "acme-product-owners", + "updated_at": "2023-09-13T16:41:27Z" + }, + { + "group_id": 467433, + "group_name": "acme-technical-leads", + "updated_at": "2023-09-13T16:41:28Z" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testGetOrganization/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testGetOrganization/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..3109f17dca --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testGetOrganization/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,50 @@ +{ + "name": "orgs_hub4j-test-org", + "scenarioName": "Refresh", + "requiredScenarioState": "Started", + "newScenarioState": "OrgRetrieved", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF7E:786110:5E5531FF" + } + }, + "uuid": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testGetOrganization/mappings/2-o_h_external-groups.json b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testGetOrganization/mappings/2-o_h_external-groups.json new file mode 100644 index 0000000000..4cf7a58444 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testGetOrganization/mappings/2-o_h_external-groups.json @@ -0,0 +1,49 @@ +{ + "name": "orgs_hub4j-test-org_external-groups", + "scenarioName": "Refresh", + "requiredScenarioState": "OrgRetrieved", + "newScenarioState": "ExternalGroupsRetrieved", + "request": { + "url": "/orgs/hub4j-test-org/external-groups", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-o_h_external-groups.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:06 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1582644475", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"631de12e6bc586863218257765331a70\"", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF8C:78624D:5E553201" + } + }, + "uuid": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "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://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 11, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 12, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/__files/2-o_h_external-groups.json b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/__files/2-o_h_external-groups.json new file mode 100644 index 0000000000..6ca002d837 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/__files/2-o_h_external-groups.json @@ -0,0 +1,24 @@ +{ + "groups": [ + { + "group_id": 467430, + "group_name": "acme-asset-owners", + "updated_at": "2023-09-13T16:41:29Z" + }, + { + "group_id": 467431, + "group_name": "acme-developers", + "updated_at": "2023-09-13T16:41:28Z" + }, + { + "group_id": 467432, + "group_name": "acme-product-owners", + "updated_at": "2023-09-13T16:41:27Z" + }, + { + "group_id": 467433, + "group_name": "acme-technical-leads", + "updated_at": "2023-09-13T16:41:28Z" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/__files/3-o_h_external-group_467431.json b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/__files/3-o_h_external-group_467431.json new file mode 100644 index 0000000000..43bc55fc41 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/__files/3-o_h_external-group_467431.json @@ -0,0 +1,25 @@ +{ + "group_id": 467431, + "group_name": "acme-developers", + "updated_at": "2023-09-13T16:41:28Z", + "members": [ + { + "member_id": 158311279, + "member_login": "john-doe_acme", + "member_name": "John Doe", + "member_email": "john.doe@acme.corp" + }, + { + "member_id": 166731041, + "member_login": "jane-doe_acme", + "member_name": "Jane Doe", + "member_email": "jane.doe@acme.corp" + } + ], + "teams": [ + { + "team_id": 9891173, + "team_name": "ACME-DEVELOPERS" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..88d93869d4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF7E:786110:5E5531FF" + } + }, + "uuid": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/mappings/2-o_h_external-groups.json b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/mappings/2-o_h_external-groups.json new file mode 100644 index 0000000000..56f284f32d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/mappings/2-o_h_external-groups.json @@ -0,0 +1,47 @@ +{ + "id": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "name": "orgs_hub4j-test-org_external-groups", + "request": { + "url": "/orgs/hub4j-test-org/external-groups", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-o_h_external-groups.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:06 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1582644475", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"631de12e6bc586863218257765331a70\"", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF8C:78624D:5E553201" + } + }, + "uuid": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/mappings/3-o_h_external-group_467431.json b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/mappings/3-o_h_external-group_467431.json new file mode 100644 index 0000000000..9ebe4dac3e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHExternalGroupTest/wiremock/testRefreshBoundExternalGroup/mappings/3-o_h_external-group_467431.json @@ -0,0 +1,47 @@ +{ + "id": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "name": "orgs_hub4j-test-org_external-group_467431", + "request": { + "url": "/orgs/hub4j-test-org/external-group/467431", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-o_h_external-group_467431.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:06 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1582644475", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"631de12e6bc586863218257765331a70\"", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF8C:78624D:5E553201" + } + }, + "uuid": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroup/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroup/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroup/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "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://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 11, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 12, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroup/__files/2-o_h_external-group_467431.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroup/__files/2-o_h_external-group_467431.json new file mode 100644 index 0000000000..43bc55fc41 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroup/__files/2-o_h_external-group_467431.json @@ -0,0 +1,25 @@ +{ + "group_id": 467431, + "group_name": "acme-developers", + "updated_at": "2023-09-13T16:41:28Z", + "members": [ + { + "member_id": 158311279, + "member_login": "john-doe_acme", + "member_name": "John Doe", + "member_email": "john.doe@acme.corp" + }, + { + "member_id": 166731041, + "member_login": "jane-doe_acme", + "member_name": "Jane Doe", + "member_email": "jane.doe@acme.corp" + } + ], + "teams": [ + { + "team_id": 9891173, + "team_name": "ACME-DEVELOPERS" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroup/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroup/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..88d93869d4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroup/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF7E:786110:5E5531FF" + } + }, + "uuid": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroup/mappings/2-o_h_external-group_467431.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroup/mappings/2-o_h_external-group_467431.json new file mode 100644 index 0000000000..ca99942d4f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroup/mappings/2-o_h_external-group_467431.json @@ -0,0 +1,47 @@ +{ + "id": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "name": "orgs_hub4j-test-org_external-group_467431", + "request": { + "url": "/orgs/hub4j-test-org/external-group/467431", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-o_h_external-group_467431.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:06 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1582644475", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"631de12e6bc586863218257765331a70\"", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF8C:78624D:5E553201" + } + }, + "uuid": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroupNotEnterpriseManagedOrganization/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroupNotEnterpriseManagedOrganization/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroupNotEnterpriseManagedOrganization/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "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://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 11, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 12, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroupNotEnterpriseManagedOrganization/__files/2-o_h_external-group_12345.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroupNotEnterpriseManagedOrganization/__files/2-o_h_external-group_12345.json new file mode 100644 index 0000000000..ef5f4606c4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroupNotEnterpriseManagedOrganization/__files/2-o_h_external-group_12345.json @@ -0,0 +1,4 @@ +{ + "message": "This organization is not part of externally managed enterprise.", + "documentation_url": "https://docs.github.com/rest/teams/external-groups#list-external-groups-in-an-organization" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroupNotEnterpriseManagedOrganization/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroupNotEnterpriseManagedOrganization/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..88d93869d4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroupNotEnterpriseManagedOrganization/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF7E:786110:5E5531FF" + } + }, + "uuid": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroupNotEnterpriseManagedOrganization/mappings/2-o_h_external-group_12345.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroupNotEnterpriseManagedOrganization/mappings/2-o_h_external-group_12345.json new file mode 100644 index 0000000000..7367c3fa17 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetExternalGroupNotEnterpriseManagedOrganization/mappings/2-o_h_external-group_12345.json @@ -0,0 +1,47 @@ +{ + "id": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "name": "orgs_hub4j-test-org_external-group_12345", + "request": { + "url": "/orgs/hub4j-test-org/external-group/12345", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 400, + "bodyFileName": "2-o_h_external-group_12345.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:06 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1582644475", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"631de12e6bc586863218257765331a70\"", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF8C:78624D:5E553201" + } + }, + "uuid": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/__files/1-user.json new file mode 100644 index 0000000000..430f1b45ac --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/__files/1-user.json @@ -0,0 +1,34 @@ +{ + "login": "fv316", + "id": 34072742, + "node_id": "MDQ6VXNlcjM0MDcyNzQy", + "avatar_url": "https://avatars.githubusercontent.com/u/34072742?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/fv316", + "html_url": "https://github.com/fv316", + "followers_url": "https://api.github.com/users/fv316/followers", + "following_url": "https://api.github.com/users/fv316/following{/other_user}", + "gists_url": "https://api.github.com/users/fv316/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fv316/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fv316/subscriptions", + "organizations_url": "https://api.github.com/users/fv316/orgs", + "repos_url": "https://api.github.com/users/fv316/repos", + "events_url": "https://api.github.com/users/fv316/events{/privacy}", + "received_events_url": "https://api.github.com/users/fv316/received_events", + "type": "User", + "site_admin": false, + "name": "Francisco Correia", + "company": "Teya", + "blog": "", + "location": "Lisbon/ London", + "email": null, + "hireable": null, + "bio": "Software developer at Teya. Electrical Engineer @ Imperial College. Data scientist @ École Polytechnique", + "twitter_username": null, + "public_repos": 29, + "public_gists": 0, + "followers": 6, + "following": 5, + "created_at": "2017-11-28T18:40:02Z", + "updated_at": "2024-06-10T08:34:28Z" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/__files/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/__files/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..a6ece8248a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/__files/2-orgs_hub4j-test-org.json @@ -0,0 +1,66 @@ +{ + "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": "2020-06-04T05:56:10Z", + "archived_at": null, + "type": "Organization", + "total_private_repos": 6, + "owned_private_repos": 6, + "private_gists": 0, + "disk_usage": 12014, + "collaborators": 1, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "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, + "members_can_create_public_pages": true, + "members_can_create_private_pages": true, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 10000, + "filled_seats": 52, + "seats": 3 + }, + "advanced_security_enabled_for_new_repositories": false, + "dependabot_alerts_enabled_for_new_repositories": false, + "dependabot_security_updates_enabled_for_new_repositories": false, + "dependency_graph_enabled_for_new_repositories": false, + "secret_scanning_enabled_for_new_repositories": false, + "secret_scanning_push_protection_enabled_for_new_repositories": false, + "secret_scanning_push_protection_custom_link_enabled": false, + "secret_scanning_push_protection_custom_link": null, + "secret_scanning_validity_checks_enabled": false +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/__files/3-o_h_m_fv316.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/__files/3-o_h_m_fv316.json new file mode 100644 index 0000000000..c4d275bfb8 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/__files/3-o_h_m_fv316.json @@ -0,0 +1,40 @@ +{ + "url": "https://api.github.com/orgs/hub4j-test-org/memberships/fv316", + "state": "active", + "role": "admin", + "organization_url": "https://api.github.com/orgs/hub4j-test-org", + "user": { + "login": "fv316", + "id": 34072742, + "node_id": "MDQ6VXNlcjM0MDcyNzQy", + "avatar_url": "https://avatars.githubusercontent.com/u/34072742?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/fv316", + "html_url": "https://github.com/fv316", + "followers_url": "https://api.github.com/users/fv316/followers", + "following_url": "https://api.github.com/users/fv316/following{/other_user}", + "gists_url": "https://api.github.com/users/fv316/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fv316/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fv316/subscriptions", + "organizations_url": "https://api.github.com/users/fv316/orgs", + "repos_url": "https://api.github.com/users/fv316/repos", + "events_url": "https://api.github.com/users/fv316/events{/privacy}", + "received_events_url": "https://api.github.com/users/fv316/received_events", + "type": "User", + "site_admin": false + }, + "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)" + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/mappings/1-user.json new file mode 100644 index 0000000000..4205325095 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/mappings/1-user.json @@ -0,0 +1,50 @@ +{ + "id": "78c86a2e-48b0-4b78-a9c8-c409b4cc58e3", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Server": "GitHub.com", + "Date": "Mon, 10 Jun 2024 09:07:17 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/\"eeffd28da9e86bf9a8b2cf03b36620ad72f1bccfccd1a5ee0a51a95dab4e05e9\"", + "Last-Modified": "Mon, 10 Jun 2024 08:34:28 GMT", + "github-authentication-token-expiration": "2024-06-17 10:06:09 +0100", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-accepted-github-permissions": "allows_permissionless_access=true", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4982", + "X-RateLimit-Reset": "1718013850", + "X-RateLimit-Used": "18", + "X-RateLimit-Resource": "core", + "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", + "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'", + "X-GitHub-Request-Id": "914E:19FF74:39926C:39E38C:6666C245" + } + }, + "uuid": "78c86a2e-48b0-4b78-a9c8-c409b4cc58e3", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/mappings/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/mappings/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..af854f6cbc --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/mappings/2-orgs_hub4j-test-org.json @@ -0,0 +1,50 @@ +{ + "id": "9f6e328b-67ee-4481-8bcc-8b33b990dbd2", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Mon, 10 Jun 2024 09:07:19 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/\"67969e1a2c33b92087f1e2d76d07a944a80920a84bf07593fff4ec8c8d00f612\"", + "Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT", + "github-authentication-token-expiration": "2024-06-17 10:06:09 +0100", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-accepted-github-permissions": "allows_permissionless_access=true", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4977", + "X-RateLimit-Reset": "1718013850", + "X-RateLimit-Used": "23", + "X-RateLimit-Resource": "core", + "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", + "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'", + "X-GitHub-Request-Id": "56D5:19B6F6:69C4020:6A85446:6666C247" + } + }, + "uuid": "9f6e328b-67ee-4481-8bcc-8b33b990dbd2", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/mappings/3-o_h_m_fv316.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/mappings/3-o_h_m_fv316.json new file mode 100644 index 0000000000..a05de4f385 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testGetMembership/mappings/3-o_h_m_fv316.json @@ -0,0 +1,49 @@ +{ + "id": "43da17f8-ad32-4962-8514-6c6cc43c15cc", + "name": "orgs_hub4j-test-org_memberships_fv316", + "request": { + "url": "/orgs/hub4j-test-org/memberships/fv316", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-o_h_m_fv316.json", + "headers": { + "Server": "GitHub.com", + "Date": "Mon, 10 Jun 2024 09:07: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/\"15242c0357eae1a2005c74dbd71674ea7381c0aa015e9ed363fbda6e21f04e9e\"", + "github-authentication-token-expiration": "2024-06-17 10:06:09 +0100", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-accepted-github-permissions": "members=read", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4976", + "X-RateLimit-Reset": "1718013850", + "X-RateLimit-Used": "24", + "X-RateLimit-Resource": "core", + "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", + "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'", + "X-GitHub-Request-Id": "9122:E812C:6E243E4:6EE4810:6666C248" + } + }, + "uuid": "43da17f8-ad32-4962-8514-6c6cc43c15cc", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsNotEnterpriseManagedOrganization/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsNotEnterpriseManagedOrganization/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsNotEnterpriseManagedOrganization/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "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://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 11, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 12, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsNotEnterpriseManagedOrganization/__files/2-o_h_external-groups.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsNotEnterpriseManagedOrganization/__files/2-o_h_external-groups.json new file mode 100644 index 0000000000..ef5f4606c4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsNotEnterpriseManagedOrganization/__files/2-o_h_external-groups.json @@ -0,0 +1,4 @@ +{ + "message": "This organization is not part of externally managed enterprise.", + "documentation_url": "https://docs.github.com/rest/teams/external-groups#list-external-groups-in-an-organization" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsNotEnterpriseManagedOrganization/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsNotEnterpriseManagedOrganization/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..88d93869d4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsNotEnterpriseManagedOrganization/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF7E:786110:5E5531FF" + } + }, + "uuid": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsNotEnterpriseManagedOrganization/mappings/2-o_h_external-groups.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsNotEnterpriseManagedOrganization/mappings/2-o_h_external-groups.json new file mode 100644 index 0000000000..3d1a147da7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsNotEnterpriseManagedOrganization/mappings/2-o_h_external-groups.json @@ -0,0 +1,47 @@ +{ + "id": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "name": "orgs_hub4j-test-org_external-groups", + "request": { + "url": "/orgs/hub4j-test-org/external-groups", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 400, + "bodyFileName": "2-o_h_external-groups.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:06 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "400 Bad Request", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1582644475", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"631de12e6bc586863218257765331a70\"", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF8C:78624D:5E553201" + } + }, + "uuid": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithFilter/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithFilter/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithFilter/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "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://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 11, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 12, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithFilter/__files/2-o_h_external-groups.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithFilter/__files/2-o_h_external-groups.json new file mode 100644 index 0000000000..6ca002d837 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithFilter/__files/2-o_h_external-groups.json @@ -0,0 +1,24 @@ +{ + "groups": [ + { + "group_id": 467430, + "group_name": "acme-asset-owners", + "updated_at": "2023-09-13T16:41:29Z" + }, + { + "group_id": 467431, + "group_name": "acme-developers", + "updated_at": "2023-09-13T16:41:28Z" + }, + { + "group_id": 467432, + "group_name": "acme-product-owners", + "updated_at": "2023-09-13T16:41:27Z" + }, + { + "group_id": 467433, + "group_name": "acme-technical-leads", + "updated_at": "2023-09-13T16:41:28Z" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithFilter/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithFilter/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..88d93869d4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithFilter/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF7E:786110:5E5531FF" + } + }, + "uuid": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithFilter/mappings/2-o_h_external-groups.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithFilter/mappings/2-o_h_external-groups.json new file mode 100644 index 0000000000..87ccb5c729 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithFilter/mappings/2-o_h_external-groups.json @@ -0,0 +1,47 @@ +{ + "id": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "name": "orgs_hub4j-test-org_external-groups", + "request": { + "url": "/orgs/hub4j-test-org/external-groups?display_name=acme", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-o_h_external-groups.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:06 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1582644475", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"631de12e6bc586863218257765331a70\"", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF8C:78624D:5E553201" + } + }, + "uuid": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "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://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 11, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 12, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/__files/2-o_h_external-groups.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/__files/2-o_h_external-groups.json new file mode 100644 index 0000000000..cb56150f56 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/__files/2-o_h_external-groups.json @@ -0,0 +1,14 @@ +{ + "groups": [ + { + "group_id": 467430, + "group_name": "acme-asset-owners", + "updated_at": "2023-09-13T16:41:29Z" + }, + { + "group_id": 467431, + "group_name": "acme-developers", + "updated_at": "2023-09-13T16:41:28Z" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/__files/3-o_h_external-groups.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/__files/3-o_h_external-groups.json new file mode 100644 index 0000000000..a0ae5bb160 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/__files/3-o_h_external-groups.json @@ -0,0 +1,14 @@ +{ + "groups": [ + { + "group_id": 467432, + "group_name": "acme-product-owners", + "updated_at": "2023-09-13T16:41:27Z" + }, + { + "group_id": 467433, + "group_name": "acme-technical-leads", + "updated_at": "2023-09-13T16:41:28Z" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..88d93869d4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF7E:786110:5E5531FF" + } + }, + "uuid": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/mappings/2-o_h_external-groups.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/mappings/2-o_h_external-groups.json new file mode 100644 index 0000000000..535a742003 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/mappings/2-o_h_external-groups.json @@ -0,0 +1,49 @@ +{ + "id": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "name": "orgs_hub4j-test-org_external-groups", + "request": { + "url": "/orgs/hub4j-test-org/external-groups?per_page=2", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-o_h_external-groups.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:06 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1582644475", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"631de12e6bc586863218257765331a70\"", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF8C:78624D:5E553201", + "Link": "; rel=\"next\", ; rel=\"last\"" + }, + "transformers": ["response-template"] + }, + "uuid": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/mappings/3-o_h_external-groups.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/mappings/3-o_h_external-groups.json new file mode 100644 index 0000000000..1048f58184 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithPagination/mappings/3-o_h_external-groups.json @@ -0,0 +1,47 @@ +{ + "id": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "name": "orgs_hub4j-test-org_members", + "request": { + "url": "/orgs/hub4j-test-org/external-groups?per_page=2&page=2", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-o_h_external-groups.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:06 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1582644475", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"631de12e6bc586863218257765331a70\"", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF8C:78624D:5E553201" + } + }, + "uuid": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithoutPagination/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithoutPagination/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithoutPagination/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "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://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 11, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 12, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithoutPagination/__files/2-o_h_external-groups.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithoutPagination/__files/2-o_h_external-groups.json new file mode 100644 index 0000000000..6ca002d837 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithoutPagination/__files/2-o_h_external-groups.json @@ -0,0 +1,24 @@ +{ + "groups": [ + { + "group_id": 467430, + "group_name": "acme-asset-owners", + "updated_at": "2023-09-13T16:41:29Z" + }, + { + "group_id": 467431, + "group_name": "acme-developers", + "updated_at": "2023-09-13T16:41:28Z" + }, + { + "group_id": 467432, + "group_name": "acme-product-owners", + "updated_at": "2023-09-13T16:41:27Z" + }, + { + "group_id": 467433, + "group_name": "acme-technical-leads", + "updated_at": "2023-09-13T16:41:28Z" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithoutPagination/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithoutPagination/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..88d93869d4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithoutPagination/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF7E:786110:5E5531FF" + } + }, + "uuid": "3ed48345-73c2-4d8e-9c65-f4a140356d59", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithoutPagination/mappings/2-o_h_external-groups.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithoutPagination/mappings/2-o_h_external-groups.json new file mode 100644 index 0000000000..56f284f32d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListExternalGroupsWithoutPagination/mappings/2-o_h_external-groups.json @@ -0,0 +1,47 @@ +{ + "id": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "name": "orgs_hub4j-test-org_external-groups", + "request": { + "url": "/orgs/hub4j-test-org/external-groups", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-o_h_external-groups.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:06 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1582644475", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"631de12e6bc586863218257765331a70\"", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF8C:78624D:5E553201" + } + }, + "uuid": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListSecurityManagers/__files/1-security-managers.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListSecurityManagers/__files/1-security-managers.json new file mode 100644 index 0000000000..20585daf20 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListSecurityManagers/__files/1-security-managers.json @@ -0,0 +1,16 @@ +[ + { + "name": "security team", + "id": 31337, + "node_id": "MDQ6VGVhbTMxMzM3", + "slug": "security-team", + "description": "Security manager role access to all git repositories", + "privacy": "closed", + "notification_setting": "notifications_enabled", + "url": "https://api.github.com/organizations/7544739/team/31337", + "html_url": "https://api.github.com/orgs/hub4j-test-org/teams/schibsted-data-security-team", + "members_url": "https://api.github.com/api/v3/organizations/7544739/team/31337/members{/member}", + "repositories_url": "https://api.github.com/api/v3/organizations/7544739/team/31337/repos", + "permission": "pull" + } +] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListSecurityManagers/__files/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListSecurityManagers/__files/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListSecurityManagers/__files/2-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "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://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 11, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 12, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListSecurityManagers/mappings/1-security-managers.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListSecurityManagers/mappings/1-security-managers.json new file mode 100644 index 0000000000..27c4dbb247 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListSecurityManagers/mappings/1-security-managers.json @@ -0,0 +1,48 @@ +{ + "id": "a3604d73-d76d-4f3e-8f7f-cecee94c5cef", + "name": "user", + "request": { + "url": "/orgs/hub4j-test-org/security-managers", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-security-managers.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:27:54 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4999", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"9adfa44fe91fb698b5fd807d9471afc3\"", + "Last-Modified": "Tue, 18 Feb 2020 13:29:56 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E686:35E3:5882BF:ABE338:5E552EEA" + } + }, + "uuid": "a3604d73-d76d-4f3e-8f7f-cecee94c5cef", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListSecurityManagers/mappings/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListSecurityManagers/mappings/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..e337b8d47f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListSecurityManagers/mappings/2-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "6682f58b-c93b-4525-9e99-485e631aaaab", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:29:12 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4991", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E7D4:4A52:336FA3:797A80:5E552F38" + } + }, + "uuid": "6682f58b-c93b-4525-9e99-485e631aaaab", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..162ceb1c73 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,55 @@ +{ + "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": 49, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization", + "total_private_repos": 3, + "owned_private_repos": 3, + "private_gists": 0, + "disk_usage": 11979, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "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, + "members_can_create_public_pages": true, + "members_can_create_private_pages": true, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 10000, + "filled_seats": 35, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/__files/2-o_h_t_acme-developers.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/__files/2-o_h_t_acme-developers.json new file mode 100644 index 0000000000..d79e7c6f1a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/__files/2-o_h_t_acme-developers.json @@ -0,0 +1,49 @@ +{ + "name": "ACME-DEVELOPERS", + "id": 34519919, + "node_id": "MDQ6VGVhbTM0NTE5OTY=", + "slug": "acme-developers", + "description": "Updated by API TestModified", + "privacy": "closed", + "url": "https://api.github.com/organizations/7544739/team/3451996", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/acme-developers", + "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", + "permission": "pull", + "created_at": "2019-10-03T21:46:12Z", + "updated_at": "2022-03-04T10:36:59Z", + "members_count": 1, + "repos_count": 1, + "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": 49, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/__files/3-o_h_t_external-group_467431.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/__files/3-o_h_t_external-group_467431.json new file mode 100644 index 0000000000..92f54df964 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/__files/3-o_h_t_external-group_467431.json @@ -0,0 +1,19 @@ +{ + "group_id": 467431, + "group_name": "acme-developers", + "updated_at": "2023-09-13T16:41:28Z", + "members": [ + { + "member_id": 158311279, + "member_login": "john-doe_acme", + "member_name": "John Doe", + "member_email": "john.doe@acme.corp" + }, + { + "member_id": 166731041, + "member_login": "jane-doe_acme", + "member_name": "Jane Doe", + "member_email": "jane.doe@acme.corp" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/__files/4-o_h_t_acme-developers_external-groups.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/__files/4-o_h_t_acme-developers_external-groups.json new file mode 100644 index 0000000000..9c13f5dca4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/__files/4-o_h_t_acme-developers_external-groups.json @@ -0,0 +1,25 @@ +{ + "group_id": 467431, + "group_name": "acme-developers", + "updated_at": "2023-09-13T16:41:28Z", + "members": [ + { + "member_id": 158311279, + "member_login": "john-doe_acme", + "member_name": "John Doe", + "member_email": "john.doe@acme.corp" + }, + { + "member_id": 166731041, + "member_login": "jane-doe_acme", + "member_name": "Jane Doe", + "member_email": "jane.doe@acme.corp" + } + ], + "teams": [ + { + "team_id": 34519919, + "team_name": "ACME-DEVELOPERS" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..18868d99d1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,47 @@ +{ + "id": "780bda7a-e76d-4840-87e4-ba6411cfc9c2", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:36:59 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/\"861b38147d37bd59e507771e76ec048def20dd6e5ac5b75aceb01c8b9f0ef4f5\"", + "Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4990", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "10", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F4:5E65:1A3BC41:1AAFE9E:6221EBCB" + } + }, + "uuid": "780bda7a-e76d-4840-87e4-ba6411cfc9c2", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/mappings/2-o_h_t_acme-developers.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/mappings/2-o_h_t_acme-developers.json new file mode 100644 index 0000000000..1f5c8081f9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/mappings/2-o_h_t_acme-developers.json @@ -0,0 +1,47 @@ +{ + "id": "e688e202-0c96-4144-b415-cb16f315d478", + "name": "orgs_hub4j-test-org_teams_acme-developers", + "request": { + "url": "/orgs/hub4j-test-org/teams/acme-developers", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-o_h_t_acme-developers.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:37:00 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/\"1fbce0cbfea113fefff1877b37929ef1d7cb9c8989a5b223df3e9ea092502191\"", + "Last-Modified": "Fri, 04 Mar 2022 10:36:59 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4989", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "11", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F6:361D:2C7B93A:2D76BBD:6221EBCB" + } + }, + "uuid": "e688e202-0c96-4144-b415-cb16f315d478", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/mappings/3-o_h_t_external-group_467431.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/mappings/3-o_h_t_external-group_467431.json new file mode 100644 index 0000000000..5680cec01f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/mappings/3-o_h_t_external-group_467431.json @@ -0,0 +1,47 @@ +{ + "id": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "name": "orgs_hub4j-test-org_external-group_467431", + "request": { + "url": "/orgs/hub4j-test-org/external-group/467431", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-o_h_t_external-group_467431.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:06 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1582644475", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"631de12e6bc586863218257765331a70\"", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF8C:78624D:5E553201" + } + }, + "uuid": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/mappings/4-o_h_t_acme-developers_external-groups.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/mappings/4-o_h_t_acme-developers_external-groups.json new file mode 100644 index 0000000000..52522b211a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupByGroup/mappings/4-o_h_t_acme-developers_external-groups.json @@ -0,0 +1,53 @@ +{ + "id": "100fc073-1fdc-4715-94c1-fbf410d74da0", + "name": "orgs_hub4j-test-org_teams_acme-developers_external-groups", + "request": { + "url": "/orgs/hub4j-test-org/teams/acme-developers/external-groups", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"group_id\":467431}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "4-o_h_t_acme-developers_external-groups.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:37:00 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/\"1f1e7f72a8c1d013af016c2df9831d999124f580cd508cb53404fdd0981ef698\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4988", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "12", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F8:BF13:1A327EC:1B0A6BE:6221EBCC" + } + }, + "uuid": "100fc073-1fdc-4715-94c1-fbf410d74da0", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..162ceb1c73 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,55 @@ +{ + "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": 49, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization", + "total_private_repos": 3, + "owned_private_repos": 3, + "private_gists": 0, + "disk_usage": 11979, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "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, + "members_can_create_public_pages": true, + "members_can_create_private_pages": true, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 10000, + "filled_seats": 35, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/__files/2-o_h_t_acme-developers.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/__files/2-o_h_t_acme-developers.json new file mode 100644 index 0000000000..d79e7c6f1a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/__files/2-o_h_t_acme-developers.json @@ -0,0 +1,49 @@ +{ + "name": "ACME-DEVELOPERS", + "id": 34519919, + "node_id": "MDQ6VGVhbTM0NTE5OTY=", + "slug": "acme-developers", + "description": "Updated by API TestModified", + "privacy": "closed", + "url": "https://api.github.com/organizations/7544739/team/3451996", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/acme-developers", + "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", + "permission": "pull", + "created_at": "2019-10-03T21:46:12Z", + "updated_at": "2022-03-04T10:36:59Z", + "members_count": 1, + "repos_count": 1, + "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": 49, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/__files/3-o_h_t_acme-developers_external-groups.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/__files/3-o_h_t_acme-developers_external-groups.json new file mode 100644 index 0000000000..9c13f5dca4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/__files/3-o_h_t_acme-developers_external-groups.json @@ -0,0 +1,25 @@ +{ + "group_id": 467431, + "group_name": "acme-developers", + "updated_at": "2023-09-13T16:41:28Z", + "members": [ + { + "member_id": 158311279, + "member_login": "john-doe_acme", + "member_name": "John Doe", + "member_email": "john.doe@acme.corp" + }, + { + "member_id": 166731041, + "member_login": "jane-doe_acme", + "member_name": "Jane Doe", + "member_email": "jane.doe@acme.corp" + } + ], + "teams": [ + { + "team_id": 34519919, + "team_name": "ACME-DEVELOPERS" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..18868d99d1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,47 @@ +{ + "id": "780bda7a-e76d-4840-87e4-ba6411cfc9c2", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:36:59 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/\"861b38147d37bd59e507771e76ec048def20dd6e5ac5b75aceb01c8b9f0ef4f5\"", + "Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4990", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "10", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F4:5E65:1A3BC41:1AAFE9E:6221EBCB" + } + }, + "uuid": "780bda7a-e76d-4840-87e4-ba6411cfc9c2", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/mappings/2-o_h_t_acme-developers.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/mappings/2-o_h_t_acme-developers.json new file mode 100644 index 0000000000..1f5c8081f9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/mappings/2-o_h_t_acme-developers.json @@ -0,0 +1,47 @@ +{ + "id": "e688e202-0c96-4144-b415-cb16f315d478", + "name": "orgs_hub4j-test-org_teams_acme-developers", + "request": { + "url": "/orgs/hub4j-test-org/teams/acme-developers", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-o_h_t_acme-developers.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:37:00 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/\"1fbce0cbfea113fefff1877b37929ef1d7cb9c8989a5b223df3e9ea092502191\"", + "Last-Modified": "Fri, 04 Mar 2022 10:36:59 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4989", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "11", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F6:361D:2C7B93A:2D76BBD:6221EBCB" + } + }, + "uuid": "e688e202-0c96-4144-b415-cb16f315d478", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/mappings/3-o_h_t_acme-developers_external-groups.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/mappings/3-o_h_t_acme-developers_external-groups.json new file mode 100644 index 0000000000..9db0056a2f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testConnectToExternalGroupById/mappings/3-o_h_t_acme-developers_external-groups.json @@ -0,0 +1,53 @@ +{ + "id": "100fc073-1fdc-4715-94c1-fbf410d74da0", + "name": "orgs_hub4j-test-org_teams_acme-developers_external-groups", + "request": { + "url": "/orgs/hub4j-test-org/teams/acme-developers/external-groups", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"group_id\":467431}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "3-o_h_t_acme-developers_external-groups.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:37:00 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/\"1f1e7f72a8c1d013af016c2df9831d999124f580cd508cb53404fdd0981ef698\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4988", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "12", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F8:BF13:1A327EC:1B0A6BE:6221EBCC" + } + }, + "uuid": "100fc073-1fdc-4715-94c1-fbf410d74da0", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testDeleteExternalGroupConnection/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testDeleteExternalGroupConnection/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..162ceb1c73 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testDeleteExternalGroupConnection/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,55 @@ +{ + "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": 49, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization", + "total_private_repos": 3, + "owned_private_repos": 3, + "private_gists": 0, + "disk_usage": 11979, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "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, + "members_can_create_public_pages": true, + "members_can_create_private_pages": true, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 10000, + "filled_seats": 35, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testDeleteExternalGroupConnection/__files/2-o_h_t_acme-developers.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testDeleteExternalGroupConnection/__files/2-o_h_t_acme-developers.json new file mode 100644 index 0000000000..7642889a58 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testDeleteExternalGroupConnection/__files/2-o_h_t_acme-developers.json @@ -0,0 +1,49 @@ +{ + "name": "acme-developers", + "id": 34519961, + "node_id": "MDQ6VGVhbTM0NTE5OTY=", + "slug": "acme-developers", + "description": "Updated by API TestModified", + "privacy": "closed", + "url": "https://api.github.com/organizations/7544739/team/3451996", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/acme-developers", + "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", + "permission": "pull", + "created_at": "2019-10-03T21:46:12Z", + "updated_at": "2022-03-04T10:36:59Z", + "members_count": 1, + "repos_count": 1, + "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": 49, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testDeleteExternalGroupConnection/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testDeleteExternalGroupConnection/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..18868d99d1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testDeleteExternalGroupConnection/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,47 @@ +{ + "id": "780bda7a-e76d-4840-87e4-ba6411cfc9c2", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:36:59 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/\"861b38147d37bd59e507771e76ec048def20dd6e5ac5b75aceb01c8b9f0ef4f5\"", + "Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4990", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "10", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F4:5E65:1A3BC41:1AAFE9E:6221EBCB" + } + }, + "uuid": "780bda7a-e76d-4840-87e4-ba6411cfc9c2", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testDeleteExternalGroupConnection/mappings/2-o_h_t_acme-developers.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testDeleteExternalGroupConnection/mappings/2-o_h_t_acme-developers.json new file mode 100644 index 0000000000..1f5c8081f9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testDeleteExternalGroupConnection/mappings/2-o_h_t_acme-developers.json @@ -0,0 +1,47 @@ +{ + "id": "e688e202-0c96-4144-b415-cb16f315d478", + "name": "orgs_hub4j-test-org_teams_acme-developers", + "request": { + "url": "/orgs/hub4j-test-org/teams/acme-developers", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-o_h_t_acme-developers.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:37:00 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/\"1fbce0cbfea113fefff1877b37929ef1d7cb9c8989a5b223df3e9ea092502191\"", + "Last-Modified": "Fri, 04 Mar 2022 10:36:59 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4989", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "11", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F6:361D:2C7B93A:2D76BBD:6221EBCB" + } + }, + "uuid": "e688e202-0c96-4144-b415-cb16f315d478", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testDeleteExternalGroupConnection/mappings/3-o_h_t_acme-developers_external-groups.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testDeleteExternalGroupConnection/mappings/3-o_h_t_acme-developers_external-groups.json new file mode 100644 index 0000000000..bc87120395 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testDeleteExternalGroupConnection/mappings/3-o_h_t_acme-developers_external-groups.json @@ -0,0 +1,45 @@ +{ + "id": "100fc073-1fdc-4715-94c1-fbf410d74da0", + "name": "orgs_hub4j-test-org_teams_acme-developers_external-groups", + "request": { + "url": "/orgs/hub4j-test-org/teams/acme-developers/external-groups", + "method": "DELETE", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 204, + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:37:00 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/\"1f1e7f72a8c1d013af016c2df9831d999124f580cd508cb53404fdd0981ef698\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4988", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "12", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F8:BF13:1A327EC:1B0A6BE:6221EBCC" + } + }, + "uuid": "100fc073-1fdc-4715-94c1-fbf410d74da0", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..162ceb1c73 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,55 @@ +{ + "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": 49, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization", + "total_private_repos": 3, + "owned_private_repos": 3, + "private_gists": 0, + "disk_usage": 11979, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "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, + "members_can_create_public_pages": true, + "members_can_create_private_pages": true, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 10000, + "filled_seats": 35, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/__files/2-o_h_t_acme-developers.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/__files/2-o_h_t_acme-developers.json new file mode 100644 index 0000000000..d79e7c6f1a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/__files/2-o_h_t_acme-developers.json @@ -0,0 +1,49 @@ +{ + "name": "ACME-DEVELOPERS", + "id": 34519919, + "node_id": "MDQ6VGVhbTM0NTE5OTY=", + "slug": "acme-developers", + "description": "Updated by API TestModified", + "privacy": "closed", + "url": "https://api.github.com/organizations/7544739/team/3451996", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/acme-developers", + "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", + "permission": "pull", + "created_at": "2019-10-03T21:46:12Z", + "updated_at": "2022-03-04T10:36:59Z", + "members_count": 1, + "repos_count": 1, + "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": 49, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/__files/3-o_h_t_acme-developers_external-groups.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/__files/3-o_h_t_acme-developers_external-groups.json new file mode 100644 index 0000000000..8ba8e63db9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/__files/3-o_h_t_acme-developers_external-groups.json @@ -0,0 +1,4 @@ +{ + "message": "Not Found", + "documentation_url": "https://docs.github.com/rest/teams/external-groups#update-the-connection-between-an-external-group-and-a-team" +} diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..18868d99d1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,47 @@ +{ + "id": "780bda7a-e76d-4840-87e4-ba6411cfc9c2", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:36:59 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/\"861b38147d37bd59e507771e76ec048def20dd6e5ac5b75aceb01c8b9f0ef4f5\"", + "Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4990", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "10", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F4:5E65:1A3BC41:1AAFE9E:6221EBCB" + } + }, + "uuid": "780bda7a-e76d-4840-87e4-ba6411cfc9c2", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/mappings/2-o_h_t_acme-developers.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/mappings/2-o_h_t_acme-developers.json new file mode 100644 index 0000000000..1f5c8081f9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/mappings/2-o_h_t_acme-developers.json @@ -0,0 +1,47 @@ +{ + "id": "e688e202-0c96-4144-b415-cb16f315d478", + "name": "orgs_hub4j-test-org_teams_acme-developers", + "request": { + "url": "/orgs/hub4j-test-org/teams/acme-developers", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-o_h_t_acme-developers.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:37:00 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/\"1fbce0cbfea113fefff1877b37929ef1d7cb9c8989a5b223df3e9ea092502191\"", + "Last-Modified": "Fri, 04 Mar 2022 10:36:59 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4989", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "11", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F6:361D:2C7B93A:2D76BBD:6221EBCB" + } + }, + "uuid": "e688e202-0c96-4144-b415-cb16f315d478", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/mappings/3-o_h_t_acme-developers_external-groups.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/mappings/3-o_h_t_acme-developers_external-groups.json new file mode 100644 index 0000000000..40b4774fa6 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupTeamIsNotAvailableInOrg/mappings/3-o_h_t_acme-developers_external-groups.json @@ -0,0 +1,53 @@ +{ + "id": "100fc073-1fdc-4715-94c1-fbf410d74da0", + "name": "orgs_hub4j-test-org_teams_acme-developers_external-groups", + "request": { + "url": "/orgs/hub4j-test-org/teams/acme-developers/external-groups", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"group_id\":12345}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 404, + "bodyFileName": "3-o_h_t_acme-developers_external-groups.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:37:00 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/\"1f1e7f72a8c1d013af016c2df9831d999124f580cd508cb53404fdd0981ef698\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4988", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "12", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F8:BF13:1A327EC:1B0A6BE:6221EBCC" + } + }, + "uuid": "100fc073-1fdc-4715-94c1-fbf410d74da0", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..162ceb1c73 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,55 @@ +{ + "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": 49, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization", + "total_private_repos": 3, + "owned_private_repos": 3, + "private_gists": 0, + "disk_usage": 11979, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "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, + "members_can_create_public_pages": true, + "members_can_create_private_pages": true, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 10000, + "filled_seats": 35, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/__files/2-o_h_t_acme-developers.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/__files/2-o_h_t_acme-developers.json new file mode 100644 index 0000000000..d79e7c6f1a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/__files/2-o_h_t_acme-developers.json @@ -0,0 +1,49 @@ +{ + "name": "ACME-DEVELOPERS", + "id": 34519919, + "node_id": "MDQ6VGVhbTM0NTE5OTY=", + "slug": "acme-developers", + "description": "Updated by API TestModified", + "privacy": "closed", + "url": "https://api.github.com/organizations/7544739/team/3451996", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/acme-developers", + "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", + "permission": "pull", + "created_at": "2019-10-03T21:46:12Z", + "updated_at": "2022-03-04T10:36:59Z", + "members_count": 1, + "repos_count": 1, + "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": 49, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/__files/3-o_h_t_acme-developers_external-groups.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/__files/3-o_h_t_acme-developers_external-groups.json new file mode 100644 index 0000000000..16b477dd1e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/__files/3-o_h_t_acme-developers_external-groups.json @@ -0,0 +1,4 @@ +{ + "message": "This team cannot be externally managed since it has explicit members.", + "documentation_url": "https://docs.github.com/rest/teams/external-groups#list-a-connection-between-an-external-group-and-a-team" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..18868d99d1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,47 @@ +{ + "id": "780bda7a-e76d-4840-87e4-ba6411cfc9c2", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:36:59 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/\"861b38147d37bd59e507771e76ec048def20dd6e5ac5b75aceb01c8b9f0ef4f5\"", + "Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4990", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "10", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F4:5E65:1A3BC41:1AAFE9E:6221EBCB" + } + }, + "uuid": "780bda7a-e76d-4840-87e4-ba6411cfc9c2", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/mappings/2-o_h_t_acme-developers.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/mappings/2-o_h_t_acme-developers.json new file mode 100644 index 0000000000..1f5c8081f9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/mappings/2-o_h_t_acme-developers.json @@ -0,0 +1,47 @@ +{ + "id": "e688e202-0c96-4144-b415-cb16f315d478", + "name": "orgs_hub4j-test-org_teams_acme-developers", + "request": { + "url": "/orgs/hub4j-test-org/teams/acme-developers", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-o_h_t_acme-developers.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:37:00 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/\"1fbce0cbfea113fefff1877b37929ef1d7cb9c8989a5b223df3e9ea092502191\"", + "Last-Modified": "Fri, 04 Mar 2022 10:36:59 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4989", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "11", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F6:361D:2C7B93A:2D76BBD:6221EBCB" + } + }, + "uuid": "e688e202-0c96-4144-b415-cb16f315d478", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/mappings/3-o_h_t_acme-developers_external-groups.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/mappings/3-o_h_t_acme-developers_external-groups.json new file mode 100644 index 0000000000..1ee400391e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testFailConnectToExternalGroupWhenTeamHasMembers/mappings/3-o_h_t_acme-developers_external-groups.json @@ -0,0 +1,53 @@ +{ + "id": "100fc073-1fdc-4715-94c1-fbf410d74da0", + "name": "orgs_hub4j-test-org_teams_acme-developers_external-groups", + "request": { + "url": "/orgs/hub4j-test-org/teams/acme-developers/external-groups", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"group_id\":467431}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 400, + "bodyFileName": "3-o_h_t_acme-developers_external-groups.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:37:00 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/\"1f1e7f72a8c1d013af016c2df9831d999124f580cd508cb53404fdd0981ef698\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4988", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "12", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F8:BF13:1A327EC:1B0A6BE:6221EBCC" + } + }, + "uuid": "100fc073-1fdc-4715-94c1-fbf410d74da0", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..162ceb1c73 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,55 @@ +{ + "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": 49, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization", + "total_private_repos": 3, + "owned_private_repos": 3, + "private_gists": 0, + "disk_usage": 11979, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "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, + "members_can_create_public_pages": true, + "members_can_create_private_pages": true, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 10000, + "filled_seats": 35, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/__files/2-o_h_t_acme-developers.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/__files/2-o_h_t_acme-developers.json new file mode 100644 index 0000000000..7642889a58 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/__files/2-o_h_t_acme-developers.json @@ -0,0 +1,49 @@ +{ + "name": "acme-developers", + "id": 34519961, + "node_id": "MDQ6VGVhbTM0NTE5OTY=", + "slug": "acme-developers", + "description": "Updated by API TestModified", + "privacy": "closed", + "url": "https://api.github.com/organizations/7544739/team/3451996", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/acme-developers", + "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", + "permission": "pull", + "created_at": "2019-10-03T21:46:12Z", + "updated_at": "2022-03-04T10:36:59Z", + "members_count": 1, + "repos_count": 1, + "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": 49, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/__files/3-o_h_t_acme-developers_external-groups.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/__files/3-o_h_t_acme-developers_external-groups.json new file mode 100644 index 0000000000..09e99b6517 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/__files/3-o_h_t_acme-developers_external-groups.json @@ -0,0 +1,9 @@ +{ + "groups": [ + { + "group_id": 467431, + "group_name": "acme-developers", + "updated_at": "2023-09-13T16:41:28Z" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..18868d99d1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,47 @@ +{ + "id": "780bda7a-e76d-4840-87e4-ba6411cfc9c2", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:36:59 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/\"861b38147d37bd59e507771e76ec048def20dd6e5ac5b75aceb01c8b9f0ef4f5\"", + "Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4990", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "10", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F4:5E65:1A3BC41:1AAFE9E:6221EBCB" + } + }, + "uuid": "780bda7a-e76d-4840-87e4-ba6411cfc9c2", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/mappings/2-o_h_t_acme-developers.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/mappings/2-o_h_t_acme-developers.json new file mode 100644 index 0000000000..1f5c8081f9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/mappings/2-o_h_t_acme-developers.json @@ -0,0 +1,47 @@ +{ + "id": "e688e202-0c96-4144-b415-cb16f315d478", + "name": "orgs_hub4j-test-org_teams_acme-developers", + "request": { + "url": "/orgs/hub4j-test-org/teams/acme-developers", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-o_h_t_acme-developers.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:37:00 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/\"1fbce0cbfea113fefff1877b37929ef1d7cb9c8989a5b223df3e9ea092502191\"", + "Last-Modified": "Fri, 04 Mar 2022 10:36:59 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4989", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "11", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F6:361D:2C7B93A:2D76BBD:6221EBCB" + } + }, + "uuid": "e688e202-0c96-4144-b415-cb16f315d478", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/mappings/3-o_h_t_acme-developers_external-groups.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/mappings/3-o_h_t_acme-developers_external-groups.json new file mode 100644 index 0000000000..e379c1a50a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroups/mappings/3-o_h_t_acme-developers_external-groups.json @@ -0,0 +1,46 @@ +{ + "id": "100fc073-1fdc-4715-94c1-fbf410d74da0", + "name": "orgs_hub4j-test-org_teams_acme-developers_external-groups", + "request": { + "url": "/orgs/hub4j-test-org/teams/acme-developers/external-groups", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-o_h_t_acme-developers_external-groups.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:37:00 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/\"1f1e7f72a8c1d013af016c2df9831d999124f580cd508cb53404fdd0981ef698\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4988", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "12", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F8:BF13:1A327EC:1B0A6BE:6221EBCC" + } + }, + "uuid": "100fc073-1fdc-4715-94c1-fbf410d74da0", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..162ceb1c73 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,55 @@ +{ + "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": 49, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization", + "total_private_repos": 3, + "owned_private_repos": 3, + "private_gists": 0, + "disk_usage": 11979, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "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, + "members_can_create_public_pages": true, + "members_can_create_private_pages": true, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 10000, + "filled_seats": 35, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/__files/2-o_h_t_acme-developers.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/__files/2-o_h_t_acme-developers.json new file mode 100644 index 0000000000..7642889a58 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/__files/2-o_h_t_acme-developers.json @@ -0,0 +1,49 @@ +{ + "name": "acme-developers", + "id": 34519961, + "node_id": "MDQ6VGVhbTM0NTE5OTY=", + "slug": "acme-developers", + "description": "Updated by API TestModified", + "privacy": "closed", + "url": "https://api.github.com/organizations/7544739/team/3451996", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/acme-developers", + "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", + "permission": "pull", + "created_at": "2019-10-03T21:46:12Z", + "updated_at": "2022-03-04T10:36:59Z", + "members_count": 1, + "repos_count": 1, + "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": 49, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/__files/3-o_h_t_acme-developers_external-groups.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/__files/3-o_h_t_acme-developers_external-groups.json new file mode 100644 index 0000000000..b1569e2099 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/__files/3-o_h_t_acme-developers_external-groups.json @@ -0,0 +1,4 @@ +{ + "message": "This organization is not part of externally managed enterprise.", + "documentation_url": "https://docs.github.com/rest/teams/external-groups#list-a-connection-between-an-external-group-and-a-team" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..18868d99d1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,47 @@ +{ + "id": "780bda7a-e76d-4840-87e4-ba6411cfc9c2", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:36:59 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/\"861b38147d37bd59e507771e76ec048def20dd6e5ac5b75aceb01c8b9f0ef4f5\"", + "Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4990", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "10", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F4:5E65:1A3BC41:1AAFE9E:6221EBCB" + } + }, + "uuid": "780bda7a-e76d-4840-87e4-ba6411cfc9c2", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/mappings/2-o_h_t_acme-developers.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/mappings/2-o_h_t_acme-developers.json new file mode 100644 index 0000000000..1f5c8081f9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/mappings/2-o_h_t_acme-developers.json @@ -0,0 +1,47 @@ +{ + "id": "e688e202-0c96-4144-b415-cb16f315d478", + "name": "orgs_hub4j-test-org_teams_acme-developers", + "request": { + "url": "/orgs/hub4j-test-org/teams/acme-developers", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-o_h_t_acme-developers.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:37:00 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/\"1fbce0cbfea113fefff1877b37929ef1d7cb9c8989a5b223df3e9ea092502191\"", + "Last-Modified": "Fri, 04 Mar 2022 10:36:59 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4989", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "11", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F6:361D:2C7B93A:2D76BBD:6221EBCB" + } + }, + "uuid": "e688e202-0c96-4144-b415-cb16f315d478", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/mappings/3-o_h_t_acme-developers_external-groups.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/mappings/3-o_h_t_acme-developers_external-groups.json new file mode 100644 index 0000000000..cffbfcabb5 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsNotEnterpriseManagedOrganization/mappings/3-o_h_t_acme-developers_external-groups.json @@ -0,0 +1,46 @@ +{ + "id": "100fc073-1fdc-4715-94c1-fbf410d74da0", + "name": "orgs_hub4j-test-org_teams_acme-developers_external-groups", + "request": { + "url": "/orgs/hub4j-test-org/teams/acme-developers/external-groups", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 400, + "bodyFileName": "3-o_h_t_acme-developers_external-groups.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:37:00 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/\"1f1e7f72a8c1d013af016c2df9831d999124f580cd508cb53404fdd0981ef698\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4988", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "12", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F8:BF13:1A327EC:1B0A6BE:6221EBCC" + } + }, + "uuid": "100fc073-1fdc-4715-94c1-fbf410d74da0", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/__files/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/__files/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..162ceb1c73 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/__files/1-orgs_hub4j-test-org.json @@ -0,0 +1,55 @@ +{ + "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": 49, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization", + "total_private_repos": 3, + "owned_private_repos": 3, + "private_gists": 0, + "disk_usage": 11979, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "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, + "members_can_create_public_pages": true, + "members_can_create_private_pages": true, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 10000, + "filled_seats": 35, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/__files/2-o_h_t_acme-developers.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/__files/2-o_h_t_acme-developers.json new file mode 100644 index 0000000000..7642889a58 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/__files/2-o_h_t_acme-developers.json @@ -0,0 +1,49 @@ +{ + "name": "acme-developers", + "id": 34519961, + "node_id": "MDQ6VGVhbTM0NTE5OTY=", + "slug": "acme-developers", + "description": "Updated by API TestModified", + "privacy": "closed", + "url": "https://api.github.com/organizations/7544739/team/3451996", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/acme-developers", + "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", + "permission": "pull", + "created_at": "2019-10-03T21:46:12Z", + "updated_at": "2022-03-04T10:36:59Z", + "members_count": 1, + "repos_count": 1, + "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": 49, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/__files/3-o_h_t_acme-developers_external-groups.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/__files/3-o_h_t_acme-developers_external-groups.json new file mode 100644 index 0000000000..16b477dd1e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/__files/3-o_h_t_acme-developers_external-groups.json @@ -0,0 +1,4 @@ +{ + "message": "This team cannot be externally managed since it has explicit members.", + "documentation_url": "https://docs.github.com/rest/teams/external-groups#list-a-connection-between-an-external-group-and-a-team" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/mappings/1-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/mappings/1-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..18868d99d1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/mappings/1-orgs_hub4j-test-org.json @@ -0,0 +1,47 @@ +{ + "id": "780bda7a-e76d-4840-87e4-ba6411cfc9c2", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-orgs_hub4j-test-org.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:36:59 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/\"861b38147d37bd59e507771e76ec048def20dd6e5ac5b75aceb01c8b9f0ef4f5\"", + "Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4990", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "10", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F4:5E65:1A3BC41:1AAFE9E:6221EBCB" + } + }, + "uuid": "780bda7a-e76d-4840-87e4-ba6411cfc9c2", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/mappings/2-o_h_t_acme-developers.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/mappings/2-o_h_t_acme-developers.json new file mode 100644 index 0000000000..1f5c8081f9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/mappings/2-o_h_t_acme-developers.json @@ -0,0 +1,47 @@ +{ + "id": "e688e202-0c96-4144-b415-cb16f315d478", + "name": "orgs_hub4j-test-org_teams_acme-developers", + "request": { + "url": "/orgs/hub4j-test-org/teams/acme-developers", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-o_h_t_acme-developers.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:37:00 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/\"1fbce0cbfea113fefff1877b37929ef1d7cb9c8989a5b223df3e9ea092502191\"", + "Last-Modified": "Fri, 04 Mar 2022 10:36:59 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4989", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "11", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F6:361D:2C7B93A:2D76BBD:6221EBCB" + } + }, + "uuid": "e688e202-0c96-4144-b415-cb16f315d478", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/mappings/3-o_h_t_acme-developers_external-groups.json b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/mappings/3-o_h_t_acme-developers_external-groups.json new file mode 100644 index 0000000000..cffbfcabb5 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHTeamTest/wiremock/testGetExternalGroupsTeamCannotBeExternallyManaged/mappings/3-o_h_t_acme-developers_external-groups.json @@ -0,0 +1,46 @@ +{ + "id": "100fc073-1fdc-4715-94c1-fbf410d74da0", + "name": "orgs_hub4j-test-org_teams_acme-developers_external-groups", + "request": { + "url": "/orgs/hub4j-test-org/teams/acme-developers/external-groups", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 400, + "bodyFileName": "3-o_h_t_acme-developers_external-groups.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 04 Mar 2022 10:37:00 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/\"1f1e7f72a8c1d013af016c2df9831d999124f580cd508cb53404fdd0981ef698\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4988", + "X-RateLimit-Reset": "1646393817", + "X-RateLimit-Used": "12", + "X-RateLimit-Resource": "core", + "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'", + "X-GitHub-Request-Id": "B9F8:BF13:1A327EC:1B0A6BE:6221EBCC" + } + }, + "uuid": "100fc073-1fdc-4715-94c1-fbf410d74da0", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file