diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1bc6f8e604..74615e5f12 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,12 +1,14 @@ version: 2 updates: - - package-ecosystem: "maven" - directory: "/" - schedule: - interval: "monthly" - time: "02:00" - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "monthly" - time: "02:00" +- package-ecosystem: "maven" + directory: "/" + rebase-strategy: "disabled" + schedule: + interval: "monthly" + time: "02:00" +- package-ecosystem: "github-actions" + directory: "/" + rebase-strategy: "disabled" + schedule: + interval: "monthly" + time: "02:00" diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index cd59239a8a..4f8a2115e9 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -76,7 +76,7 @@ jobs: - name: Maven Install with Code Coverage run: mvn -B clean install -D enable-ci -Djapicmp.skip --file pom.xml - name: Codecov Report - uses: codecov/codecov-action@v3.1.0 + uses: codecov/codecov-action@v3.1.1 test: name: test (${{ matrix.os }}, Java ${{ matrix.java }}) runs-on: ${{ matrix.os }}-latest diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5192c47bb8..5b52f26a8b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -82,7 +82,7 @@ When modifying existing tests, you can change the stubbed WireMock data files by #### Manual editing of data (minor changes only) If you know what data will change, it is sometimes simplest to make any required changes to the data files manually. -This can be easier if the changes are minor or when you development environment is not setup to to take updated snapshots. +This can be easier if the changes are minor or when you development environment is not setup to take updated snapshots. #### Generating a new snapshot diff --git a/pom.xml b/pom.xml index 9682964cbb..1f13a867c7 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.kohsuke github-api - 1.312-SNAPSHOT + 1.314-SNAPSHOT GitHub API for Java https://github-api.kohsuke.org/ GitHub API for Java @@ -33,8 +33,8 @@ UTF-8 - 4.7.1.1 - 4.7.1 + 4.7.3.0 + 4.7.3 true 2.2 4.9.2 @@ -278,12 +278,12 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 3.4.1 + 3.4.2 org.apache.bcel bcel - 6.5.0 + 6.6.1 @@ -333,7 +333,7 @@ com.diffplug.spotless spotless-maven-plugin - 2.25.0 + 2.27.2 spotless-check @@ -468,7 +468,7 @@ com.fasterxml.jackson.core jackson-databind - 2.13.3 + 2.14.0 commons-io @@ -485,7 +485,7 @@ commons-fileupload commons-fileupload - 1.4 + 1.5 test @@ -511,7 +511,7 @@ org.eclipse.jgit org.eclipse.jgit - 6.1.0.202203080745-r + 6.4.0.202211300538-r test @@ -567,7 +567,7 @@ org.mockito mockito-core - 4.7.0 + 4.11.0 test @@ -579,19 +579,19 @@ com.github.tomakehurst wiremock-jre8-standalone - 2.32.0 + 2.35.0 test com.google.code.gson gson - 2.9.1 + 2.10 test org.slf4j slf4j-simple - 1.7.36 + 2.0.3 test @@ -817,7 +817,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.2.2 + 3.3.0 diff --git a/src/main/java/org/kohsuke/github/GHCommit.java b/src/main/java/org/kohsuke/github/GHCommit.java index abd8c73900..56fc0125a8 100644 --- a/src/main/java/org/kohsuke/github/GHCommit.java +++ b/src/main/java/org/kohsuke/github/GHCommit.java @@ -125,7 +125,7 @@ public static class Stats { /** * A file that was modified. */ - @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "It's being initilized by JSON deserialization") + @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "It's being initialized by JSON deserialization") public static class File { /** The status. */ diff --git a/src/main/java/org/kohsuke/github/GHCompare.java b/src/main/java/org/kohsuke/github/GHCompare.java index 00273fa224..33678abfc6 100644 --- a/src/main/java/org/kohsuke/github/GHCompare.java +++ b/src/main/java/org/kohsuke/github/GHCompare.java @@ -224,8 +224,8 @@ GHCompare lateBind(GHRepository owner) { } /** - * Compare commits had a child commit element with additional details we want to capture. This extenstion of - * GHCommit provides that. + * Compare commits had a child commit element with additional details we want to capture. This extension of GHCommit + * provides that. */ @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD" }, justification = "JSON API") diff --git a/src/main/java/org/kohsuke/github/GHEventPayload.java b/src/main/java/org/kohsuke/github/GHEventPayload.java index 41ea636aac..b6549faadd 100644 --- a/src/main/java/org/kohsuke/github/GHEventPayload.java +++ b/src/main/java/org/kohsuke/github/GHEventPayload.java @@ -1043,6 +1043,7 @@ public static class Push extends GHEventPayload { private String ref; private int size; private List commits; + private PushCommit headCommit; private Pusher pusher; private String compare; @@ -1124,6 +1125,16 @@ public List getCommits() { return Collections.unmodifiableList(commits); } + /** + * The head commit of the push. + * + * @return the commit + */ + @SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected") + public PushCommit getHeadCommit() { + return headCommit; + } + /** * Gets pusher. * diff --git a/src/main/java/org/kohsuke/github/GHFileNotFoundException.java b/src/main/java/org/kohsuke/github/GHFileNotFoundException.java index 3420a2799b..4de844e0ae 100644 --- a/src/main/java/org/kohsuke/github/GHFileNotFoundException.java +++ b/src/main/java/org/kohsuke/github/GHFileNotFoundException.java @@ -10,7 +10,7 @@ // TODO: Auto-generated Javadoc /** - * Request/responce contains useful metadata. Custom exception allows store info for next diagnostics. + * Request/response contains useful metadata. Custom exception allows store info for next diagnostics. * * @author Kanstantsin Shautsou */ diff --git a/src/main/java/org/kohsuke/github/GHIOException.java b/src/main/java/org/kohsuke/github/GHIOException.java index e26e19fadd..2654e845ab 100644 --- a/src/main/java/org/kohsuke/github/GHIOException.java +++ b/src/main/java/org/kohsuke/github/GHIOException.java @@ -10,7 +10,7 @@ // TODO: Auto-generated Javadoc /** - * Request/responce contains useful metadata. Custom exception allows store info for next diagnostics. + * Request/response contains useful metadata. Custom exception allows store info for next diagnostics. * * @author Kanstantsin Shautsou */ diff --git a/src/main/java/org/kohsuke/github/GHIssue.java b/src/main/java/org/kohsuke/github/GHIssue.java index 741fd73c3d..9d6027f331 100644 --- a/src/main/java/org/kohsuke/github/GHIssue.java +++ b/src/main/java/org/kohsuke/github/GHIssue.java @@ -517,7 +517,7 @@ public List getComments() throws IOException { } /** - * Obtains all the comments associated with this issue, witout any filter. + * Obtains all the comments associated with this issue, without any filter. * * @return the paged iterable * @throws IOException diff --git a/src/main/java/org/kohsuke/github/GHMyself.java b/src/main/java/org/kohsuke/github/GHMyself.java index ea02e83a0d..ea3dd5f3d7 100644 --- a/src/main/java/org/kohsuke/github/GHMyself.java +++ b/src/main/java/org/kohsuke/github/GHMyself.java @@ -70,9 +70,9 @@ public List getEmails2() throws IOException { } /** - * Returns the read-only list of all the pulic keys of the current user. + * Returns the read-only list of all the public keys of the current user. *

- * NOTE: When using OAuth authenticaiton, the READ/WRITE User scope is required by the GitHub APIs, otherwise you + * NOTE: When using OAuth authentication, the READ/WRITE User scope is required by the GitHub APIs, otherwise you * will get a 404 NOT FOUND. * * @return Always non-null. diff --git a/src/main/java/org/kohsuke/github/GHOrganization.java b/src/main/java/org/kohsuke/github/GHOrganization.java index 9b0b901d33..0d881aff61 100644 --- a/src/main/java/org/kohsuke/github/GHOrganization.java +++ b/src/main/java/org/kohsuke/github/GHOrganization.java @@ -315,6 +315,17 @@ public PagedIterable listPublicMembers() throws IOException { return listMembers("public_members"); } + /** + * All the outside collaborators of this organization. + * + * @return the paged iterable + * @throws IOException + * the io exception + */ + public PagedIterable listOutsideCollaborators() throws IOException { + return listMembers("outside_collaborators"); + } + private PagedIterable listMembers(String suffix) throws IOException { return listMembers(suffix, null, null); } @@ -332,6 +343,19 @@ public PagedIterable listMembersWithFilter(String filter) throws IOExcep return listMembers("members", filter, null); } + /** + * List outside collaborators with filter paged iterable. + * + * @param filter + * the filter + * @return the paged iterable + * @throws IOException + * the io exception + */ + public PagedIterable listOutsideCollaboratorsWithFilter(String filter) throws IOException { + return listMembers("outside_collaborators", filter, null); + } + /** * List members with specified role paged iterable. * @@ -631,7 +655,7 @@ public List getRepositoriesWithOpenPullRequests() throws IOExcepti } /** - * Gets all the open pull requests in this organizataion. + * Gets all the open pull requests in this organization. * * @return the pull requests * @throws IOException diff --git a/src/main/java/org/kohsuke/github/GHRateLimit.java b/src/main/java/org/kohsuke/github/GHRateLimit.java index 8b38e0ccd9..84c9345e77 100644 --- a/src/main/java/org/kohsuke/github/GHRateLimit.java +++ b/src/main/java/org/kohsuke/github/GHRateLimit.java @@ -347,7 +347,7 @@ Record getRecord(@Nonnull RateLimitTarget rateLimitTarget) { } /** - * A limit record used as a placeholder when the the actual limit is not known. + * A limit record used as a placeholder when the actual limit is not known. * * @since 1.100 */ @@ -528,7 +528,7 @@ && getRemaining() <= other.getRemaining())) { } else if (!(other instanceof UnknownLimitRecord)) { // If the above is not the case that means other has a later reset // or the same resent and fewer requests remaining. - // If the other record is not an unknown record, the the other is more recent + // If the other record is not an unknown record, the other is more recent return other; } else if (this.isExpired() && !other.isExpired()) { // The other is an unknown record. diff --git a/src/main/java/org/kohsuke/github/GHRef.java b/src/main/java/org/kohsuke/github/GHRef.java index 47de0cf9a7..429dcfbf0a 100644 --- a/src/main/java/org/kohsuke/github/GHRef.java +++ b/src/main/java/org/kohsuke/github/GHRef.java @@ -85,7 +85,7 @@ public void delete() throws IOException { } /** - * Retrive a ref of the given type for the current GitHub repository. + * Retrieve a ref of the given type for the current GitHub repository. * * @param repository * the repository to read from diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index fa5db64beb..4e41822eb0 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -1891,7 +1891,7 @@ public GHCompare getCompare(GHBranch id1, GHBranch id2) throws IOException { /** * Retrieves all refs for the github repository. * - * @return an array of GHRef elements coresponding with the refs in the remote repository. + * @return an array of GHRef elements corresponding with the refs in the remote repository. * @throws IOException * on failure communicating with GitHub */ @@ -1937,7 +1937,7 @@ public PagedIterable listRefs(String refType) throws IOException { } /** - * Retrive a ref of the given type for the current GitHub repository. + * Retrieve a ref of the given type for the current GitHub repository. * * @param refName * eg: heads/branch @@ -1964,7 +1964,7 @@ public GHTagObject getTagObject(String sha) throws IOException { } /** - * Retrive a tree of the given type for the current GitHub repository. + * Retrieve a tree of the given type for the current GitHub repository. * * @param sha * sha number or branch name ex: "main" @@ -2210,6 +2210,29 @@ public PagedIterable getCheckRuns(String ref) throws IOException { return new GHCheckRunsIterable(this, request); } + /** + * Gets check runs for given ref which validate provided parameters + * + * @param ref + * the Git reference + * @param params + * a map of parameters to filter check runs + * @return check runs for the given ref + * @throws IOException + * the io exception + * @see List check runs + * for a specific ref + */ + @Preview(ANTIOPE) + public PagedIterable getCheckRuns(String ref, Map params) throws IOException { + GitHubRequest request = root().createRequest() + .withUrlPath(String.format("/repos/%s/%s/commits/%s/check-runs", getOwnerName(), name, ref)) + .with(params) + .withPreview(ANTIOPE) + .build(); + return new GHCheckRunsIterable(this, request); + } + /** * Creates a commit status. * @@ -2222,7 +2245,7 @@ public PagedIterable getCheckRuns(String ref) throws IOException { * @param description * Optional short description. * @param context - * Optinal commit status context. + * Optional commit status context. * @return the gh commit status * @throws IOException * the io exception diff --git a/src/main/java/org/kohsuke/github/GHTree.java b/src/main/java/org/kohsuke/github/GHTree.java index 33b084fac3..6a2be8a55e 100644 --- a/src/main/java/org/kohsuke/github/GHTree.java +++ b/src/main/java/org/kohsuke/github/GHTree.java @@ -61,7 +61,7 @@ public GHTreeEntry getEntry(String path) { /** * Returns true if the number of items in the tree array exceeded the GitHub maximum limit. * - * @return true true if the number of items in the tree array exceeded the GitHub maximum limit otherwise false. + * @return true if the number of items in the tree array exceeded the GitHub maximum limit otherwise false. */ public boolean isTruncated() { return truncated; diff --git a/src/main/java/org/kohsuke/github/GHVerification.java b/src/main/java/org/kohsuke/github/GHVerification.java index a38ad958d2..382d39a26e 100644 --- a/src/main/java/org/kohsuke/github/GHVerification.java +++ b/src/main/java/org/kohsuke/github/GHVerification.java @@ -9,9 +9,9 @@ * * @author Sourabh Sarvotham Parkala * @see tags signature - * verificatiion + * verification * @see commits signature - * verificatiion + * verification */ @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" }, justification = "JSON API") @@ -32,7 +32,7 @@ public boolean isVerified() { /** * Gets reason for verification value. * - * @return return reason of type {@link Reason}, such as "valid" or "unsigned". The possible values can be found in + * @return reason of type {@link Reason}, such as "valid" or "unsigned". The possible values can be found in * {@link Reason}} */ public Reason getReason() { diff --git a/src/main/java/org/kohsuke/github/GitHubClient.java b/src/main/java/org/kohsuke/github/GitHubClient.java index 73491d148d..1011a0a9bf 100644 --- a/src/main/java/org/kohsuke/github/GitHubClient.java +++ b/src/main/java/org/kohsuke/github/GitHubClient.java @@ -430,6 +430,7 @@ public GitHubResponse sendRequest(GitHubRequest request, @CheckForNull Bo logRequest(connectorRequest); rateLimitChecker.checkRateLimit(this, request.rateLimitTarget()); connectorResponse = connector.send(connectorRequest); + logResponse(connectorResponse); noteRateLimit(request.rateLimitTarget(), connectorResponse); detectKnownErrors(connectorResponse, request, handler != null); return createResponse(connectorResponse, handler); @@ -520,8 +521,23 @@ private GitHubConnectorRequest prepareConnectorRequest(GitHubRequest request) th private void logRequest(@Nonnull final GitHubConnectorRequest request) { LOGGER.log(FINE, - () -> "GitHub API request [" + (getLogin() == null ? "anonymous" : getLogin()) + "]: " - + request.method() + " " + request.url().toString()); + () -> String.format("(%s) GitHub API request [%s]: %s", + Integer.toHexString(request.hashCode()), + (getLogin() == null ? "anonymous" : getLogin()), + (request.method() + " " + request.url().toString()))); + } + + private void logResponse(@Nonnull final GitHubConnectorResponse response) { + LOGGER.log(FINE, () -> { + try { + return String.format("(%s) GitHub API response [%s]: %s", + Integer.toHexString(response.request().hashCode()), + (getLogin() == null ? "anonymous" : getLogin()), + (response.statusCode() + " " + GitHubResponse.getBodyAsString(response))); + } catch (IOException e) { + throw new RuntimeException(e); + } + }); } @Nonnull diff --git a/src/main/java/org/kohsuke/github/GitHubRequest.java b/src/main/java/org/kohsuke/github/GitHubRequest.java index 14641125b1..058f4d3b47 100644 --- a/src/main/java/org/kohsuke/github/GitHubRequest.java +++ b/src/main/java/org/kohsuke/github/GitHubRequest.java @@ -228,7 +228,7 @@ public String urlPath() { } /** - * The content type to to be sent by this request. + * The content type to be sent by this request. * * @return the content type. */ @@ -262,7 +262,7 @@ public URL url() { /** * Whether arguments for this request should be included in the URL or in the body of the request. * - * @return true if the arguements should be sent in the body of the request. + * @return true if the arguments should be sent in the body of the request. */ @Override public boolean hasBody() { diff --git a/src/main/java/org/kohsuke/github/example/dataobject/ReadOnlyObjects.java b/src/main/java/org/kohsuke/github/example/dataobject/ReadOnlyObjects.java index cc1432085a..fb6a517fdf 100644 --- a/src/main/java/org/kohsuke/github/example/dataobject/ReadOnlyObjects.java +++ b/src/main/java/org/kohsuke/github/example/dataobject/ReadOnlyObjects.java @@ -94,7 +94,7 @@ public interface GHMetaExample { *

    *
  • Easy to create
  • *
  • Not much code
  • - *
  • Mininal annotations
  • + *
  • Minimal annotations
  • *
* Con: *
    @@ -373,7 +373,7 @@ void setImporter(List importer) { *
      *
    • Very Easy to create
    • *
    • Minimal code
    • - *
    • Mininal annotations
    • + *
    • Minimal annotations
    • *
    • Fields effectively final and lists unmodifiable
    • *
    * Con: diff --git a/src/main/java/org/kohsuke/github/extras/authorization/JWTTokenProvider.java b/src/main/java/org/kohsuke/github/extras/authorization/JWTTokenProvider.java index dc61cfd46c..11cda833b3 100644 --- a/src/main/java/org/kohsuke/github/extras/authorization/JWTTokenProvider.java +++ b/src/main/java/org/kohsuke/github/extras/authorization/JWTTokenProvider.java @@ -122,7 +122,7 @@ public String getEncodedAuthorization() throws IOException { *

    * Made internal for testing * - * @return false if the the token has been refreshed within the required window, otherwise true + * @return false if the token has been refreshed within the required window, otherwise true */ boolean isNotValid() { return Instant.now().isAfter(validUntil); diff --git a/src/main/java/org/kohsuke/github/internal/GitHubConnectorHttpConnectorAdapter.java b/src/main/java/org/kohsuke/github/internal/GitHubConnectorHttpConnectorAdapter.java index 01417e08dd..3dc0e9d7b0 100644 --- a/src/main/java/org/kohsuke/github/internal/GitHubConnectorHttpConnectorAdapter.java +++ b/src/main/java/org/kohsuke/github/internal/GitHubConnectorHttpConnectorAdapter.java @@ -83,7 +83,7 @@ public GitHubConnectorResponse send(GitHubConnectorRequest request) throws IOExc } // HttpUrlConnection is nuts. This call opens the connection and gets a response. - // Putting this on it's own line for ease of debugging if needed. + // Putting this on its own line for ease of debugging if needed. int statusCode = connection.getResponseCode(); Map> headers = connection.getHeaderFields(); diff --git a/src/site/apt/index.apt b/src/site/apt/index.apt index 2463ad1e16..4991e7caa4 100644 --- a/src/site/apt/index.apt +++ b/src/site/apt/index.apt @@ -142,7 +142,7 @@ Pluggable HTTP client through <<>>. In particular, this means you can use {{{https://square.github.io/okhttp/}OkHttp}}, so we can make use of it's HTTP response cache. Making a conditional request against the GitHub API and receiving a 304 response - {{{https://developer.github.com/v3/#conditional-requests}does not count against the rate limit}}. + {{{https://docs.github.com/en/rest/overview/resources-in-the-rest-api#conditional-requests}does not count against the rate limit}}. The following code shows an example of how to set up persistent cache on the disk: diff --git a/src/test/java/org/kohsuke/github/GHEventPayloadTest.java b/src/test/java/org/kohsuke/github/GHEventPayloadTest.java index fba4c06d67..ba140d69e3 100644 --- a/src/test/java/org/kohsuke/github/GHEventPayloadTest.java +++ b/src/test/java/org/kohsuke/github/GHEventPayloadTest.java @@ -625,6 +625,18 @@ public void push() throws Exception { assertThat(event.getCommits().get(0).getRemoved().size(), is(0)); assertThat(event.getCommits().get(0).getModified().size(), is(1)); assertThat(event.getCommits().get(0).getModified().get(0), is("README.md")); + + assertThat(event.getHeadCommit().getSha(), is("0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c")); + assertThat(event.getHeadCommit().getAuthor().getEmail(), is("baxterthehacker@users.noreply.github.com")); + assertThat(event.getHeadCommit().getAuthor().getUsername(), is("baxterthehacker")); + assertThat(event.getHeadCommit().getCommitter().getEmail(), is("baxterthehacker@users.noreply.github.com")); + assertThat(event.getHeadCommit().getCommitter().getUsername(), is("baxterthehacker")); + assertThat(event.getHeadCommit().getAdded().size(), is(0)); + assertThat(event.getHeadCommit().getRemoved().size(), is(0)); + assertThat(event.getHeadCommit().getModified().size(), is(1)); + assertThat(event.getHeadCommit().getModified().get(0), is("README.md")); + assertThat(event.getHeadCommit().getMessage(), is("Update README.md")); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); formatter.setTimeZone(TimeZone.getTimeZone("UTC")); assertThat(formatter.format(event.getCommits().get(0).getTimestamp()), is("2015-05-05T23:40:15Z")); diff --git a/src/test/java/org/kohsuke/github/GHObjectTest.java b/src/test/java/org/kohsuke/github/GHObjectTest.java index 05a8c1ae4e..66388e55ee 100644 --- a/src/test/java/org/kohsuke/github/GHObjectTest.java +++ b/src/test/java/org/kohsuke/github/GHObjectTest.java @@ -19,9 +19,16 @@ public class GHObjectTest extends org.kohsuke.github.AbstractGitHubWireMockTest @Test public void test_toString() throws Exception { GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); - assertThat(org.toString(), - containsString( - "login=hub4j-test-org,location=,blog=,email=,bio=,name=,company=,type=Organization,followers=0,following=0,hireable=false")); + assertThat(org.toString(), containsString("login=hub4j-test-org")); + assertThat(org.toString(), containsString("location=")); + assertThat(org.toString(), containsString("blog=")); + assertThat(org.toString(), containsString("email=")); + assertThat(org.toString(), containsString("bio=")); + assertThat(org.toString(), containsString("name=")); + assertThat(org.toString(), containsString("company=")); + assertThat(org.toString(), containsString("type=Organization")); + assertThat(org.toString(), containsString("followers=0")); + assertThat(org.toString(), containsString("hireable=false")); // getResponseHeaderFields is deprecated but we should not break it. assertThat(org.getResponseHeaderFields(), notNullValue()); diff --git a/src/test/java/org/kohsuke/github/GHOrganizationTest.java b/src/test/java/org/kohsuke/github/GHOrganizationTest.java index 9ec59b301a..6edd1e172e 100644 --- a/src/test/java/org/kohsuke/github/GHOrganizationTest.java +++ b/src/test/java/org/kohsuke/github/GHOrganizationTest.java @@ -241,6 +241,65 @@ public void testListMembersWithRole() throws IOException { "timja")); } + /** + * Test list outside collaborators. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testListOutsideCollaborators() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + List admins = org.listOutsideCollaborators().toList(); + + assertThat(admins, notNullValue()); + // In case more are added in the future + assertThat(admins.size(), greaterThanOrEqualTo(12)); + assertThat(admins.stream().map(GHUser::getLogin).collect(Collectors.toList()), + hasItems("alexanderrtaylor", + "asthinasthi", + "bitwiseman", + "farmdawgnation", + "halkeye", + "jberglund-BSFT", + "kohsuke", + "kohsuke2", + "martinvanzijl", + "PauloMigAlmeida", + "Sage-Pierce", + "timja")); + } + /** + * Test list outside collaborators with filter. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testListOutsideCollaboratorsWithFilter() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + List admins = org.listOutsideCollaboratorsWithFilter("all").toList(); + + assertThat(admins, notNullValue()); + // In case more are added in the future + assertThat(admins.size(), greaterThanOrEqualTo(12)); + assertThat(admins.stream().map(GHUser::getLogin).collect(Collectors.toList()), + hasItems("alexanderrtaylor", + "asthinasthi", + "bitwiseman", + "farmdawgnation", + "halkeye", + "jberglund-BSFT", + "kohsuke", + "kohsuke2", + "martinvanzijl", + "PauloMigAlmeida", + "Sage-Pierce", + "timja")); + } + /** * Test create team with repo access. * diff --git a/src/test/java/org/kohsuke/github/GHRepositoryTest.java b/src/test/java/org/kohsuke/github/GHRepositoryTest.java index d85880250e..4d923e3546 100644 --- a/src/test/java/org/kohsuke/github/GHRepositoryTest.java +++ b/src/test/java/org/kohsuke/github/GHRepositoryTest.java @@ -1344,6 +1344,31 @@ public void getCheckRuns() throws Exception { } } + /** + * Filter out the checks from a reference + * + * @throws Exception + * the exception + */ + @Test + public void getCheckRunsWithParams() throws Exception { + final int expectedCount = 1; + // Use github-api repository as it has checks set up + final Map params = new HashMap<>(1); + params.put("check_name", "build-only (Java 17)"); + PagedIterable checkRuns = gitHub.getOrganization("hub4j") + .getRepository("github-api") + .getCheckRuns("54d60fbb53b4efa19f3081417bfb6a1de30c55e4", params); + + // Check if the checkruns are all succeeded and if we got all of them + int checkRunsCount = 0; + for (GHCheckRun checkRun : checkRuns) { + assertThat(checkRun.getConclusion(), equalTo(Conclusion.SUCCESS)); + checkRunsCount++; + } + assertThat(checkRunsCount, equalTo(expectedCount)); + } + /** * Gets the last commit status. * diff --git a/src/test/java/org/kohsuke/github/junit/WireMockRule.java b/src/test/java/org/kohsuke/github/junit/WireMockRule.java index f65e4cf11a..b7e89a6cd4 100644 --- a/src/test/java/org/kohsuke/github/junit/WireMockRule.java +++ b/src/test/java/org/kohsuke/github/junit/WireMockRule.java @@ -527,6 +527,16 @@ public void editStubMapping(StubMapping stubMapping) { wireMockServer.editStubMapping(stubMapping); } + /** + * Removes the stub mapping. + * + * @param id + * the id + */ + public void removeStubMapping(UUID id) { + wireMockServer.removeStubMapping(id); + } + /** * List all stub mappings. * @@ -711,6 +721,28 @@ public GetScenariosResult getAllScenarios() { return wireMockServer.getAllScenarios(); } + /** + * Reset a scenario + * + * @param name + * the name + */ + public void resetScenario(String name) { + wireMockServer.resetScenario(name); + } + + /** + * Set scenario state + * + * @param name + * the name + * @param state + * the state + */ + public void setScenarioState(String name, String state) { + wireMockServer.setScenarioState(name, state); + } + /** * Find top near misses for. * diff --git a/src/test/java/org/kohsuke/github/junit/WireMockRuleConfiguration.java b/src/test/java/org/kohsuke/github/junit/WireMockRuleConfiguration.java index ee8f953130..1960061c04 100644 --- a/src/test/java/org/kohsuke/github/junit/WireMockRuleConfiguration.java +++ b/src/test/java/org/kohsuke/github/junit/WireMockRuleConfiguration.java @@ -411,4 +411,21 @@ public boolean getDisableStrictHttpHeaders() { return parent.getDisableStrictHttpHeaders(); } + /** + * Gets the data truncation settings. + * + * @return the data truncation settings + */ + public DataTruncationSettings getDataTruncationSettings() { + return parent.getDataTruncationSettings(); + } + + /** + * Gets the network address rules. + * + * @return the network address rules + */ + public NetworkAddressRules getProxyTargetRules() { + return parent.getProxyTargetRules(); + } } diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaborators/__files/orgs_hub4j-test-org-2.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaborators/__files/orgs_hub4j-test-org-2.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaborators/__files/orgs_hub4j-test-org-2.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/testListOutsideCollaborators/__files/orgs_hub4j-test-org_members-3.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaborators/__files/orgs_hub4j-test-org_members-3.json new file mode 100644 index 0000000000..c8fc2f66f7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaborators/__files/orgs_hub4j-test-org_members-3.json @@ -0,0 +1,242 @@ +[ + { + "login": "alexanderrtaylor", + "id": 852179, + "node_id": "MDQ6VXNlcjg1MjE3OQ==", + "avatar_url": "https://avatars0.githubusercontent.com/u/852179?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/alexanderrtaylor", + "html_url": "https://github.com/alexanderrtaylor", + "followers_url": "https://api.github.com/users/alexanderrtaylor/followers", + "following_url": "https://api.github.com/users/alexanderrtaylor/following{/other_user}", + "gists_url": "https://api.github.com/users/alexanderrtaylor/gists{/gist_id}", + "starred_url": "https://api.github.com/users/alexanderrtaylor/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/alexanderrtaylor/subscriptions", + "organizations_url": "https://api.github.com/users/alexanderrtaylor/orgs", + "repos_url": "https://api.github.com/users/alexanderrtaylor/repos", + "events_url": "https://api.github.com/users/alexanderrtaylor/events{/privacy}", + "received_events_url": "https://api.github.com/users/alexanderrtaylor/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "asthinasthi", + "id": 4577101, + "node_id": "MDQ6VXNlcjQ1NzcxMDE=", + "avatar_url": "https://avatars1.githubusercontent.com/u/4577101?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/asthinasthi", + "html_url": "https://github.com/asthinasthi", + "followers_url": "https://api.github.com/users/asthinasthi/followers", + "following_url": "https://api.github.com/users/asthinasthi/following{/other_user}", + "gists_url": "https://api.github.com/users/asthinasthi/gists{/gist_id}", + "starred_url": "https://api.github.com/users/asthinasthi/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/asthinasthi/subscriptions", + "organizations_url": "https://api.github.com/users/asthinasthi/orgs", + "repos_url": "https://api.github.com/users/asthinasthi/repos", + "events_url": "https://api.github.com/users/asthinasthi/events{/privacy}", + "received_events_url": "https://api.github.com/users/asthinasthi/received_events", + "type": "User", + "site_admin": false + }, + { + "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 + }, + { + "login": "farmdawgnation", + "id": 620189, + "node_id": "MDQ6VXNlcjYyMDE4OQ==", + "avatar_url": "https://avatars2.githubusercontent.com/u/620189?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/farmdawgnation", + "html_url": "https://github.com/farmdawgnation", + "followers_url": "https://api.github.com/users/farmdawgnation/followers", + "following_url": "https://api.github.com/users/farmdawgnation/following{/other_user}", + "gists_url": "https://api.github.com/users/farmdawgnation/gists{/gist_id}", + "starred_url": "https://api.github.com/users/farmdawgnation/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/farmdawgnation/subscriptions", + "organizations_url": "https://api.github.com/users/farmdawgnation/orgs", + "repos_url": "https://api.github.com/users/farmdawgnation/repos", + "events_url": "https://api.github.com/users/farmdawgnation/events{/privacy}", + "received_events_url": "https://api.github.com/users/farmdawgnation/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "halkeye", + "id": 110087, + "node_id": "MDQ6VXNlcjExMDA4Nw==", + "avatar_url": "https://avatars3.githubusercontent.com/u/110087?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/halkeye", + "html_url": "https://github.com/halkeye", + "followers_url": "https://api.github.com/users/halkeye/followers", + "following_url": "https://api.github.com/users/halkeye/following{/other_user}", + "gists_url": "https://api.github.com/users/halkeye/gists{/gist_id}", + "starred_url": "https://api.github.com/users/halkeye/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/halkeye/subscriptions", + "organizations_url": "https://api.github.com/users/halkeye/orgs", + "repos_url": "https://api.github.com/users/halkeye/repos", + "events_url": "https://api.github.com/users/halkeye/events{/privacy}", + "received_events_url": "https://api.github.com/users/halkeye/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "jberglund-BSFT", + "id": 19560713, + "node_id": "MDQ6VXNlcjE5NTYwNzEz", + "avatar_url": "https://avatars3.githubusercontent.com/u/19560713?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jberglund-BSFT", + "html_url": "https://github.com/jberglund-BSFT", + "followers_url": "https://api.github.com/users/jberglund-BSFT/followers", + "following_url": "https://api.github.com/users/jberglund-BSFT/following{/other_user}", + "gists_url": "https://api.github.com/users/jberglund-BSFT/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jberglund-BSFT/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jberglund-BSFT/subscriptions", + "organizations_url": "https://api.github.com/users/jberglund-BSFT/orgs", + "repos_url": "https://api.github.com/users/jberglund-BSFT/repos", + "events_url": "https://api.github.com/users/jberglund-BSFT/events{/privacy}", + "received_events_url": "https://api.github.com/users/jberglund-BSFT/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "kohsuke", + "id": 50003, + "node_id": "MDQ6VXNlcjUwMDAz", + "avatar_url": "https://avatars1.githubusercontent.com/u/50003?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke", + "html_url": "https://github.com/kohsuke", + "followers_url": "https://api.github.com/users/kohsuke/followers", + "following_url": "https://api.github.com/users/kohsuke/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke/orgs", + "repos_url": "https://api.github.com/users/kohsuke/repos", + "events_url": "https://api.github.com/users/kohsuke/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "kohsuke2", + "id": 1329242, + "node_id": "MDQ6VXNlcjEzMjkyNDI=", + "avatar_url": "https://avatars2.githubusercontent.com/u/1329242?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke2", + "html_url": "https://github.com/kohsuke2", + "followers_url": "https://api.github.com/users/kohsuke2/followers", + "following_url": "https://api.github.com/users/kohsuke2/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke2/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke2/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke2/orgs", + "repos_url": "https://api.github.com/users/kohsuke2/repos", + "events_url": "https://api.github.com/users/kohsuke2/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke2/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "martinvanzijl", + "id": 24422213, + "node_id": "MDQ6VXNlcjI0NDIyMjEz", + "avatar_url": "https://avatars0.githubusercontent.com/u/24422213?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/martinvanzijl", + "html_url": "https://github.com/martinvanzijl", + "followers_url": "https://api.github.com/users/martinvanzijl/followers", + "following_url": "https://api.github.com/users/martinvanzijl/following{/other_user}", + "gists_url": "https://api.github.com/users/martinvanzijl/gists{/gist_id}", + "starred_url": "https://api.github.com/users/martinvanzijl/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/martinvanzijl/subscriptions", + "organizations_url": "https://api.github.com/users/martinvanzijl/orgs", + "repos_url": "https://api.github.com/users/martinvanzijl/repos", + "events_url": "https://api.github.com/users/martinvanzijl/events{/privacy}", + "received_events_url": "https://api.github.com/users/martinvanzijl/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "PauloMigAlmeida", + "id": 1011868, + "node_id": "MDQ6VXNlcjEwMTE4Njg=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1011868?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/PauloMigAlmeida", + "html_url": "https://github.com/PauloMigAlmeida", + "followers_url": "https://api.github.com/users/PauloMigAlmeida/followers", + "following_url": "https://api.github.com/users/PauloMigAlmeida/following{/other_user}", + "gists_url": "https://api.github.com/users/PauloMigAlmeida/gists{/gist_id}", + "starred_url": "https://api.github.com/users/PauloMigAlmeida/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/PauloMigAlmeida/subscriptions", + "organizations_url": "https://api.github.com/users/PauloMigAlmeida/orgs", + "repos_url": "https://api.github.com/users/PauloMigAlmeida/repos", + "events_url": "https://api.github.com/users/PauloMigAlmeida/events{/privacy}", + "received_events_url": "https://api.github.com/users/PauloMigAlmeida/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "Sage-Pierce", + "id": 5396306, + "node_id": "MDQ6VXNlcjUzOTYzMDY=", + "avatar_url": "https://avatars3.githubusercontent.com/u/5396306?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Sage-Pierce", + "html_url": "https://github.com/Sage-Pierce", + "followers_url": "https://api.github.com/users/Sage-Pierce/followers", + "following_url": "https://api.github.com/users/Sage-Pierce/following{/other_user}", + "gists_url": "https://api.github.com/users/Sage-Pierce/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Sage-Pierce/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Sage-Pierce/subscriptions", + "organizations_url": "https://api.github.com/users/Sage-Pierce/orgs", + "repos_url": "https://api.github.com/users/Sage-Pierce/repos", + "events_url": "https://api.github.com/users/Sage-Pierce/events{/privacy}", + "received_events_url": "https://api.github.com/users/Sage-Pierce/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "timja", + "id": 21194782, + "node_id": "MDQ6VXNlcjIxMTk0Nzgy", + "avatar_url": "https://avatars3.githubusercontent.com/u/21194782?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/timja", + "html_url": "https://github.com/timja", + "followers_url": "https://api.github.com/users/timja/followers", + "following_url": "https://api.github.com/users/timja/following{/other_user}", + "gists_url": "https://api.github.com/users/timja/gists{/gist_id}", + "starred_url": "https://api.github.com/users/timja/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/timja/subscriptions", + "organizations_url": "https://api.github.com/users/timja/orgs", + "repos_url": "https://api.github.com/users/timja/repos", + "events_url": "https://api.github.com/users/timja/events{/privacy}", + "received_events_url": "https://api.github.com/users/timja/received_events", + "type": "User", + "site_admin": false + } +] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaborators/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaborators/__files/user-1.json new file mode 100644 index 0000000000..750413948a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaborators/__files/user-1.json @@ -0,0 +1,45 @@ +{ + "login": "Sage-Pierce", + "id": 5396306, + "node_id": "MDQ6VXNlcjUzOTYzMDY=", + "avatar_url": "https://avatars3.githubusercontent.com/u/5396306?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Sage-Pierce", + "html_url": "https://github.com/Sage-Pierce", + "followers_url": "https://api.github.com/users/Sage-Pierce/followers", + "following_url": "https://api.github.com/users/Sage-Pierce/following{/other_user}", + "gists_url": "https://api.github.com/users/Sage-Pierce/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Sage-Pierce/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Sage-Pierce/subscriptions", + "organizations_url": "https://api.github.com/users/Sage-Pierce/orgs", + "repos_url": "https://api.github.com/users/Sage-Pierce/repos", + "events_url": "https://api.github.com/users/Sage-Pierce/events{/privacy}", + "received_events_url": "https://api.github.com/users/Sage-Pierce/received_events", + "type": "User", + "site_admin": false, + "name": "Sage Pierce", + "company": "@Vrbo @ExpediaGroup", + "blog": "", + "location": null, + "email": "sapierce@vrbo.com", + "hireable": true, + "bio": "Software engineer with a Masters of Science in Electrical and Computer Engineering out of The University of Texas at Austin.", + "public_repos": 9, + "public_gists": 0, + "followers": 4, + "following": 0, + "created_at": "2013-09-06T02:22:48Z", + "updated_at": "2020-02-18T13:29:56Z", + "private_gists": 0, + "total_private_repos": 0, + "owned_private_repos": 0, + "disk_usage": 1816, + "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/GHOrganizationTest/wiremock/testListOutsideCollaborators/mappings/orgs_hub4j-test-org-2.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaborators/mappings/orgs_hub4j-test-org-2.json new file mode 100644 index 0000000000..a28834ada9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaborators/mappings/orgs_hub4j-test-org-2.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": "orgs_hub4j-test-org-2.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": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaborators/mappings/orgs_hub4j-test-org_members-3.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaborators/mappings/orgs_hub4j-test-org_members-3.json new file mode 100644 index 0000000000..b34c01a2da --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaborators/mappings/orgs_hub4j-test-org_members-3.json @@ -0,0 +1,47 @@ +{ + "id": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "name": "orgs_hub4j-test-org_members", + "request": { + "url": "/orgs/hub4j-test-org/outside_collaborators", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org_members-3.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/testListOutsideCollaborators/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaborators/mappings/user-1.json new file mode 100644 index 0000000000..c259d1b9d7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaborators/mappings/user-1.json @@ -0,0 +1,48 @@ +{ + "id": "9e0ec7a6-d16f-4198-b2e6-ed290e9d780d", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "user-1.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:03 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4988", + "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": "EB37:2979:3EAEEA:7860F9:5E5531FF" + } + }, + "uuid": "9e0ec7a6-d16f-4198-b2e6-ed290e9d780d", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaboratorsWithFilter/__files/orgs_hub4j-test-org-2.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaboratorsWithFilter/__files/orgs_hub4j-test-org-2.json new file mode 100644 index 0000000000..731f707098 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaboratorsWithFilter/__files/orgs_hub4j-test-org-2.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/testListOutsideCollaboratorsWithFilter/__files/orgs_hub4j-test-org_members-3.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaboratorsWithFilter/__files/orgs_hub4j-test-org_members-3.json new file mode 100644 index 0000000000..c8fc2f66f7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaboratorsWithFilter/__files/orgs_hub4j-test-org_members-3.json @@ -0,0 +1,242 @@ +[ + { + "login": "alexanderrtaylor", + "id": 852179, + "node_id": "MDQ6VXNlcjg1MjE3OQ==", + "avatar_url": "https://avatars0.githubusercontent.com/u/852179?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/alexanderrtaylor", + "html_url": "https://github.com/alexanderrtaylor", + "followers_url": "https://api.github.com/users/alexanderrtaylor/followers", + "following_url": "https://api.github.com/users/alexanderrtaylor/following{/other_user}", + "gists_url": "https://api.github.com/users/alexanderrtaylor/gists{/gist_id}", + "starred_url": "https://api.github.com/users/alexanderrtaylor/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/alexanderrtaylor/subscriptions", + "organizations_url": "https://api.github.com/users/alexanderrtaylor/orgs", + "repos_url": "https://api.github.com/users/alexanderrtaylor/repos", + "events_url": "https://api.github.com/users/alexanderrtaylor/events{/privacy}", + "received_events_url": "https://api.github.com/users/alexanderrtaylor/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "asthinasthi", + "id": 4577101, + "node_id": "MDQ6VXNlcjQ1NzcxMDE=", + "avatar_url": "https://avatars1.githubusercontent.com/u/4577101?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/asthinasthi", + "html_url": "https://github.com/asthinasthi", + "followers_url": "https://api.github.com/users/asthinasthi/followers", + "following_url": "https://api.github.com/users/asthinasthi/following{/other_user}", + "gists_url": "https://api.github.com/users/asthinasthi/gists{/gist_id}", + "starred_url": "https://api.github.com/users/asthinasthi/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/asthinasthi/subscriptions", + "organizations_url": "https://api.github.com/users/asthinasthi/orgs", + "repos_url": "https://api.github.com/users/asthinasthi/repos", + "events_url": "https://api.github.com/users/asthinasthi/events{/privacy}", + "received_events_url": "https://api.github.com/users/asthinasthi/received_events", + "type": "User", + "site_admin": false + }, + { + "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 + }, + { + "login": "farmdawgnation", + "id": 620189, + "node_id": "MDQ6VXNlcjYyMDE4OQ==", + "avatar_url": "https://avatars2.githubusercontent.com/u/620189?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/farmdawgnation", + "html_url": "https://github.com/farmdawgnation", + "followers_url": "https://api.github.com/users/farmdawgnation/followers", + "following_url": "https://api.github.com/users/farmdawgnation/following{/other_user}", + "gists_url": "https://api.github.com/users/farmdawgnation/gists{/gist_id}", + "starred_url": "https://api.github.com/users/farmdawgnation/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/farmdawgnation/subscriptions", + "organizations_url": "https://api.github.com/users/farmdawgnation/orgs", + "repos_url": "https://api.github.com/users/farmdawgnation/repos", + "events_url": "https://api.github.com/users/farmdawgnation/events{/privacy}", + "received_events_url": "https://api.github.com/users/farmdawgnation/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "halkeye", + "id": 110087, + "node_id": "MDQ6VXNlcjExMDA4Nw==", + "avatar_url": "https://avatars3.githubusercontent.com/u/110087?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/halkeye", + "html_url": "https://github.com/halkeye", + "followers_url": "https://api.github.com/users/halkeye/followers", + "following_url": "https://api.github.com/users/halkeye/following{/other_user}", + "gists_url": "https://api.github.com/users/halkeye/gists{/gist_id}", + "starred_url": "https://api.github.com/users/halkeye/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/halkeye/subscriptions", + "organizations_url": "https://api.github.com/users/halkeye/orgs", + "repos_url": "https://api.github.com/users/halkeye/repos", + "events_url": "https://api.github.com/users/halkeye/events{/privacy}", + "received_events_url": "https://api.github.com/users/halkeye/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "jberglund-BSFT", + "id": 19560713, + "node_id": "MDQ6VXNlcjE5NTYwNzEz", + "avatar_url": "https://avatars3.githubusercontent.com/u/19560713?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jberglund-BSFT", + "html_url": "https://github.com/jberglund-BSFT", + "followers_url": "https://api.github.com/users/jberglund-BSFT/followers", + "following_url": "https://api.github.com/users/jberglund-BSFT/following{/other_user}", + "gists_url": "https://api.github.com/users/jberglund-BSFT/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jberglund-BSFT/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jberglund-BSFT/subscriptions", + "organizations_url": "https://api.github.com/users/jberglund-BSFT/orgs", + "repos_url": "https://api.github.com/users/jberglund-BSFT/repos", + "events_url": "https://api.github.com/users/jberglund-BSFT/events{/privacy}", + "received_events_url": "https://api.github.com/users/jberglund-BSFT/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "kohsuke", + "id": 50003, + "node_id": "MDQ6VXNlcjUwMDAz", + "avatar_url": "https://avatars1.githubusercontent.com/u/50003?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke", + "html_url": "https://github.com/kohsuke", + "followers_url": "https://api.github.com/users/kohsuke/followers", + "following_url": "https://api.github.com/users/kohsuke/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke/orgs", + "repos_url": "https://api.github.com/users/kohsuke/repos", + "events_url": "https://api.github.com/users/kohsuke/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "kohsuke2", + "id": 1329242, + "node_id": "MDQ6VXNlcjEzMjkyNDI=", + "avatar_url": "https://avatars2.githubusercontent.com/u/1329242?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke2", + "html_url": "https://github.com/kohsuke2", + "followers_url": "https://api.github.com/users/kohsuke2/followers", + "following_url": "https://api.github.com/users/kohsuke2/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke2/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke2/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke2/orgs", + "repos_url": "https://api.github.com/users/kohsuke2/repos", + "events_url": "https://api.github.com/users/kohsuke2/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke2/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "martinvanzijl", + "id": 24422213, + "node_id": "MDQ6VXNlcjI0NDIyMjEz", + "avatar_url": "https://avatars0.githubusercontent.com/u/24422213?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/martinvanzijl", + "html_url": "https://github.com/martinvanzijl", + "followers_url": "https://api.github.com/users/martinvanzijl/followers", + "following_url": "https://api.github.com/users/martinvanzijl/following{/other_user}", + "gists_url": "https://api.github.com/users/martinvanzijl/gists{/gist_id}", + "starred_url": "https://api.github.com/users/martinvanzijl/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/martinvanzijl/subscriptions", + "organizations_url": "https://api.github.com/users/martinvanzijl/orgs", + "repos_url": "https://api.github.com/users/martinvanzijl/repos", + "events_url": "https://api.github.com/users/martinvanzijl/events{/privacy}", + "received_events_url": "https://api.github.com/users/martinvanzijl/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "PauloMigAlmeida", + "id": 1011868, + "node_id": "MDQ6VXNlcjEwMTE4Njg=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1011868?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/PauloMigAlmeida", + "html_url": "https://github.com/PauloMigAlmeida", + "followers_url": "https://api.github.com/users/PauloMigAlmeida/followers", + "following_url": "https://api.github.com/users/PauloMigAlmeida/following{/other_user}", + "gists_url": "https://api.github.com/users/PauloMigAlmeida/gists{/gist_id}", + "starred_url": "https://api.github.com/users/PauloMigAlmeida/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/PauloMigAlmeida/subscriptions", + "organizations_url": "https://api.github.com/users/PauloMigAlmeida/orgs", + "repos_url": "https://api.github.com/users/PauloMigAlmeida/repos", + "events_url": "https://api.github.com/users/PauloMigAlmeida/events{/privacy}", + "received_events_url": "https://api.github.com/users/PauloMigAlmeida/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "Sage-Pierce", + "id": 5396306, + "node_id": "MDQ6VXNlcjUzOTYzMDY=", + "avatar_url": "https://avatars3.githubusercontent.com/u/5396306?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Sage-Pierce", + "html_url": "https://github.com/Sage-Pierce", + "followers_url": "https://api.github.com/users/Sage-Pierce/followers", + "following_url": "https://api.github.com/users/Sage-Pierce/following{/other_user}", + "gists_url": "https://api.github.com/users/Sage-Pierce/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Sage-Pierce/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Sage-Pierce/subscriptions", + "organizations_url": "https://api.github.com/users/Sage-Pierce/orgs", + "repos_url": "https://api.github.com/users/Sage-Pierce/repos", + "events_url": "https://api.github.com/users/Sage-Pierce/events{/privacy}", + "received_events_url": "https://api.github.com/users/Sage-Pierce/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "timja", + "id": 21194782, + "node_id": "MDQ6VXNlcjIxMTk0Nzgy", + "avatar_url": "https://avatars3.githubusercontent.com/u/21194782?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/timja", + "html_url": "https://github.com/timja", + "followers_url": "https://api.github.com/users/timja/followers", + "following_url": "https://api.github.com/users/timja/following{/other_user}", + "gists_url": "https://api.github.com/users/timja/gists{/gist_id}", + "starred_url": "https://api.github.com/users/timja/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/timja/subscriptions", + "organizations_url": "https://api.github.com/users/timja/orgs", + "repos_url": "https://api.github.com/users/timja/repos", + "events_url": "https://api.github.com/users/timja/events{/privacy}", + "received_events_url": "https://api.github.com/users/timja/received_events", + "type": "User", + "site_admin": false + } +] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaboratorsWithFilter/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaboratorsWithFilter/__files/user-1.json new file mode 100644 index 0000000000..750413948a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaboratorsWithFilter/__files/user-1.json @@ -0,0 +1,45 @@ +{ + "login": "Sage-Pierce", + "id": 5396306, + "node_id": "MDQ6VXNlcjUzOTYzMDY=", + "avatar_url": "https://avatars3.githubusercontent.com/u/5396306?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Sage-Pierce", + "html_url": "https://github.com/Sage-Pierce", + "followers_url": "https://api.github.com/users/Sage-Pierce/followers", + "following_url": "https://api.github.com/users/Sage-Pierce/following{/other_user}", + "gists_url": "https://api.github.com/users/Sage-Pierce/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Sage-Pierce/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Sage-Pierce/subscriptions", + "organizations_url": "https://api.github.com/users/Sage-Pierce/orgs", + "repos_url": "https://api.github.com/users/Sage-Pierce/repos", + "events_url": "https://api.github.com/users/Sage-Pierce/events{/privacy}", + "received_events_url": "https://api.github.com/users/Sage-Pierce/received_events", + "type": "User", + "site_admin": false, + "name": "Sage Pierce", + "company": "@Vrbo @ExpediaGroup", + "blog": "", + "location": null, + "email": "sapierce@vrbo.com", + "hireable": true, + "bio": "Software engineer with a Masters of Science in Electrical and Computer Engineering out of The University of Texas at Austin.", + "public_repos": 9, + "public_gists": 0, + "followers": 4, + "following": 0, + "created_at": "2013-09-06T02:22:48Z", + "updated_at": "2020-02-18T13:29:56Z", + "private_gists": 0, + "total_private_repos": 0, + "owned_private_repos": 0, + "disk_usage": 1816, + "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/GHOrganizationTest/wiremock/testListOutsideCollaboratorsWithFilter/mappings/orgs_hub4j-test-org-2.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaboratorsWithFilter/mappings/orgs_hub4j-test-org-2.json new file mode 100644 index 0000000000..a28834ada9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaboratorsWithFilter/mappings/orgs_hub4j-test-org-2.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": "orgs_hub4j-test-org-2.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": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaboratorsWithFilter/mappings/orgs_hub4j-test-org_members-3.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaboratorsWithFilter/mappings/orgs_hub4j-test-org_members-3.json new file mode 100644 index 0000000000..b3b40db81b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaboratorsWithFilter/mappings/orgs_hub4j-test-org_members-3.json @@ -0,0 +1,47 @@ +{ + "id": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "name": "orgs_hub4j-test-org_members", + "request": { + "url": "/orgs/hub4j-test-org/outside_collaborators?filter=all", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org_members-3.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/testListOutsideCollaboratorsWithFilter/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaboratorsWithFilter/mappings/user-1.json new file mode 100644 index 0000000000..c259d1b9d7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListOutsideCollaboratorsWithFilter/mappings/user-1.json @@ -0,0 +1,48 @@ +{ + "id": "9e0ec7a6-d16f-4198-b2e6-ed290e9d780d", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "user-1.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:03 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4988", + "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": "EB37:2979:3EAEEA:7860F9:5E5531FF" + } + }, + "uuid": "9e0ec7a6-d16f-4198-b2e6-ed290e9d780d", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/__files/orgs_hub4j-1.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/__files/orgs_hub4j-1.json new file mode 100644 index 0000000000..7af7035707 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/__files/orgs_hub4j-1.json @@ -0,0 +1,25 @@ +{ + "avatar_url": "https://avatars.githubusercontent.com/u/54909825?v=4", + "created_at": "2019-09-04T18:12:34Z", + "description": null, + "events_url": "https://api.github.com/orgs/hub4j/events", + "followers": 0, + "following": 0, + "has_organization_projects": true, + "has_repository_projects": true, + "hooks_url": "https://api.github.com/orgs/hub4j/hooks", + "html_url": "https://github.com/hub4j", + "id": 54909825, + "is_verified": false, + "issues_url": "https://api.github.com/orgs/hub4j/issues", + "login": "hub4j", + "members_url": "https://api.github.com/orgs/hub4j/members{/member}", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "public_gists": 0, + "public_members_url": "https://api.github.com/orgs/hub4j/public_members{/member}", + "public_repos": 1, + "repos_url": "https://api.github.com/orgs/hub4j/repos", + "type": "Organization", + "updated_at": "2020-05-08T21:26:19Z", + "url": "https://api.github.com/orgs/hub4j" +} diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/__files/repos_hub4j_github-api-2.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/__files/repos_hub4j_github-api-2.json new file mode 100644 index 0000000000..eadccf842e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/__files/repos_hub4j_github-api-2.json @@ -0,0 +1,137 @@ +{ + "allow_forking": true, + "archive_url": "https://api.github.com/repos/hub4j/github-api/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/hub4j/github-api/assignees{/user}", + "blobs_url": "https://api.github.com/repos/hub4j/github-api/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/hub4j/github-api/branches{/branch}", + "clone_url": "https://github.com/hub4j/github-api.git", + "collaborators_url": "https://api.github.com/repos/hub4j/github-api/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/hub4j/github-api/comments{/number}", + "commits_url": "https://api.github.com/repos/hub4j/github-api/commits{/sha}", + "compare_url": "https://api.github.com/repos/hub4j/github-api/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/hub4j/github-api/contents/{+path}", + "contributors_url": "https://api.github.com/repos/hub4j/github-api/contributors", + "created_at": "2010-04-19T04:13:03Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/hub4j/github-api/deployments", + "description": "Java API for GitHub", + "disabled": false, + "downloads_url": "https://api.github.com/repos/hub4j/github-api/downloads", + "events_url": "https://api.github.com/repos/hub4j/github-api/events", + "fork": false, + "forks": 651, + "forks_count": 651, + "forks_url": "https://api.github.com/repos/hub4j/github-api/forks", + "full_name": "hub4j/github-api", + "git_commits_url": "https://api.github.com/repos/hub4j/github-api/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j/github-api/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j/github-api/git/tags{/sha}", + "git_url": "git://github.com/hub4j/github-api.git", + "has_discussions": true, + "has_downloads": true, + "has_issues": true, + "has_pages": true, + "has_projects": true, + "has_wiki": true, + "homepage": "https://github-api.kohsuke.org/", + "hooks_url": "https://api.github.com/repos/hub4j/github-api/hooks", + "html_url": "https://github.com/hub4j/github-api", + "id": 617210, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/hub4j/github-api/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/hub4j/github-api/issues/events{/number}", + "issues_url": "https://api.github.com/repos/hub4j/github-api/issues{/number}", + "keys_url": "https://api.github.com/repos/hub4j/github-api/keys{/key_id}", + "labels_url": "https://api.github.com/repos/hub4j/github-api/labels{/name}", + "language": "Java", + "languages_url": "https://api.github.com/repos/hub4j/github-api/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/hub4j/github-api/merges", + "milestones_url": "https://api.github.com/repos/hub4j/github-api/milestones{/number}", + "mirror_url": null, + "name": "github-api", + "network_count": 651, + "node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=", + "notifications_url": "https://api.github.com/repos/hub4j/github-api/notifications{?since,all,participating}", + "open_issues": 141, + "open_issues_count": 141, + "organization": { + "avatar_url": "https://avatars.githubusercontent.com/u/54909825?v=4", + "events_url": "https://api.github.com/users/hub4j/events{/privacy}", + "followers_url": "https://api.github.com/users/hub4j/followers", + "following_url": "https://api.github.com/users/hub4j/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/hub4j", + "id": 54909825, + "login": "hub4j", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "organizations_url": "https://api.github.com/users/hub4j/orgs", + "received_events_url": "https://api.github.com/users/hub4j/received_events", + "repos_url": "https://api.github.com/users/hub4j/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j/subscriptions", + "type": "Organization", + "url": "https://api.github.com/users/hub4j" + }, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/54909825?v=4", + "events_url": "https://api.github.com/users/hub4j/events{/privacy}", + "followers_url": "https://api.github.com/users/hub4j/followers", + "following_url": "https://api.github.com/users/hub4j/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/hub4j", + "id": 54909825, + "login": "hub4j", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "organizations_url": "https://api.github.com/users/hub4j/orgs", + "received_events_url": "https://api.github.com/users/hub4j/received_events", + "repos_url": "https://api.github.com/users/hub4j/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j/subscriptions", + "type": "Organization", + "url": "https://api.github.com/users/hub4j" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/hub4j/github-api/pulls{/number}", + "pushed_at": "2023-02-01T14:18:09Z", + "releases_url": "https://api.github.com/repos/hub4j/github-api/releases{/id}", + "size": 40829, + "ssh_url": "git@github.com:hub4j/github-api.git", + "stargazers_count": 972, + "stargazers_url": "https://api.github.com/repos/hub4j/github-api/stargazers", + "statuses_url": "https://api.github.com/repos/hub4j/github-api/statuses/{sha}", + "subscribers_count": 48, + "subscribers_url": "https://api.github.com/repos/hub4j/github-api/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j/github-api/subscription", + "svn_url": "https://github.com/hub4j/github-api", + "tags_url": "https://api.github.com/repos/hub4j/github-api/tags", + "teams_url": "https://api.github.com/repos/hub4j/github-api/teams", + "temp_clone_token": null, + "topics": [ + "api", + "client-library", + "github", + "github-api", + "github-api-v3", + "java", + "java-api" + ], + "trees_url": "https://api.github.com/repos/hub4j/github-api/git/trees{/sha}", + "updated_at": "2023-01-30T18:28:31Z", + "url": "https://api.github.com/repos/hub4j/github-api", + "visibility": "public", + "watchers": 972, + "watchers_count": 972, + "web_commit_signoff_required": false +} diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/__files/repos_hub4j_github-api_commits_54d60fbb53b4efa19f3081417bfb6a1de30c55e4_check-runs-3.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/__files/repos_hub4j_github-api_commits_54d60fbb53b4efa19f3081417bfb6a1de30c55e4_check-runs-3.json new file mode 100644 index 0000000000..d65eef6cce --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/__files/repos_hub4j_github-api_commits_54d60fbb53b4efa19f3081417bfb6a1de30c55e4_check-runs-3.json @@ -0,0 +1,105 @@ +{ + "total_count": 1, + "check_runs": [ + { + "id": 514982790, + "node_id": "MDg6Q2hlY2tSdW41MTQ5ODI3OTA=", + "head_sha": "78b9ff49d47daaa158eb373c4e2e040f739df8b9", + "external_id": "5b9ee24e-a4fa-5b0f-9fef-471905f84b41", + "url": "https://api.github.com/repos/hub4j/github-api/check-runs/514982790", + "html_url": "https://github.com/hub4j/github-api/runs/514982790", + "details_url": "https://github.com/hub4j/github-api/runs/514982790", + "status": "completed", + "conclusion": "success", + "started_at": "2020-03-17T21:37:30Z", + "completed_at": "2020-03-17T21:41:01Z", + "output": { + "title": null, + "summary": null, + "text": null, + "annotations_count": 0, + "annotations_url": "https://api.github.com/repos/hub4j/github-api/check-runs/514982790/annotations" + }, + "name": "build-only (Java 17)", + "check_suite": { + "id": 528275399 + }, + "app": { + "id": 15368, + "slug": "github-actions", + "node_id": "MDM6QXBwMTUzNjg=", + "owner": { + "login": "github", + "id": 9919, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=", + "avatar_url": "https://avatars1.githubusercontent.com/u/9919?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github", + "html_url": "https://github.com/github", + "followers_url": "https://api.github.com/users/github/followers", + "following_url": "https://api.github.com/users/github/following{/other_user}", + "gists_url": "https://api.github.com/users/github/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github/subscriptions", + "organizations_url": "https://api.github.com/users/github/orgs", + "repos_url": "https://api.github.com/users/github/repos", + "events_url": "https://api.github.com/users/github/events{/privacy}", + "received_events_url": "https://api.github.com/users/github/received_events", + "type": "Organization", + "site_admin": false + }, + "name": "GitHub Actions", + "description": "Automate your workflow from idea to production", + "external_url": "https://help.github.com/en/actions", + "html_url": "https://github.com/apps/github-actions", + "created_at": "2018-07-30T09:30:17Z", + "updated_at": "2019-12-10T19:04:12Z", + "permissions": { + "actions": "write", + "checks": "write", + "contents": "write", + "deployments": "write", + "issues": "write", + "metadata": "read", + "packages": "write", + "pages": "write", + "pull_requests": "write", + "repository_hooks": "write", + "repository_projects": "write", + "statuses": "write", + "vulnerability_alerts": "read" + }, + "events": [ + "check_run", + "check_suite", + "create", + "delete", + "deployment", + "deployment_status", + "fork", + "gollum", + "issues", + "issue_comment", + "label", + "milestone", + "page_build", + "project", + "project_card", + "project_column", + "public", + "pull_request", + "pull_request_review", + "pull_request_review_comment", + "push", + "registry_package", + "release", + "repository", + "repository_dispatch", + "status", + "watch" + ] + }, + "pull_requests": [] + } + ] +} diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/mappings/orgs_hub4j-1.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/mappings/orgs_hub4j-1.json new file mode 100644 index 0000000000..feb2a3c85d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/mappings/orgs_hub4j-1.json @@ -0,0 +1,44 @@ +{ + "id": "5d8b3f90-4fb5-4321-b979-b06127d19224", + "name": "orgs_hub4j", + "request": { + "url": "/orgs/hub4j", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-1.json", + "headers": { + "Cache-Control": "public, max-age=60, s-maxage=60", + "Content-Security-Policy": "default-src 'none'", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Feb 2023 14:50:02 GMT", + "ETag": "W/\"0f5afebb9a43d2439789b5ee913e4b91dd2ee711e15a942b5a85dc8d6ae18dc9\"", + "Last-Modified": "Fri, 08 May 2020 21:26:19 GMT", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Server": "GitHub.com", + "Status": "200 OK", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "Vary": [ + "Accept", + "Accept-Encoding, Accept, X-Requested-With" + ], + "X-Content-Type-Options": "nosniff", + "X-Frame-Options": "deny", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-GitHub-Request-Id": "CA71:D7EC:186E8A:18D72D:63DA7C19", + "X-RateLimit-Limit": "60", + "X-RateLimit-Remaining": "55", + "X-RateLimit-Reset": "1675263481", + "X-XSS-Protection": "0" + } + }, + "uuid": "5d8b3f90-4fb5-4321-b979-b06127d19224", + "persistent": true, + "insertionIndex": 1 +} diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/mappings/repos_hub4j_github-api-2.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/mappings/repos_hub4j_github-api-2.json new file mode 100644 index 0000000000..4389fe339e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/mappings/repos_hub4j_github-api-2.json @@ -0,0 +1,44 @@ +{ + "id": "71c75ce1-402c-4835-8841-f1707d28d88d", + "name": "repos_hub4j_github-api", + "request": { + "url": "/repos/hub4j/github-api", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j_github-api-2.json", + "headers": { + "Cache-Control": "public, max-age=60, s-maxage=60", + "Content-Security-Policy": "default-src 'none'", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Feb 2023 15:27:59 GMT", + "ETag": "W/\"27c60bc0ab8216c908ac99475a2d77aa39d77e3cbdf04e98f52df98e20d7e7d2\"", + "Last-Modified": "Mon, 30 Jan 2023 18:28:31 GMT", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Server": "GitHub.com", + "Status": "200 OK", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "Vary": [ + "Accept", + "Accept-Encoding, Accept, X-Requested-With" + ], + "X-Content-Type-Options": "nosniff", + "X-Frame-Options": "deny", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-GitHub-Request-Id": "CDC0:D7EC:3FD768:40DB97:63DA84FF", + "X-RateLimit-Limit": "60", + "X-RateLimit-Remaining": "57", + "X-RateLimit-Reset": "1675267094", + "X-XSS-Protection": "0" + } + }, + "uuid": "71c75ce1-402c-4835-8841-f1707d28d88d", + "persistent": true, + "insertionIndex": 2 +} diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/mappings/repos_hub4j_github-api_commits_54d60fbb53b4efa19f3081417bfb6a1de30c55e4_check-runs-3.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/mappings/repos_hub4j_github-api_commits_54d60fbb53b4efa19f3081417bfb6a1de30c55e4_check-runs-3.json new file mode 100644 index 0000000000..0abd669562 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCheckRunsWithParams/mappings/repos_hub4j_github-api_commits_54d60fbb53b4efa19f3081417bfb6a1de30c55e4_check-runs-3.json @@ -0,0 +1,46 @@ +{ + "id": "6f217f80-e2fa-4a54-b6ab-b110055d776a", + "name": "repos_hub4j_github-api_commits_54d60fbb53b4efa19f3081417bfb6a1de30c55e4_check-runs", + "request": { + "url": "/repos/hub4j/github-api/commits/54d60fbb53b4efa19f3081417bfb6a1de30c55e4/check-runs?check_name=build-only+%28Java+17%29", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.antiope-preview+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_hub4j_github-api_commits_54d60fbb53b4efa19f3081417bfb6a1de30c55e4_check-runs-3.json", + "headers": { + "Cache-Control": "public, max-age=60, s-maxage=60", + "Content-Security-Policy": "default-src 'none'", + "Content-Type": "application/json; charset=utf-8", + "Date": "Wed, 01 Feb 2023 15:33:02 GMT", + "ETag": "W/\"76cd89479af94fc294b78ddf876c317b67b20fd89ba6543f5464caa19cf0aa75\"", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Server": "GitHub.com", + "Status": "200 OK", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "Vary": [ + "Accept", + "Accept-Encoding, Accept, X-Requested-With" + ], + "X-Content-Type-Options": "nosniff", + "X-Frame-Options": "deny", + "X-GitHub-Media-Type": "github.v3; format=json", + "X-GitHub-Request-Id": "D57A:94E6:41F9B6:4310EC:63DA862D", + "X-RateLimit-Limit": "60", + "X-RateLimit-Remaining": "55", + "X-RateLimit-Reset": "1675267093", + "X-XSS-Protection": "0" + } + }, + "uuid": "6f217f80-e2fa-4a54-b6ab-b110055d776a", + "persistent": true, + "scenarioName": "scenario-1-repos-github-api-github-api-commits-54d60fbb53b4efa19f3081417bfb6a1de30c55e4-check-runs", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-1-repos-github-api-github-api-commits-54d60fbb53b4efa19f3081417bfb6a1de30c55e4-check-runs-2", + "insertionIndex": 3 +}