diff --git a/src/main/java/org/kohsuke/github/GHAutolink.java b/src/main/java/org/kohsuke/github/GHAutolink.java new file mode 100644 index 0000000000..841f1d0f65 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHAutolink.java @@ -0,0 +1,100 @@ +package org.kohsuke.github; + +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + +import java.io.IOException; + +/** + * Represents a GitHub repository autolink reference. + * + * @author Alaurant + * @see GHAutolinkBuilder + * @see GHRepository#listAutolinks() GHRepository#listAutolinks() + * @see Repository autolinks API + */ +public class GHAutolink { + + private int id; + private String key_prefix; + private String url_template; + private boolean is_alphanumeric; + private GHRepository owner; + + /** + * Instantiates a new Gh autolink. + */ + public GHAutolink() { + } + + /** + * Gets the autolink ID + * + * @return the id + */ + public int getId() { + return id; + } + + /** + * Gets the key prefix used to identify issues/PR references + * + * @return the key prefix string + */ + public String getKeyPrefix() { + return key_prefix; + } + + /** + * Gets the URL template that will be used for matching + * + * @return the URL template string + */ + public String getUrlTemplate() { + return url_template; + } + + /** + * Checks if the autolink uses alphanumeric values + * + * @return true if alphanumeric, false otherwise + */ + public boolean isAlphanumeric() { + return is_alphanumeric; + } + + /** + * Gets the repository that owns this autolink + * + * @return the repository instance + */ + @SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior") + public GHRepository getOwner() { + return owner; + } + + /** + * Deletes this autolink + * + * @throws IOException + * if the deletion fails + */ + public void delete() throws IOException { + owner.root() + .createRequest() + .method("DELETE") + .withUrlPath(String.format("/repos/%s/%s/autolinks/%d", owner.getOwnerName(), owner.getName(), getId())) + .send(); + } + + /** + * Wraps this autolink with its owner repository. + * + * @param owner + * the repository that owns this autolink + * @return this instance + */ + GHAutolink lateBind(GHRepository owner) { + this.owner = owner; + return this; + } +} diff --git a/src/main/java/org/kohsuke/github/GHAutolinkBuilder.java b/src/main/java/org/kohsuke/github/GHAutolinkBuilder.java new file mode 100644 index 0000000000..3082d9487d --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHAutolinkBuilder.java @@ -0,0 +1,90 @@ +package org.kohsuke.github; + +import java.io.IOException; + +// TODO: Auto-generated Javadoc +/** + * The type Gh autolink builder. + * + * @see GHRepository#createAutolink() + * @see GHAutolink + */ +public class GHAutolinkBuilder { + + private final GHRepository repo; + private final Requester req; + private String keyPrefix; + private String urlTemplate; + private Boolean isAlphanumeric; + + /** + * Instantiates a new Gh autolink builder. + * + * @param repo + * the repo + */ + GHAutolinkBuilder(GHRepository repo) { + this.repo = repo; + req = repo.root().createRequest(); + } + + /** + * With key prefix gh autolink builder. + * + * @param keyPrefix + * the key prefix + * @return the gh autolink builder + */ + public GHAutolinkBuilder withKeyPrefix(String keyPrefix) { + this.keyPrefix = keyPrefix; + return this; + } + + /** + * With url template gh autolink builder. + * + * @param urlTemplate + * the url template + * @return the gh autolink builder + */ + public GHAutolinkBuilder withUrlTemplate(String urlTemplate) { + this.urlTemplate = urlTemplate; + return this; + } + + /** + * With is alphanumeric gh autolink builder. + * + * @param isAlphanumeric + * the is alphanumeric + * @return the gh autolink builder + */ + public GHAutolinkBuilder withIsAlphanumeric(boolean isAlphanumeric) { + this.isAlphanumeric = isAlphanumeric; + return this; + } + + private String getApiTail() { + return String.format("/repos/%s/%s/autolinks", repo.getOwnerName(), repo.getName()); + } + + /** + * Create gh autolink. + * + * @return the gh autolink + * @throws IOException + * the io exception + */ + public GHAutolink create() throws IOException { + GHAutolink autolink = req.method("POST") + .with("key_prefix", keyPrefix) + .with("url_template", urlTemplate) + .with("is_alphanumeric", isAlphanumeric) + .withHeader("Accept", "application/vnd.github+json") + .withUrlPath(getApiTail()) + .fetch(GHAutolink.class); + + return autolink.lateBind(repo); + } + +} diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index 305dadcf7a..ab60eafb86 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -3375,4 +3375,64 @@ protected Setter(@Nonnull GHRepository repository) { requester.method("PATCH").withUrlPath(repository.getApiTailUrl("")); } } + + /** + * Create an autolink gh autolink builder. + * + * @return the gh autolink builder + */ + public GHAutolinkBuilder createAutolink() { + return new GHAutolinkBuilder(this); + } + + /** + * List all autolinks of a repo (admin only). + * (https://docs.github.com/en/rest/repos/autolinks?apiVersion=2022-11-28#get-all-autolinks-of-a-repository) + * + * @return all autolinks in the repo + * @throws IOException + * the io exception + */ + public PagedIterable listAutolinks() throws IOException { + return root().createRequest() + .withHeader("Accept", "application/vnd.github+json") + .withUrlPath(String.format("/repos/%s/%s/autolinks", getOwnerName(), getName())) + .toIterable(GHAutolink[].class, item -> item.lateBind(this)); + } + + /** + * Read an autolink by ID. + * (https://docs.github.com/en/rest/repos/autolinks?apiVersion=2022-11-28#get-an-autolink-reference-of-a-repository) + * + * @param autolinkId + * the autolink id + * @return the autolink + * @throws IOException + * the io exception + */ + public GHAutolink readAutolink(int autolinkId) throws IOException { + return root().createRequest() + .withHeader("Accept", "application/vnd.github+json") + .withUrlPath(String.format("/repos/%s/%s/autolinks/%d", getOwnerName(), getName(), autolinkId)) + .fetch(GHAutolink.class) + .lateBind(this); + } + + /** + * Delete autolink. + * (https://docs.github.com/en/rest/repos/autolinks?apiVersion=2022-11-28#delete-an-autolink-reference-from-a-repository) + * + * @param autolinkId + * the autolink id + * @throws IOException + * the io exception + */ + public void deleteAutolink(int autolinkId) throws IOException { + root().createRequest() + .method("DELETE") + .withHeader("Accept", "application/vnd.github+json") + .withUrlPath(String.format("/repos/%s/%s/autolinks/%d", getOwnerName(), getName(), autolinkId)) + .send(); + } + } diff --git a/src/test/java/org/kohsuke/github/GHAutolinkTest.java b/src/test/java/org/kohsuke/github/GHAutolinkTest.java new file mode 100644 index 0000000000..8a09e5b22d --- /dev/null +++ b/src/test/java/org/kohsuke/github/GHAutolinkTest.java @@ -0,0 +1,208 @@ +package org.kohsuke.github; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.util.List; + +import static org.hamcrest.Matchers.*; + +// TODO: Auto-generated Javadoc +/** + * The type Gh autolink test. + */ +public class GHAutolinkTest extends AbstractGitHubWireMockTest { + + private GHRepository repo; + + /** + * Instantiates a new Gh autolink test. + */ + public GHAutolinkTest() { + } + + /** + * Sets up. + * + * @throws Exception + * the exception + */ + @Before + public void setUp() throws Exception { + repo = gitHub.getRepository("Alaurant/github-api-test"); + if (repo == null) { + throw new IllegalStateException("Failed to initialize repository"); + } + } + + /** + * Test create autolink. + * + * @throws Exception + * the exception + */ + @Test + public void testCreateAutolink() throws Exception { + String keyPrefix = "EXAMPLE-"; + String urlTemplate = "https://example.com/TICKET?q="; + boolean isAlphanumeric = true; + + GHAutolink autolink = repo.createAutolink() + .withKeyPrefix(keyPrefix) + .withUrlTemplate(urlTemplate) + .withIsAlphanumeric(isAlphanumeric) + .create(); + + assertThat(autolink.getId(), notNullValue()); + assertThat(autolink.getKeyPrefix(), equalTo(keyPrefix)); + assertThat(autolink.getUrlTemplate(), equalTo(urlTemplate)); + assertThat(autolink.isAlphanumeric(), equalTo(isAlphanumeric)); + assertThat(autolink.getOwner(), equalTo(repo)); + + autolink.delete(); + + } + + /** + * Test get autolink. + * + * @throws Exception + * the exception + */ + @Test + public void testReadAutolink() throws Exception { + GHAutolink autolink = repo.createAutolink() + .withKeyPrefix("JIRA-") + .withUrlTemplate("https://example.com/test/") + .withIsAlphanumeric(false) + .create(); + + GHAutolink fetched = repo.readAutolink(autolink.getId()); + + assertThat(fetched.getId(), equalTo(autolink.getId())); + assertThat(fetched.getKeyPrefix(), equalTo(autolink.getKeyPrefix())); + assertThat(fetched.getUrlTemplate(), equalTo(autolink.getUrlTemplate())); + assertThat(fetched.isAlphanumeric(), equalTo(autolink.isAlphanumeric())); + assertThat(fetched.getOwner(), equalTo(repo)); + + autolink.delete(); + + } + + /** + * Test get autolinks. + * + * @throws Exception + * the exception + */ + @Test + public void testListAllAutolinks() throws Exception { + assertThat("Initial autolinks list", repo.listAutolinks().toList(), is(empty())); + + GHAutolink autolink1 = repo.createAutolink() + .withKeyPrefix("LIST-") + .withUrlTemplate("https://example.com/list1/") + .withIsAlphanumeric(true) + .create(); + + GHAutolink autolink2 = repo.createAutolink() + .withKeyPrefix("LISTED-") + .withUrlTemplate("https://example.com/list2/") + .withIsAlphanumeric(false) + .create(); + + boolean found1 = false; + boolean found2 = false; + + PagedIterable autolinks = repo.listAutolinks(); + + List autolinkList = autolinks.toList(); + assertThat("Number of autolinks", autolinkList.size(), is(2)); + + for (GHAutolink autolink : autolinkList) { + + if (autolink.getId() == autolink1.getId()) { + found1 = true; + assertThat(autolink.getKeyPrefix(), equalTo(autolink1.getKeyPrefix())); + assertThat(autolink.getUrlTemplate(), equalTo(autolink1.getUrlTemplate())); + assertThat(autolink.isAlphanumeric(), equalTo(autolink1.isAlphanumeric())); + } + if (autolink.getId() == autolink2.getId()) { + found2 = true; + assertThat(autolink.getKeyPrefix(), equalTo(autolink2.getKeyPrefix())); + assertThat(autolink.getUrlTemplate(), equalTo(autolink2.getUrlTemplate())); + assertThat(autolink.isAlphanumeric(), equalTo(autolink2.isAlphanumeric())); + } + } + + assertThat("First autolink", found1, is(true)); + assertThat("Second autolink", found2, is(true)); + + } + + /** + * Test delete autolink. + * + * @throws Exception + * the exception + */ + @Test + public void testDeleteAutolink() throws Exception { + // Delete autolink using the instance method + GHAutolink autolink = repo.createAutolink() + .withKeyPrefix("DELETE-") + .withUrlTemplate("https://example.com/delete/") + .withIsAlphanumeric(true) + .create(); + + autolink.delete(); + + try { + repo.readAutolink(autolink.getId()); + fail("Expected GHFileNotFoundException"); + } catch (GHFileNotFoundException e) { + // Expected + } + + // Delete autolink using repository delete method + autolink = repo.createAutolink() + .withKeyPrefix("DELETED-") + .withUrlTemplate("https://example.com/delete2/") + .withIsAlphanumeric(true) + .create(); + + repo.deleteAutolink(autolink.getId()); + + try { + repo.readAutolink(autolink.getId()); + fail("Expected GHFileNotFoundException"); + } catch (GHFileNotFoundException e) { + // Expected + } + } + + /** + * Cleanup. + * + * @throws Exception + * the exception + */ + @After + public void cleanup() throws Exception { + if (repo != null) { + try { + PagedIterable autolinks = repo.listAutolinks(); + for (GHAutolink autolink : autolinks) { + try { + autolink.delete(); + } catch (Exception e) { + System.err.println("Failed to delete autolink: " + e.getMessage()); + } + } + } catch (Exception e) { + System.err.println("Cleanup failed: " + e.getMessage()); + } + } + } +} diff --git a/src/test/resources/no-reflect-and-serialization-list b/src/test/resources/no-reflect-and-serialization-list index e1e4fa2e0d..8e6ceafcdb 100644 --- a/src/test/resources/no-reflect-and-serialization-list +++ b/src/test/resources/no-reflect-and-serialization-list @@ -81,4 +81,6 @@ org.kohsuke.github.function.SupplierThrows org.kohsuke.github.internal.DefaultGitHubConnector org.kohsuke.github.internal.EnumUtils org.kohsuke.github.internal.Previews -org.kohsuke.github.EnterpriseManagedSupport \ No newline at end of file +org.kohsuke.github.EnterpriseManagedSupport +org.kohsuke.github.GHAutolink +org.kohsuke.github.GHAutolinkBuilder \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/__files/1-user.json new file mode 100644 index 0000000000..0764c5a936 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/__files/1-user.json @@ -0,0 +1,48 @@ +{ + "login": "Alaurant", + "id": 41817560, + "node_id": "MDQ6VXNlcjQxODE3NTYw", + "avatar_url": "https://avatars.githubusercontent.com/u/41817560?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Alaurant", + "html_url": "https://github.com/Alaurant", + "followers_url": "https://api.github.com/users/Alaurant/followers", + "following_url": "https://api.github.com/users/Alaurant/following{/other_user}", + "gists_url": "https://api.github.com/users/Alaurant/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Alaurant/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Alaurant/subscriptions", + "organizations_url": "https://api.github.com/users/Alaurant/orgs", + "repos_url": "https://api.github.com/users/Alaurant/repos", + "events_url": "https://api.github.com/users/Alaurant/events{/privacy}", + "received_events_url": "https://api.github.com/users/Alaurant/received_events", + "type": "User", + "user_view_type": "private", + "site_admin": false, + "name": "Danyang Zhao", + "company": null, + "blog": "", + "location": null, + "email": null, + "hireable": null, + "bio": null, + "twitter_username": null, + "notification_email": null, + "public_repos": 7, + "public_gists": 0, + "followers": 3, + "following": 8, + "created_at": "2018-07-28T07:03:48Z", + "updated_at": "2024-11-27T04:01:41Z", + "private_gists": 0, + "total_private_repos": 3, + "owned_private_repos": 3, + "disk_usage": 7314, + "collaborators": 0, + "two_factor_authentication": false, + "plan": { + "name": "pro", + "space": 976562499, + "collaborators": 0, + "private_repos": 9999 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/__files/2-r_a_github-api-test.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/__files/2-r_a_github-api-test.json new file mode 100644 index 0000000000..00da15691e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/__files/2-r_a_github-api-test.json @@ -0,0 +1,122 @@ +{ + "id": 895799232, + "node_id": "R_kgDONWTPwA", + "name": "github-api-test", + "full_name": "Alaurant/github-api-test", + "private": true, + "owner": { + "login": "Alaurant", + "id": 41817560, + "node_id": "MDQ6VXNlcjQxODE3NTYw", + "avatar_url": "https://avatars.githubusercontent.com/u/41817560?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Alaurant", + "html_url": "https://github.com/Alaurant", + "followers_url": "https://api.github.com/users/Alaurant/followers", + "following_url": "https://api.github.com/users/Alaurant/following{/other_user}", + "gists_url": "https://api.github.com/users/Alaurant/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Alaurant/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Alaurant/subscriptions", + "organizations_url": "https://api.github.com/users/Alaurant/orgs", + "repos_url": "https://api.github.com/users/Alaurant/repos", + "events_url": "https://api.github.com/users/Alaurant/events{/privacy}", + "received_events_url": "https://api.github.com/users/Alaurant/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/Alaurant/github-api-test", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/Alaurant/github-api-test", + "forks_url": "https://api.github.com/repos/Alaurant/github-api-test/forks", + "keys_url": "https://api.github.com/repos/Alaurant/github-api-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/Alaurant/github-api-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/Alaurant/github-api-test/teams", + "hooks_url": "https://api.github.com/repos/Alaurant/github-api-test/hooks", + "issue_events_url": "https://api.github.com/repos/Alaurant/github-api-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/Alaurant/github-api-test/events", + "assignees_url": "https://api.github.com/repos/Alaurant/github-api-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/Alaurant/github-api-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/Alaurant/github-api-test/tags", + "blobs_url": "https://api.github.com/repos/Alaurant/github-api-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/Alaurant/github-api-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/Alaurant/github-api-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/Alaurant/github-api-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/Alaurant/github-api-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/Alaurant/github-api-test/languages", + "stargazers_url": "https://api.github.com/repos/Alaurant/github-api-test/stargazers", + "contributors_url": "https://api.github.com/repos/Alaurant/github-api-test/contributors", + "subscribers_url": "https://api.github.com/repos/Alaurant/github-api-test/subscribers", + "subscription_url": "https://api.github.com/repos/Alaurant/github-api-test/subscription", + "commits_url": "https://api.github.com/repos/Alaurant/github-api-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/Alaurant/github-api-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/Alaurant/github-api-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/Alaurant/github-api-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/Alaurant/github-api-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/Alaurant/github-api-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/Alaurant/github-api-test/merges", + "archive_url": "https://api.github.com/repos/Alaurant/github-api-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/Alaurant/github-api-test/downloads", + "issues_url": "https://api.github.com/repos/Alaurant/github-api-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/Alaurant/github-api-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/Alaurant/github-api-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/Alaurant/github-api-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/Alaurant/github-api-test/labels{/name}", + "releases_url": "https://api.github.com/repos/Alaurant/github-api-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/Alaurant/github-api-test/deployments", + "created_at": "2024-11-28T23:44:54Z", + "updated_at": "2024-11-28T23:44:55Z", + "pushed_at": "2024-11-28T23:44:55Z", + "git_url": "git://github.com/Alaurant/github-api-test.git", + "ssh_url": "git@github.com:Alaurant/github-api-test.git", + "clone_url": "https://github.com/Alaurant/github-api-test.git", + "svn_url": "https://github.com/Alaurant/github-api-test", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 3, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "private", + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "main", + "permissions": { + "admin": true, + "maintain": true, + "push": true, + "triage": true, + "pull": true + }, + "temp_clone_token": "AJ7BLWEW6YP5EUIYTPGKLMDHJ6O5M", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "network_count": 0, + "subscribers_count": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/mappings/1-user.json new file mode 100644 index 0000000000..dcaa3400f1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/mappings/1-user.json @@ -0,0 +1,48 @@ +{ + "id": "5efad309-8a6e-4bea-b5d3-f558468cde2f", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:58 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"8bdc3eaf7312491c8eb245323f2eb3004212814ef5f8184104effa4b32f6b27c\"", + "Last-Modified": "Wed, 27 Nov 2024 04:01:41 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4964", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "36", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB4B:259AD1:AD6A0A:CCA3BA:674F9CA9" + } + }, + "uuid": "5efad309-8a6e-4bea-b5d3-f558468cde2f", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/mappings/2-r_a_github-api-test.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/mappings/2-r_a_github-api-test.json new file mode 100644 index 0000000000..b3799cfac2 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/mappings/2-r_a_github-api-test.json @@ -0,0 +1,48 @@ +{ + "id": "7b4379d6-4382-4589-a8de-6c179a3b878e", + "name": "repos_alaurant_github-api-test", + "request": { + "url": "/repos/Alaurant/github-api-test", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-r_a_github-api-test.json", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:58 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"94ad6f4d71086bda8c2640d1ba979adc705c9465218c4ca1e55dc20011962ee7\"", + "Last-Modified": "Thu, 28 Nov 2024 23:44:55 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4962", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "38", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB4F:261CA8:B9F4DA:D92EA2:674F9CAA" + } + }, + "uuid": "7b4379d6-4382-4589-a8de-6c179a3b878e", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/mappings/3-r_a_g_autolinks.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/mappings/3-r_a_g_autolinks.json new file mode 100644 index 0000000000..882605d3e0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/mappings/3-r_a_g_autolinks.json @@ -0,0 +1,54 @@ +{ + "id": "72c0b399-ca4c-4934-bb37-204fb2eee65c", + "name": "repos_alaurant_github-api-test_autolinks", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"key_prefix\":\"EXAMPLE-\",\"url_template\":\"https://example.com/TICKET?q=\",\"is_alphanumeric\":true}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "body": "{\"id\":6214215,\"key_prefix\":\"EXAMPLE-\",\"url_template\":\"https://example.com/TICKET?q=\",\"is_alphanumeric\":true}", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:59 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "\"5957fc62ce793c3c3f204807841c0322d186ec5693b11e746a2a773ff4814345\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4961", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "39", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB50:25FB34:AFAC50:CEE61E:674F9CAB" + } + }, + "uuid": "72c0b399-ca4c-4934-bb37-204fb2eee65c", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/mappings/4-r_a_g_autolinks_6214215.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/mappings/4-r_a_g_autolinks_6214215.json new file mode 100644 index 0000000000..e3e2b0ee75 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/mappings/4-r_a_g_autolinks_6214215.json @@ -0,0 +1,43 @@ +{ + "id": "e6f3b690-7bba-4fca-af09-bb9c36c226c2", + "name": "repos_alaurant_github-api-test_autolinks_6214215", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks/6214215", + "method": "DELETE", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 204, + "headers": { + "Date": "Wed, 04 Dec 2024 00:05:00 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4960", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "40", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "Server": "github.com", + "X-GitHub-Request-Id": "AB54:25C9E5:B594DE:D4CE98:674F9CAC" + } + }, + "uuid": "e6f3b690-7bba-4fca-af09-bb9c36c226c2", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/mappings/5-r_a_g_autolinks.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/mappings/5-r_a_g_autolinks.json new file mode 100644 index 0000000000..3205f0a148 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testCreateAutolink/mappings/5-r_a_g_autolinks.json @@ -0,0 +1,47 @@ +{ + "id": "4e99e7cf-51c0-42eb-aac3-11c71370da7d", + "name": "repos_alaurant_github-api-test_autolinks", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "body": "[]", + "headers": { + "Date": "Wed, 04 Dec 2024 00:05:00 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "\"5b744729737bd28d14aeb327919c263d8af99640a7701726d7b2320a638b5c76\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4959", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "41", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB58:2616CE:B40D89:D3475B:674F9CAC" + } + }, + "uuid": "4e99e7cf-51c0-42eb-aac3-11c71370da7d", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/__files/1-user.json new file mode 100644 index 0000000000..0764c5a936 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/__files/1-user.json @@ -0,0 +1,48 @@ +{ + "login": "Alaurant", + "id": 41817560, + "node_id": "MDQ6VXNlcjQxODE3NTYw", + "avatar_url": "https://avatars.githubusercontent.com/u/41817560?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Alaurant", + "html_url": "https://github.com/Alaurant", + "followers_url": "https://api.github.com/users/Alaurant/followers", + "following_url": "https://api.github.com/users/Alaurant/following{/other_user}", + "gists_url": "https://api.github.com/users/Alaurant/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Alaurant/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Alaurant/subscriptions", + "organizations_url": "https://api.github.com/users/Alaurant/orgs", + "repos_url": "https://api.github.com/users/Alaurant/repos", + "events_url": "https://api.github.com/users/Alaurant/events{/privacy}", + "received_events_url": "https://api.github.com/users/Alaurant/received_events", + "type": "User", + "user_view_type": "private", + "site_admin": false, + "name": "Danyang Zhao", + "company": null, + "blog": "", + "location": null, + "email": null, + "hireable": null, + "bio": null, + "twitter_username": null, + "notification_email": null, + "public_repos": 7, + "public_gists": 0, + "followers": 3, + "following": 8, + "created_at": "2018-07-28T07:03:48Z", + "updated_at": "2024-11-27T04:01:41Z", + "private_gists": 0, + "total_private_repos": 3, + "owned_private_repos": 3, + "disk_usage": 7314, + "collaborators": 0, + "two_factor_authentication": false, + "plan": { + "name": "pro", + "space": 976562499, + "collaborators": 0, + "private_repos": 9999 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/__files/2-r_a_github-api-test.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/__files/2-r_a_github-api-test.json new file mode 100644 index 0000000000..f105aebb35 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/__files/2-r_a_github-api-test.json @@ -0,0 +1,122 @@ +{ + "id": 895799232, + "node_id": "R_kgDONWTPwA", + "name": "github-api-test", + "full_name": "Alaurant/github-api-test", + "private": true, + "owner": { + "login": "Alaurant", + "id": 41817560, + "node_id": "MDQ6VXNlcjQxODE3NTYw", + "avatar_url": "https://avatars.githubusercontent.com/u/41817560?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Alaurant", + "html_url": "https://github.com/Alaurant", + "followers_url": "https://api.github.com/users/Alaurant/followers", + "following_url": "https://api.github.com/users/Alaurant/following{/other_user}", + "gists_url": "https://api.github.com/users/Alaurant/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Alaurant/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Alaurant/subscriptions", + "organizations_url": "https://api.github.com/users/Alaurant/orgs", + "repos_url": "https://api.github.com/users/Alaurant/repos", + "events_url": "https://api.github.com/users/Alaurant/events{/privacy}", + "received_events_url": "https://api.github.com/users/Alaurant/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/Alaurant/github-api-test", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/Alaurant/github-api-test", + "forks_url": "https://api.github.com/repos/Alaurant/github-api-test/forks", + "keys_url": "https://api.github.com/repos/Alaurant/github-api-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/Alaurant/github-api-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/Alaurant/github-api-test/teams", + "hooks_url": "https://api.github.com/repos/Alaurant/github-api-test/hooks", + "issue_events_url": "https://api.github.com/repos/Alaurant/github-api-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/Alaurant/github-api-test/events", + "assignees_url": "https://api.github.com/repos/Alaurant/github-api-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/Alaurant/github-api-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/Alaurant/github-api-test/tags", + "blobs_url": "https://api.github.com/repos/Alaurant/github-api-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/Alaurant/github-api-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/Alaurant/github-api-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/Alaurant/github-api-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/Alaurant/github-api-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/Alaurant/github-api-test/languages", + "stargazers_url": "https://api.github.com/repos/Alaurant/github-api-test/stargazers", + "contributors_url": "https://api.github.com/repos/Alaurant/github-api-test/contributors", + "subscribers_url": "https://api.github.com/repos/Alaurant/github-api-test/subscribers", + "subscription_url": "https://api.github.com/repos/Alaurant/github-api-test/subscription", + "commits_url": "https://api.github.com/repos/Alaurant/github-api-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/Alaurant/github-api-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/Alaurant/github-api-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/Alaurant/github-api-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/Alaurant/github-api-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/Alaurant/github-api-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/Alaurant/github-api-test/merges", + "archive_url": "https://api.github.com/repos/Alaurant/github-api-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/Alaurant/github-api-test/downloads", + "issues_url": "https://api.github.com/repos/Alaurant/github-api-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/Alaurant/github-api-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/Alaurant/github-api-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/Alaurant/github-api-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/Alaurant/github-api-test/labels{/name}", + "releases_url": "https://api.github.com/repos/Alaurant/github-api-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/Alaurant/github-api-test/deployments", + "created_at": "2024-11-28T23:44:54Z", + "updated_at": "2024-11-28T23:44:55Z", + "pushed_at": "2024-11-28T23:44:55Z", + "git_url": "git://github.com/Alaurant/github-api-test.git", + "ssh_url": "git@github.com:Alaurant/github-api-test.git", + "clone_url": "https://github.com/Alaurant/github-api-test.git", + "svn_url": "https://github.com/Alaurant/github-api-test", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 3, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "private", + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "main", + "permissions": { + "admin": true, + "maintain": true, + "push": true, + "triage": true, + "pull": true + }, + "temp_clone_token": "AJ7BLWHAAPA4X3QOA36CYTLHJ6O4S", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "network_count": 0, + "subscribers_count": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/1-user.json new file mode 100644 index 0000000000..c37d3842de --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/1-user.json @@ -0,0 +1,48 @@ +{ + "id": "cb401d70-c07b-4a80-9333-fd2598ce4873", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:44 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"8bdc3eaf7312491c8eb245323f2eb3004212814ef5f8184104effa4b32f6b27c\"", + "Last-Modified": "Wed, 27 Nov 2024 04:01:41 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4991", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "9", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AAFC:32381D:19A4CC:1E52E3:674F9C9C" + } + }, + "uuid": "cb401d70-c07b-4a80-9333-fd2598ce4873", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/2-r_a_github-api-test.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/2-r_a_github-api-test.json new file mode 100644 index 0000000000..c9bb698e1c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/2-r_a_github-api-test.json @@ -0,0 +1,48 @@ +{ + "id": "b4bf2f34-49d5-4aae-9962-b72cc46196c9", + "name": "repos_alaurant_github-api-test", + "request": { + "url": "/repos/Alaurant/github-api-test", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-r_a_github-api-test.json", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:45 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"94ad6f4d71086bda8c2640d1ba979adc705c9465218c4ca1e55dc20011962ee7\"", + "Last-Modified": "Thu, 28 Nov 2024 23:44:55 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4989", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "11", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB01:275BE1:A9865C:C65840:674F9C9D" + } + }, + "uuid": "b4bf2f34-49d5-4aae-9962-b72cc46196c9", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/3-r_a_g_autolinks.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/3-r_a_g_autolinks.json new file mode 100644 index 0000000000..d09a8054a3 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/3-r_a_g_autolinks.json @@ -0,0 +1,54 @@ +{ + "id": "9a5172dd-9af1-4543-9140-8ca5aeaa4aaa", + "name": "repos_alaurant_github-api-test_autolinks", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"key_prefix\":\"DELETE-\",\"url_template\":\"https://example.com/delete/\",\"is_alphanumeric\":true}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "body": "{\"id\":6214199,\"key_prefix\":\"DELETE-\",\"url_template\":\"https://example.com/delete/\",\"is_alphanumeric\":true}", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:45 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "\"a956fdb6994525df51a1d05464cca2bbfcfddd6b16580a60ebed7bee5c481b1c\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4988", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "12", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB05:25FB34:AFA666:CEDF6C:674F9C9D" + } + }, + "uuid": "9a5172dd-9af1-4543-9140-8ca5aeaa4aaa", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/4-r_a_g_autolinks_6214199.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/4-r_a_g_autolinks_6214199.json new file mode 100644 index 0000000000..6a7c9a740c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/4-r_a_g_autolinks_6214199.json @@ -0,0 +1,43 @@ +{ + "id": "cb5eb0d7-aa5f-4dec-8e47-8443c7b5eb2b", + "name": "repos_alaurant_github-api-test_autolinks_6214199", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks/6214199", + "method": "DELETE", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 204, + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:46 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4987", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "13", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "Server": "github.com", + "X-GitHub-Request-Id": "AB06:25DAE6:BD28AF:DC61D9:674F9C9E" + } + }, + "uuid": "cb5eb0d7-aa5f-4dec-8e47-8443c7b5eb2b", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/5-r_a_g_autolinks_6214199.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/5-r_a_g_autolinks_6214199.json new file mode 100644 index 0000000000..5f8cdf41c6 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/5-r_a_g_autolinks_6214199.json @@ -0,0 +1,45 @@ +{ + "id": "bf5f8e71-e7c3-4fd9-a76e-8dcda49d68f0", + "name": "repos_alaurant_github-api-test_autolinks_6214199", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks/6214199", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 404, + "body": "{\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/repos/autolinks#get-an-autolink-reference-of-a-repository\",\"status\":\"404\"}", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:46 GMT", + "Content-Type": "application/json; charset=utf-8", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4986", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "14", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "Server": "github.com", + "X-GitHub-Request-Id": "AB07:25A8FF:B72F38:D66845:674F9C9E" + } + }, + "uuid": "bf5f8e71-e7c3-4fd9-a76e-8dcda49d68f0", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/6-r_a_g_autolinks.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/6-r_a_g_autolinks.json new file mode 100644 index 0000000000..a11816818d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/6-r_a_g_autolinks.json @@ -0,0 +1,54 @@ +{ + "id": "c5607014-5b7d-4cf5-9970-c1c5751cdf9c", + "name": "repos_alaurant_github-api-test_autolinks", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"key_prefix\":\"DELETED-\",\"url_template\":\"https://example.com/delete2/\",\"is_alphanumeric\":true}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "body": "{\"id\":6214204,\"key_prefix\":\"DELETED-\",\"url_template\":\"https://example.com/delete2/\",\"is_alphanumeric\":true}", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:47 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "\"b344c6f9525e0a7606c9736c32b24c4bb94a746a58a0918a467d874462159497\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4985", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "15", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB0B:2377CB:ADCDF0:CBC78F:674F9C9F" + } + }, + "uuid": "c5607014-5b7d-4cf5-9970-c1c5751cdf9c", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/7-r_a_g_autolinks_6214204.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/7-r_a_g_autolinks_6214204.json new file mode 100644 index 0000000000..5e7e325c90 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/7-r_a_g_autolinks_6214204.json @@ -0,0 +1,43 @@ +{ + "id": "82bde32d-073f-4740-9cca-06e6ad4ca563", + "name": "repos_alaurant_github-api-test_autolinks_6214204", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks/6214204", + "method": "DELETE", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 204, + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:47 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "16", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "Server": "github.com", + "X-GitHub-Request-Id": "AB0C:321638:1E70D8:241378:674F9C9F" + } + }, + "uuid": "82bde32d-073f-4740-9cca-06e6ad4ca563", + "persistent": true, + "insertionIndex": 7 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/8-r_a_g_autolinks_6214204.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/8-r_a_g_autolinks_6214204.json new file mode 100644 index 0000000000..d8e8b74f51 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/8-r_a_g_autolinks_6214204.json @@ -0,0 +1,45 @@ +{ + "id": "f41b31b6-2e5d-48f9-881b-0f96caab4c70", + "name": "repos_alaurant_github-api-test_autolinks_6214204", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks/6214204", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 404, + "body": "{\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/repos/autolinks#get-an-autolink-reference-of-a-repository\",\"status\":\"404\"}", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:48 GMT", + "Content-Type": "application/json; charset=utf-8", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "17", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "Server": "github.com", + "X-GitHub-Request-Id": "AB10:275BE1:A987C7:C659CB:674F9CA0" + } + }, + "uuid": "f41b31b6-2e5d-48f9-881b-0f96caab4c70", + "persistent": true, + "insertionIndex": 8 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/9-r_a_g_autolinks.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/9-r_a_g_autolinks.json new file mode 100644 index 0000000000..84c8a5d76a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testDeleteAutolink/mappings/9-r_a_g_autolinks.json @@ -0,0 +1,47 @@ +{ + "id": "dd326434-5694-4484-80e4-d2a63d84daf0", + "name": "repos_alaurant_github-api-test_autolinks", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "body": "[]", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:49 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "\"5b744729737bd28d14aeb327919c263d8af99640a7701726d7b2320a638b5c76\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4982", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "18", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB11:25E009:B3D920:D3125C:674F9CA0" + } + }, + "uuid": "dd326434-5694-4484-80e4-d2a63d84daf0", + "persistent": true, + "insertionIndex": 9 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/__files/1-user.json new file mode 100644 index 0000000000..0764c5a936 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/__files/1-user.json @@ -0,0 +1,48 @@ +{ + "login": "Alaurant", + "id": 41817560, + "node_id": "MDQ6VXNlcjQxODE3NTYw", + "avatar_url": "https://avatars.githubusercontent.com/u/41817560?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Alaurant", + "html_url": "https://github.com/Alaurant", + "followers_url": "https://api.github.com/users/Alaurant/followers", + "following_url": "https://api.github.com/users/Alaurant/following{/other_user}", + "gists_url": "https://api.github.com/users/Alaurant/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Alaurant/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Alaurant/subscriptions", + "organizations_url": "https://api.github.com/users/Alaurant/orgs", + "repos_url": "https://api.github.com/users/Alaurant/repos", + "events_url": "https://api.github.com/users/Alaurant/events{/privacy}", + "received_events_url": "https://api.github.com/users/Alaurant/received_events", + "type": "User", + "user_view_type": "private", + "site_admin": false, + "name": "Danyang Zhao", + "company": null, + "blog": "", + "location": null, + "email": null, + "hireable": null, + "bio": null, + "twitter_username": null, + "notification_email": null, + "public_repos": 7, + "public_gists": 0, + "followers": 3, + "following": 8, + "created_at": "2018-07-28T07:03:48Z", + "updated_at": "2024-11-27T04:01:41Z", + "private_gists": 0, + "total_private_repos": 3, + "owned_private_repos": 3, + "disk_usage": 7314, + "collaborators": 0, + "two_factor_authentication": false, + "plan": { + "name": "pro", + "space": 976562499, + "collaborators": 0, + "private_repos": 9999 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/__files/2-r_a_github-api-test.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/__files/2-r_a_github-api-test.json new file mode 100644 index 0000000000..aea5d9d6e3 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/__files/2-r_a_github-api-test.json @@ -0,0 +1,122 @@ +{ + "id": 895799232, + "node_id": "R_kgDONWTPwA", + "name": "github-api-test", + "full_name": "Alaurant/github-api-test", + "private": true, + "owner": { + "login": "Alaurant", + "id": 41817560, + "node_id": "MDQ6VXNlcjQxODE3NTYw", + "avatar_url": "https://avatars.githubusercontent.com/u/41817560?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Alaurant", + "html_url": "https://github.com/Alaurant", + "followers_url": "https://api.github.com/users/Alaurant/followers", + "following_url": "https://api.github.com/users/Alaurant/following{/other_user}", + "gists_url": "https://api.github.com/users/Alaurant/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Alaurant/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Alaurant/subscriptions", + "organizations_url": "https://api.github.com/users/Alaurant/orgs", + "repos_url": "https://api.github.com/users/Alaurant/repos", + "events_url": "https://api.github.com/users/Alaurant/events{/privacy}", + "received_events_url": "https://api.github.com/users/Alaurant/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/Alaurant/github-api-test", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/Alaurant/github-api-test", + "forks_url": "https://api.github.com/repos/Alaurant/github-api-test/forks", + "keys_url": "https://api.github.com/repos/Alaurant/github-api-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/Alaurant/github-api-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/Alaurant/github-api-test/teams", + "hooks_url": "https://api.github.com/repos/Alaurant/github-api-test/hooks", + "issue_events_url": "https://api.github.com/repos/Alaurant/github-api-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/Alaurant/github-api-test/events", + "assignees_url": "https://api.github.com/repos/Alaurant/github-api-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/Alaurant/github-api-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/Alaurant/github-api-test/tags", + "blobs_url": "https://api.github.com/repos/Alaurant/github-api-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/Alaurant/github-api-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/Alaurant/github-api-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/Alaurant/github-api-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/Alaurant/github-api-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/Alaurant/github-api-test/languages", + "stargazers_url": "https://api.github.com/repos/Alaurant/github-api-test/stargazers", + "contributors_url": "https://api.github.com/repos/Alaurant/github-api-test/contributors", + "subscribers_url": "https://api.github.com/repos/Alaurant/github-api-test/subscribers", + "subscription_url": "https://api.github.com/repos/Alaurant/github-api-test/subscription", + "commits_url": "https://api.github.com/repos/Alaurant/github-api-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/Alaurant/github-api-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/Alaurant/github-api-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/Alaurant/github-api-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/Alaurant/github-api-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/Alaurant/github-api-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/Alaurant/github-api-test/merges", + "archive_url": "https://api.github.com/repos/Alaurant/github-api-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/Alaurant/github-api-test/downloads", + "issues_url": "https://api.github.com/repos/Alaurant/github-api-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/Alaurant/github-api-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/Alaurant/github-api-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/Alaurant/github-api-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/Alaurant/github-api-test/labels{/name}", + "releases_url": "https://api.github.com/repos/Alaurant/github-api-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/Alaurant/github-api-test/deployments", + "created_at": "2024-11-28T23:44:54Z", + "updated_at": "2024-11-28T23:44:55Z", + "pushed_at": "2024-11-28T23:44:55Z", + "git_url": "git://github.com/Alaurant/github-api-test.git", + "ssh_url": "git@github.com:Alaurant/github-api-test.git", + "clone_url": "https://github.com/Alaurant/github-api-test.git", + "svn_url": "https://github.com/Alaurant/github-api-test", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 3, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "private", + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "main", + "permissions": { + "admin": true, + "maintain": true, + "push": true, + "triage": true, + "pull": true + }, + "temp_clone_token": "AJ7BLWDDUCRCEJ6FDF6I2MDHJ6O44", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "network_count": 0, + "subscribers_count": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/1-user.json new file mode 100644 index 0000000000..27b9001e4c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/1-user.json @@ -0,0 +1,48 @@ +{ + "id": "e37bea15-a992-490d-abd4-9b62de05c88e", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:49 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"8bdc3eaf7312491c8eb245323f2eb3004212814ef5f8184104effa4b32f6b27c\"", + "Last-Modified": "Wed, 27 Nov 2024 04:01:41 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4981", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "19", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB1C:2616CE:B40940:D3426D:674F9CA1" + } + }, + "uuid": "e37bea15-a992-490d-abd4-9b62de05c88e", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/2-r_a_github-api-test.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/2-r_a_github-api-test.json new file mode 100644 index 0000000000..71b82fd4e4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/2-r_a_github-api-test.json @@ -0,0 +1,48 @@ +{ + "id": "6e30ba43-5316-46d1-9b80-53c527a53846", + "name": "repos_alaurant_github-api-test", + "request": { + "url": "/repos/Alaurant/github-api-test", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-r_a_github-api-test.json", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:50 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"94ad6f4d71086bda8c2640d1ba979adc705c9465218c4ca1e55dc20011962ee7\"", + "Last-Modified": "Thu, 28 Nov 2024 23:44:55 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4979", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "21", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB1D:32381D:19A7EC:1E5668:674F9CA2" + } + }, + "uuid": "6e30ba43-5316-46d1-9b80-53c527a53846", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/3-r_a_g_autolinks.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/3-r_a_g_autolinks.json new file mode 100644 index 0000000000..20ae14a08b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/3-r_a_g_autolinks.json @@ -0,0 +1,50 @@ +{ + "id": "bf0df31e-be26-4067-9a91-8f4c1e918c1c", + "name": "repos_alaurant_github-api-test_autolinks", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "body": "[]", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:51 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "\"5b744729737bd28d14aeb327919c263d8af99640a7701726d7b2320a638b5c76\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4978", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "22", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB21:253D9C:B16E05:D0A746:674F9CA3" + } + }, + "uuid": "bf0df31e-be26-4067-9a91-8f4c1e918c1c", + "persistent": true, + "scenarioName": "scenario-1-repos-Alaurant-github-api-test-autolinks", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-1-repos-Alaurant-github-api-test-autolinks-2", + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/4-r_a_g_autolinks.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/4-r_a_g_autolinks.json new file mode 100644 index 0000000000..c5bda9edcc --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/4-r_a_g_autolinks.json @@ -0,0 +1,54 @@ +{ + "id": "1c15b670-f893-4111-8f40-7e6843b3f3de", + "name": "repos_alaurant_github-api-test_autolinks", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"key_prefix\":\"LIST-\",\"url_template\":\"https://example.com/list1/\",\"is_alphanumeric\":true}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "body": "{\"id\":6214208,\"key_prefix\":\"LIST-\",\"url_template\":\"https://example.com/list1/\",\"is_alphanumeric\":true}", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:51 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "\"c9b6db3f807e7bc4bb09f6a2cff12454fad030e7b1bf5c73df256d1203c86438\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4977", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "23", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB22:261CA8:B9F17C:D92AD4:674F9CA3" + } + }, + "uuid": "1c15b670-f893-4111-8f40-7e6843b3f3de", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/5-r_a_g_autolinks.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/5-r_a_g_autolinks.json new file mode 100644 index 0000000000..0cc310c4be --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/5-r_a_g_autolinks.json @@ -0,0 +1,54 @@ +{ + "id": "7b65f4bc-bc7a-4fd9-92dd-9b0685cc61cd", + "name": "repos_alaurant_github-api-test_autolinks", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"key_prefix\":\"LISTED-\",\"url_template\":\"https://example.com/list2/\",\"is_alphanumeric\":false}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "body": "{\"id\":6214209,\"key_prefix\":\"LISTED-\",\"url_template\":\"https://example.com/list2/\",\"is_alphanumeric\":false}", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:52 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "\"afdd2654330781c9949511c99bff15109b2730f99b857072c555012912bbcd8b\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4976", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "24", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB26:25CB59:B00C2A:CF4583:674F9CA3" + } + }, + "uuid": "7b65f4bc-bc7a-4fd9-92dd-9b0685cc61cd", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/6-r_a_g_autolinks.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/6-r_a_g_autolinks.json new file mode 100644 index 0000000000..f122ac898e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/6-r_a_g_autolinks.json @@ -0,0 +1,50 @@ +{ + "id": "6b46543e-8784-4c36-970a-ed779fd6899b", + "name": "repos_alaurant_github-api-test_autolinks", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "body": "[{\"id\":6214208,\"key_prefix\":\"LIST-\",\"url_template\":\"https://example.com/list1/\",\"is_alphanumeric\":true},{\"id\":6214209,\"key_prefix\":\"LISTED-\",\"url_template\":\"https://example.com/list2/\",\"is_alphanumeric\":false}]", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:52 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"fe94434b76cb272acea19e422afda92332aae93faf10354bc617a3360716a141\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4975", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "25", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AA38:2616CE:B40A4C:D3439E:674F9CA4" + } + }, + "uuid": "6b46543e-8784-4c36-970a-ed779fd6899b", + "persistent": true, + "scenarioName": "scenario-1-repos-Alaurant-github-api-test-autolinks", + "requiredScenarioState": "scenario-1-repos-Alaurant-github-api-test-autolinks-2", + "newScenarioState": "scenario-1-repos-Alaurant-github-api-test-autolinks-3", + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/7-r_a_g_autolinks.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/7-r_a_g_autolinks.json new file mode 100644 index 0000000000..42ce6b3388 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/7-r_a_g_autolinks.json @@ -0,0 +1,49 @@ +{ + "id": "e1029d4b-a07c-4f57-a043-97e49164bf5a", + "name": "repos_alaurant_github-api-test_autolinks", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "body": "[{\"id\":6214208,\"key_prefix\":\"LIST-\",\"url_template\":\"https://example.com/list1/\",\"is_alphanumeric\":true},{\"id\":6214209,\"key_prefix\":\"LISTED-\",\"url_template\":\"https://example.com/list2/\",\"is_alphanumeric\":false}]", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:53 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"fe94434b76cb272acea19e422afda92332aae93faf10354bc617a3360716a141\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4974", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "26", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB28:271404:A4AC9F:C177E4:674F9CA4" + } + }, + "uuid": "e1029d4b-a07c-4f57-a043-97e49164bf5a", + "persistent": true, + "scenarioName": "scenario-1-repos-Alaurant-github-api-test-autolinks", + "requiredScenarioState": "scenario-1-repos-Alaurant-github-api-test-autolinks-3", + "insertionIndex": 7 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/8-r_a_g_autolinks_6214208.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/8-r_a_g_autolinks_6214208.json new file mode 100644 index 0000000000..524bb8a8dc --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/8-r_a_g_autolinks_6214208.json @@ -0,0 +1,43 @@ +{ + "id": "affffb27-b98a-4457-9ea5-3c7c952d9bfb", + "name": "repos_alaurant_github-api-test_autolinks_6214208", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks/6214208", + "method": "DELETE", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 204, + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:53 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4973", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "27", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "Server": "github.com", + "X-GitHub-Request-Id": "AB2C:32381D:19A924:1E57CD:674F9CA5" + } + }, + "uuid": "affffb27-b98a-4457-9ea5-3c7c952d9bfb", + "persistent": true, + "insertionIndex": 8 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/9-r_a_g_autolinks_6214209.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/9-r_a_g_autolinks_6214209.json new file mode 100644 index 0000000000..b5cf4ec9de --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testListAllAutolinks/mappings/9-r_a_g_autolinks_6214209.json @@ -0,0 +1,43 @@ +{ + "id": "b4141f4b-4ca3-4a1c-b507-08a861c87340", + "name": "repos_alaurant_github-api-test_autolinks_6214209", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks/6214209", + "method": "DELETE", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 204, + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:53 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4972", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "28", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "Server": "github.com", + "X-GitHub-Request-Id": "AB2D:259AD1:AD6833:CCA19E:674F9CA5" + } + }, + "uuid": "b4141f4b-4ca3-4a1c-b507-08a861c87340", + "persistent": true, + "insertionIndex": 9 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/__files/1-user.json new file mode 100644 index 0000000000..0764c5a936 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/__files/1-user.json @@ -0,0 +1,48 @@ +{ + "login": "Alaurant", + "id": 41817560, + "node_id": "MDQ6VXNlcjQxODE3NTYw", + "avatar_url": "https://avatars.githubusercontent.com/u/41817560?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Alaurant", + "html_url": "https://github.com/Alaurant", + "followers_url": "https://api.github.com/users/Alaurant/followers", + "following_url": "https://api.github.com/users/Alaurant/following{/other_user}", + "gists_url": "https://api.github.com/users/Alaurant/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Alaurant/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Alaurant/subscriptions", + "organizations_url": "https://api.github.com/users/Alaurant/orgs", + "repos_url": "https://api.github.com/users/Alaurant/repos", + "events_url": "https://api.github.com/users/Alaurant/events{/privacy}", + "received_events_url": "https://api.github.com/users/Alaurant/received_events", + "type": "User", + "user_view_type": "private", + "site_admin": false, + "name": "Danyang Zhao", + "company": null, + "blog": "", + "location": null, + "email": null, + "hireable": null, + "bio": null, + "twitter_username": null, + "notification_email": null, + "public_repos": 7, + "public_gists": 0, + "followers": 3, + "following": 8, + "created_at": "2018-07-28T07:03:48Z", + "updated_at": "2024-11-27T04:01:41Z", + "private_gists": 0, + "total_private_repos": 3, + "owned_private_repos": 3, + "disk_usage": 7314, + "collaborators": 0, + "two_factor_authentication": false, + "plan": { + "name": "pro", + "space": 976562499, + "collaborators": 0, + "private_repos": 9999 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/__files/2-r_a_github-api-test.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/__files/2-r_a_github-api-test.json new file mode 100644 index 0000000000..5e34f49aad --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/__files/2-r_a_github-api-test.json @@ -0,0 +1,122 @@ +{ + "id": 895799232, + "node_id": "R_kgDONWTPwA", + "name": "github-api-test", + "full_name": "Alaurant/github-api-test", + "private": true, + "owner": { + "login": "Alaurant", + "id": 41817560, + "node_id": "MDQ6VXNlcjQxODE3NTYw", + "avatar_url": "https://avatars.githubusercontent.com/u/41817560?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Alaurant", + "html_url": "https://github.com/Alaurant", + "followers_url": "https://api.github.com/users/Alaurant/followers", + "following_url": "https://api.github.com/users/Alaurant/following{/other_user}", + "gists_url": "https://api.github.com/users/Alaurant/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Alaurant/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Alaurant/subscriptions", + "organizations_url": "https://api.github.com/users/Alaurant/orgs", + "repos_url": "https://api.github.com/users/Alaurant/repos", + "events_url": "https://api.github.com/users/Alaurant/events{/privacy}", + "received_events_url": "https://api.github.com/users/Alaurant/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/Alaurant/github-api-test", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/Alaurant/github-api-test", + "forks_url": "https://api.github.com/repos/Alaurant/github-api-test/forks", + "keys_url": "https://api.github.com/repos/Alaurant/github-api-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/Alaurant/github-api-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/Alaurant/github-api-test/teams", + "hooks_url": "https://api.github.com/repos/Alaurant/github-api-test/hooks", + "issue_events_url": "https://api.github.com/repos/Alaurant/github-api-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/Alaurant/github-api-test/events", + "assignees_url": "https://api.github.com/repos/Alaurant/github-api-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/Alaurant/github-api-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/Alaurant/github-api-test/tags", + "blobs_url": "https://api.github.com/repos/Alaurant/github-api-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/Alaurant/github-api-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/Alaurant/github-api-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/Alaurant/github-api-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/Alaurant/github-api-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/Alaurant/github-api-test/languages", + "stargazers_url": "https://api.github.com/repos/Alaurant/github-api-test/stargazers", + "contributors_url": "https://api.github.com/repos/Alaurant/github-api-test/contributors", + "subscribers_url": "https://api.github.com/repos/Alaurant/github-api-test/subscribers", + "subscription_url": "https://api.github.com/repos/Alaurant/github-api-test/subscription", + "commits_url": "https://api.github.com/repos/Alaurant/github-api-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/Alaurant/github-api-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/Alaurant/github-api-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/Alaurant/github-api-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/Alaurant/github-api-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/Alaurant/github-api-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/Alaurant/github-api-test/merges", + "archive_url": "https://api.github.com/repos/Alaurant/github-api-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/Alaurant/github-api-test/downloads", + "issues_url": "https://api.github.com/repos/Alaurant/github-api-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/Alaurant/github-api-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/Alaurant/github-api-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/Alaurant/github-api-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/Alaurant/github-api-test/labels{/name}", + "releases_url": "https://api.github.com/repos/Alaurant/github-api-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/Alaurant/github-api-test/deployments", + "created_at": "2024-11-28T23:44:54Z", + "updated_at": "2024-11-28T23:44:55Z", + "pushed_at": "2024-11-28T23:44:55Z", + "git_url": "git://github.com/Alaurant/github-api-test.git", + "ssh_url": "git@github.com:Alaurant/github-api-test.git", + "clone_url": "https://github.com/Alaurant/github-api-test.git", + "svn_url": "https://github.com/Alaurant/github-api-test", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 3, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "private", + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "main", + "permissions": { + "admin": true, + "maintain": true, + "push": true, + "triage": true, + "pull": true + }, + "temp_clone_token": "AJ7BLWH4VOGNQPWHKJHLRCTHJ6O5G", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "network_count": 0, + "subscribers_count": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/1-user.json new file mode 100644 index 0000000000..9d91294677 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/1-user.json @@ -0,0 +1,48 @@ +{ + "id": "a1c0eb19-f0f1-4359-b22a-832a141db3e7", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:54 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"8bdc3eaf7312491c8eb245323f2eb3004212814ef5f8184104effa4b32f6b27c\"", + "Last-Modified": "Wed, 27 Nov 2024 04:01:41 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4971", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "29", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB35:25CB59:B00D25:CF469E:674F9CA6" + } + }, + "uuid": "a1c0eb19-f0f1-4359-b22a-832a141db3e7", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/2-r_a_github-api-test.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/2-r_a_github-api-test.json new file mode 100644 index 0000000000..c1437c1acf --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/2-r_a_github-api-test.json @@ -0,0 +1,48 @@ +{ + "id": "9c9e2a60-aeb2-4314-8c97-3263084ed857", + "name": "repos_alaurant_github-api-test", + "request": { + "url": "/repos/Alaurant/github-api-test", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-r_a_github-api-test.json", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:55 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"94ad6f4d71086bda8c2640d1ba979adc705c9465218c4ca1e55dc20011962ee7\"", + "Last-Modified": "Thu, 28 Nov 2024 23:44:55 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4969", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "31", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB39:321638:1E7483:24179C:674F9CA7" + } + }, + "uuid": "9c9e2a60-aeb2-4314-8c97-3263084ed857", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/3-r_a_g_autolinks.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/3-r_a_g_autolinks.json new file mode 100644 index 0000000000..608e6c0ffd --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/3-r_a_g_autolinks.json @@ -0,0 +1,54 @@ +{ + "id": "6b66e6e7-8c08-4fd9-b644-90b84f8f5bf8", + "name": "repos_alaurant_github-api-test_autolinks", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"key_prefix\":\"JIRA-\",\"url_template\":\"https://example.com/test/\",\"is_alphanumeric\":false}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "body": "{\"id\":6214212,\"key_prefix\":\"JIRA-\",\"url_template\":\"https://example.com/test/\",\"is_alphanumeric\":false}", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:56 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "\"dd07a13b3219e53d610f3dc3c3f3261e0f56b5b9e02c03bef2c21659e19c8875\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4968", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "32", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB3D:275BE1:A98B5B:C65DE1:674F9CA7" + } + }, + "uuid": "6b66e6e7-8c08-4fd9-b644-90b84f8f5bf8", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/4-r_a_g_autolinks_6214212.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/4-r_a_g_autolinks_6214212.json new file mode 100644 index 0000000000..20eee37749 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/4-r_a_g_autolinks_6214212.json @@ -0,0 +1,47 @@ +{ + "id": "3c2a5120-9645-4bbf-9645-ee04be962ae2", + "name": "repos_alaurant_github-api-test_autolinks_6214212", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks/6214212", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "body": "{\"id\":6214212,\"key_prefix\":\"JIRA-\",\"url_template\":\"https://example.com/test/\",\"is_alphanumeric\":false}", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:56 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"dd07a13b3219e53d610f3dc3c3f3261e0f56b5b9e02c03bef2c21659e19c8875\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4967", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "33", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB3E:25E009:B3DC62:D3161D:674F9CA8" + } + }, + "uuid": "3c2a5120-9645-4bbf-9645-ee04be962ae2", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/5-r_a_g_autolinks_6214212.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/5-r_a_g_autolinks_6214212.json new file mode 100644 index 0000000000..b72ed1961f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/5-r_a_g_autolinks_6214212.json @@ -0,0 +1,43 @@ +{ + "id": "3ed2b3a2-3cc1-4382-86a8-251d4791104b", + "name": "repos_alaurant_github-api-test_autolinks_6214212", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks/6214212", + "method": "DELETE", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 204, + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:57 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4966", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "34", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "Server": "github.com", + "X-GitHub-Request-Id": "AB42:25DAE6:BD2DEF:DC679E:674F9CA9" + } + }, + "uuid": "3ed2b3a2-3cc1-4382-86a8-251d4791104b", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/6-r_a_g_autolinks.json b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/6-r_a_g_autolinks.json new file mode 100644 index 0000000000..ce3fe6adc9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHAutolinkTest/wiremock/testReadAutolink/mappings/6-r_a_g_autolinks.json @@ -0,0 +1,47 @@ +{ + "id": "db9e25ad-fa61-44a4-ab74-c430bd85d6bb", + "name": "repos_alaurant_github-api-test_autolinks", + "request": { + "url": "/repos/Alaurant/github-api-test/autolinks", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "body": "[]", + "headers": { + "Date": "Wed, 04 Dec 2024 00:04:57 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "\"5b744729737bd28d14aeb327919c263d8af99640a7701726d7b2320a638b5c76\"", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4965", + "X-RateLimit-Reset": "1733273750", + "X-RateLimit-Used": "35", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AB43:25A8FF:B7347B:D66E29:674F9CA9" + } + }, + "uuid": "db9e25ad-fa61-44a4-ab74-c430bd85d6bb", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/WireMockStatusReporterTest/wiremock/user_whenProxying_AuthCorrectlyConfigured/__files/1-user.json b/src/test/resources/org/kohsuke/github/WireMockStatusReporterTest/wiremock/user_whenProxying_AuthCorrectlyConfigured/__files/1-user.json new file mode 100644 index 0000000000..56ff784983 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/WireMockStatusReporterTest/wiremock/user_whenProxying_AuthCorrectlyConfigured/__files/1-user.json @@ -0,0 +1,48 @@ +{ + "login": "Alaurant", + "id": 41817560, + "node_id": "MDQ6VXNlcjQxODE3NTYw", + "avatar_url": "https://avatars.githubusercontent.com/u/41817560?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Alaurant", + "html_url": "https://github.com/Alaurant", + "followers_url": "https://api.github.com/users/Alaurant/followers", + "following_url": "https://api.github.com/users/Alaurant/following{/other_user}", + "gists_url": "https://api.github.com/users/Alaurant/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Alaurant/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Alaurant/subscriptions", + "organizations_url": "https://api.github.com/users/Alaurant/orgs", + "repos_url": "https://api.github.com/users/Alaurant/repos", + "events_url": "https://api.github.com/users/Alaurant/events{/privacy}", + "received_events_url": "https://api.github.com/users/Alaurant/received_events", + "type": "User", + "user_view_type": "private", + "site_admin": false, + "name": "Danyang Zhao", + "company": null, + "blog": "", + "location": null, + "email": null, + "hireable": null, + "bio": null, + "twitter_username": null, + "notification_email": null, + "public_repos": 7, + "public_gists": 0, + "followers": 3, + "following": 8, + "created_at": "2018-07-28T07:03:48Z", + "updated_at": "2024-11-27T04:01:41Z", + "private_gists": 0, + "total_private_repos": 2, + "owned_private_repos": 2, + "disk_usage": 7314, + "collaborators": 0, + "two_factor_authentication": false, + "plan": { + "name": "pro", + "space": 976562499, + "collaborators": 0, + "private_repos": 9999 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/WireMockStatusReporterTest/wiremock/user_whenProxying_AuthCorrectlyConfigured/mappings/1-user.json b/src/test/resources/org/kohsuke/github/WireMockStatusReporterTest/wiremock/user_whenProxying_AuthCorrectlyConfigured/mappings/1-user.json new file mode 100644 index 0000000000..97d97463cf --- /dev/null +++ b/src/test/resources/org/kohsuke/github/WireMockStatusReporterTest/wiremock/user_whenProxying_AuthCorrectlyConfigured/mappings/1-user.json @@ -0,0 +1,48 @@ +{ + "id": "64916a9b-5eda-42af-9c98-48ae56c4d534", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Thu, 28 Nov 2024 03:26:34 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"649a1838c989cc406542c8419b31064e1c7a6202454895df13e7b35e43b8653b\"", + "Last-Modified": "Wed, 27 Nov 2024 04:01:41 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4881", + "X-RateLimit-Reset": "1732767344", + "X-RateLimit-Used": "119", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AA1E:348A76:BD20B0:DB5BDF:6747E2EA" + } + }, + "uuid": "64916a9b-5eda-42af-9c98-48ae56c4d534", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/WireMockStatusReporterTest/wiremock/whenSnapshot_EnsureProxy/__files/1-user.json b/src/test/resources/org/kohsuke/github/WireMockStatusReporterTest/wiremock/whenSnapshot_EnsureProxy/__files/1-user.json new file mode 100644 index 0000000000..56ff784983 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/WireMockStatusReporterTest/wiremock/whenSnapshot_EnsureProxy/__files/1-user.json @@ -0,0 +1,48 @@ +{ + "login": "Alaurant", + "id": 41817560, + "node_id": "MDQ6VXNlcjQxODE3NTYw", + "avatar_url": "https://avatars.githubusercontent.com/u/41817560?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Alaurant", + "html_url": "https://github.com/Alaurant", + "followers_url": "https://api.github.com/users/Alaurant/followers", + "following_url": "https://api.github.com/users/Alaurant/following{/other_user}", + "gists_url": "https://api.github.com/users/Alaurant/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Alaurant/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Alaurant/subscriptions", + "organizations_url": "https://api.github.com/users/Alaurant/orgs", + "repos_url": "https://api.github.com/users/Alaurant/repos", + "events_url": "https://api.github.com/users/Alaurant/events{/privacy}", + "received_events_url": "https://api.github.com/users/Alaurant/received_events", + "type": "User", + "user_view_type": "private", + "site_admin": false, + "name": "Danyang Zhao", + "company": null, + "blog": "", + "location": null, + "email": null, + "hireable": null, + "bio": null, + "twitter_username": null, + "notification_email": null, + "public_repos": 7, + "public_gists": 0, + "followers": 3, + "following": 8, + "created_at": "2018-07-28T07:03:48Z", + "updated_at": "2024-11-27T04:01:41Z", + "private_gists": 0, + "total_private_repos": 2, + "owned_private_repos": 2, + "disk_usage": 7314, + "collaborators": 0, + "two_factor_authentication": false, + "plan": { + "name": "pro", + "space": 976562499, + "collaborators": 0, + "private_repos": 9999 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/WireMockStatusReporterTest/wiremock/whenSnapshot_EnsureProxy/mappings/1-user.json b/src/test/resources/org/kohsuke/github/WireMockStatusReporterTest/wiremock/whenSnapshot_EnsureProxy/mappings/1-user.json new file mode 100644 index 0000000000..0d35435e64 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/WireMockStatusReporterTest/wiremock/whenSnapshot_EnsureProxy/mappings/1-user.json @@ -0,0 +1,48 @@ +{ + "id": "7de2b730-9b8e-4691-a676-4458c8cfd026", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Thu, 28 Nov 2024 03:26:33 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"649a1838c989cc406542c8419b31064e1c7a6202454895df13e7b35e43b8653b\"", + "Last-Modified": "Wed, 27 Nov 2024 04:01:41 GMT", + "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "github-authentication-token-expiration": "2025-02-25 04:28:56 UTC", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4883", + "X-RateLimit-Reset": "1732767344", + "X-RateLimit-Used": "117", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "AA13:3A04E5:529DA2:61BA25:6747E2E9" + } + }, + "uuid": "7de2b730-9b8e-4691-a676-4458c8cfd026", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file