diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java index 8fdd0d7d6f..5458fac17d 100644 --- a/src/main/java/org/kohsuke/github/GHLabel.java +++ b/src/main/java/org/kohsuke/github/GHLabel.java @@ -1,6 +1,8 @@ package org.kohsuke.github; import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -13,7 +15,7 @@ * @see GHIssue#getLabels() GHIssue#getLabels() * @see GHRepository#listLabels() GHRepository#listLabels() */ -public class GHLabel { +public class GHLabel extends GHObject { private String url, name, color, description; private GHRepository repo; @@ -22,8 +24,18 @@ public class GHLabel { * * @return the url */ - public String getUrl() { - return url; + public URL getUrl() { + try { + return new URL(url); + } catch (MalformedURLException e) { + e.printStackTrace(); + return null; + } + } + + @Override + public URL getHtmlUrl() throws IOException { + return null; } /** @@ -68,6 +80,25 @@ public void delete() throws IOException { repo.root.createRequest().method("DELETE").setRawUrlPath(url).send(); } + /** + * Sets color. + * + * @param newName + * New name + * @throws IOException + * the io exception + */ + public void setName(String newName) throws IOException { + repo.root.createRequest() + .method("PATCH") + .with("new_name", newName) + .with("color", color) + .with("description", description) + .setRawUrlPath(url) + .fetchInto(this) + .wrapUp(this.repo); + } + /** * Sets color. * @@ -83,7 +114,8 @@ public void setColor(String newColor) throws IOException { .with("color", newColor) .with("description", description) .setRawUrlPath(url) - .send(); + .fetchInto(this) + .wrapUp(this.repo); } /** @@ -101,7 +133,8 @@ public void setDescription(String newDescription) throws IOException { .with("color", color) .with("description", newDescription) .setRawUrlPath(url) - .send(); + .fetchInto(this) + .wrapUp(this.repo); } static Collection toNames(Collection labels) { diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index f2937c3506..00e285d74f 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -1816,7 +1816,7 @@ public GHLabel createLabel(String name, String color) throws IOException { } /** - * Description is still in preview. + * Creates a new github label * * @param name * the name diff --git a/src/test/java/org/kohsuke/github/GHLabelTest.java b/src/test/java/org/kohsuke/github/GHLabelTest.java new file mode 100644 index 0000000000..7004ebdea0 --- /dev/null +++ b/src/test/java/org/kohsuke/github/GHLabelTest.java @@ -0,0 +1,39 @@ +package org.kohsuke.github; + +import org.junit.Test; + +import java.util.List; + +import static org.hamcrest.Matchers.*; + +public class GHLabelTest extends org.kohsuke.github.AbstractGitHubWireMockTest { + + @Test + public void test_toString() throws Exception { + GHRepository rep = getTempRepository(); + + GHLabel label = rep.createLabel("foo", "001122", "test foo label"); + assertThat(label.toString(), containsString("name=foo,color=001122,description=test foo label")); + + List list = rep.listLabels().asList(); + + assertEquals(10, list.size()); + assertThat(list.stream().filter(l -> "foo".equals(l.getName())).findAny().toString(), + containsString("name=foo,color=001122,description=test foo label")); + } + + @Test + public void test_create_updateLabel() throws Exception { + GHRepository rep = getTempRepository(); + + GHLabel label = rep.createLabel("foo", "001122", "test foo label"); + assertThat(label.toString(), containsString("name=foo,color=001122,description=test foo label")); + label.setColor("221100"); + assertThat(label.toString(), containsString("name=foo,color=221100,description=test foo label")); + label.setDescription("label foo test"); + assertThat(label.toString(), containsString("name=foo,color=221100,description=label foo test")); + label.setName("newfoo"); + assertThat(label.toString(), containsString("name=newfoo,color=221100,description=label foo test")); + label.delete(); + } +} diff --git a/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/__files/repos_github-api-test-org_temp-test_create_updatelabel-2d5e62d8-cef9-442b-8879-9252605af926.json b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/__files/repos_github-api-test-org_temp-test_create_updatelabel-2d5e62d8-cef9-442b-8879-9252605af926.json new file mode 100644 index 0000000000..1fd9b8f47b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/__files/repos_github-api-test-org_temp-test_create_updatelabel-2d5e62d8-cef9-442b-8879-9252605af926.json @@ -0,0 +1,125 @@ +{ + "id": 229521552, + "node_id": "MDEwOlJlcG9zaXRvcnkyMjk1MjE1NTI=", + "name": "temp-test_create_updateLabel", + "full_name": "github-api-test-org/temp-test_create_updateLabel", + "private": false, + "owner": { + "login": "github-api-test-org", + "id": 59067752, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU5MDY3NzUy", + "avatar_url": "https://avatars3.githubusercontent.com/u/59067752?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github-api-test-org", + "html_url": "https://github.com/github-api-test-org", + "followers_url": "https://api.github.com/users/github-api-test-org/followers", + "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/github-api-test-org/orgs", + "repos_url": "https://api.github.com/users/github-api-test-org/repos", + "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/github-api-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/github-api-test-org/temp-test_create_updateLabel", + "description": "A test repository for testing the github-api project: temp-test_create_updateLabel", + "fork": false, + "url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel", + "forks_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/forks", + "keys_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/teams", + "hooks_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/hooks", + "issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/issues/events{/number}", + "events_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/events", + "assignees_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/assignees{/user}", + "branches_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/branches{/branch}", + "tags_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/tags", + "blobs_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/statuses/{sha}", + "languages_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/languages", + "stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/stargazers", + "contributors_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/contributors", + "subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/subscribers", + "subscription_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/subscription", + "commits_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/contents/{+path}", + "compare_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/merges", + "archive_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/downloads", + "issues_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/issues{/number}", + "pulls_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/pulls{/number}", + "milestones_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/milestones{/number}", + "notifications_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/labels{/name}", + "releases_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/releases{/id}", + "deployments_url": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/deployments", + "created_at": "2019-12-22T05:15:08Z", + "updated_at": "2019-12-22T05:15:12Z", + "pushed_at": "2019-12-22T05:15:10Z", + "git_url": "git://github.com/github-api-test-org/temp-test_create_updateLabel.git", + "ssh_url": "git@github.com:github-api-test-org/temp-test_create_updateLabel.git", + "clone_url": "https://github.com/github-api-test-org/temp-test_create_updateLabel.git", + "svn_url": "https://github.com/github-api-test-org/temp-test_create_updateLabel", + "homepage": "http://github-api.kohsuke.org/", + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "temp_clone_token": "", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "organization": { + "login": "github-api-test-org", + "id": 59067752, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU5MDY3NzUy", + "avatar_url": "https://avatars3.githubusercontent.com/u/59067752?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github-api-test-org", + "html_url": "https://github.com/github-api-test-org", + "followers_url": "https://api.github.com/users/github-api-test-org/followers", + "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/github-api-test-org/orgs", + "repos_url": "https://api.github.com/users/github-api-test-org/repos", + "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/github-api-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "network_count": 0, + "subscribers_count": 0 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel-1-2d5e62.json b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel-1-2d5e62.json new file mode 100644 index 0000000000..34a5177a55 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel-1-2d5e62.json @@ -0,0 +1,45 @@ +{ + "id": "2d5e62d8-cef9-442b-8879-9252605af926", + "name": "repos_github-api-test-org_temp-test_create_updatelabel", + "request": { + "url": "/repos/github-api-test-org/temp-test_create_updateLabel", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_temp-test_create_updatelabel-2d5e62d8-cef9-442b-8879-9252605af926.json", + "headers": { + "Server": "GitHub.com", + "Date": "Sun, 22 Dec 2019 05:15:13 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4985", + "X-RateLimit-Reset": "1576995265", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", + "ETag": "W/\"54c7fcda570458797658b96702bc16f2\"", + "Last-Modified": "Sun, 22 Dec 2019 05:15:12 GMT", + "X-OAuth-Scopes": "admin:org, delete_repo, repo", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "3ADE:1E30:1325DC:2DC828:5DFEFBE1" + } + }, + "uuid": "2d5e62d8-cef9-442b-8879-9252605af926", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel_labels-2-d658ff.json b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel_labels-2-d658ff.json new file mode 100644 index 0000000000..b8c1589a02 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel_labels-2-d658ff.json @@ -0,0 +1,52 @@ +{ + "id": "d658ff9c-bd98-46c0-aaca-d619064496ea", + "name": "repos_github-api-test-org_temp-test_create_updatelabel_labels", + "request": { + "url": "/repos/github-api-test-org/temp-test_create_updateLabel/labels", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"color\":\"001122\",\"name\":\"foo\",\"description\":\"test foo label\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 201, + "body": "{\"id\":1747637599,\"node_id\":\"MDU6TGFiZWwxNzQ3NjM3NTk5\",\"url\":\"https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/labels/foo\",\"name\":\"foo\",\"color\":\"001122\",\"default\":false,\"description\":\"test foo label\"}", + "headers": { + "Server": "GitHub.com", + "Date": "Sun, 22 Dec 2019 05:15:14 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1576995265", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", + "ETag": "\"df88c3c4db6b74f449a6a56e27725cc4\"", + "X-OAuth-Scopes": "admin:org, delete_repo, repo", + "X-Accepted-OAuth-Scopes": "", + "Location": "https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/labels/foo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "3ADE:1E30:1325DF:2DC82A:5DFEFBE1" + } + }, + "uuid": "d658ff9c-bd98-46c0-aaca-d619064496ea", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel_labels_foo-3-f27724.json b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel_labels_foo-3-f27724.json new file mode 100644 index 0000000000..028cb30749 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel_labels_foo-3-f27724.json @@ -0,0 +1,51 @@ +{ + "id": "f2772414-be05-4219-a22c-37b875287828", + "name": "repos_github-api-test-org_temp-test_create_updatelabel_labels_foo", + "request": { + "url": "/repos/github-api-test-org/temp-test_create_updateLabel/labels/foo", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"color\":\"221100\",\"name\":\"foo\",\"description\":\"test foo label\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 200, + "body": "{\"id\":1747637599,\"node_id\":\"MDU6TGFiZWwxNzQ3NjM3NTk5\",\"url\":\"https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/labels/foo\",\"name\":\"foo\",\"color\":\"221100\",\"default\":false,\"description\":\"test foo label\"}", + "headers": { + "Server": "GitHub.com", + "Date": "Sun, 22 Dec 2019 05:15:14 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1576995265", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", + "ETag": "W/\"b30ca9fa5d72b2fa2ca9ffbec5e2d23e\"", + "X-OAuth-Scopes": "admin:org, delete_repo, repo", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "3ADE:1E30:1325E2:2DC82F:5DFEFBE2" + } + }, + "uuid": "f2772414-be05-4219-a22c-37b875287828", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel_labels_foo-4-4d4e95.json b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel_labels_foo-4-4d4e95.json new file mode 100644 index 0000000000..e238a70d90 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel_labels_foo-4-4d4e95.json @@ -0,0 +1,51 @@ +{ + "id": "4d4e95de-3b21-4c93-afda-838f94d6599e", + "name": "repos_github-api-test-org_temp-test_create_updatelabel_labels_foo", + "request": { + "url": "/repos/github-api-test-org/temp-test_create_updateLabel/labels/foo", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"color\":\"221100\",\"name\":\"foo\",\"description\":\"label foo test\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 200, + "body": "{\"id\":1747637599,\"node_id\":\"MDU6TGFiZWwxNzQ3NjM3NTk5\",\"url\":\"https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/labels/foo\",\"name\":\"foo\",\"color\":\"221100\",\"default\":false,\"description\":\"label foo test\"}", + "headers": { + "Server": "GitHub.com", + "Date": "Sun, 22 Dec 2019 05:15:15 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4982", + "X-RateLimit-Reset": "1576995265", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", + "ETag": "W/\"684987871d872abf56bf9a46df7ecae1\"", + "X-OAuth-Scopes": "admin:org, delete_repo, repo", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "3ADE:1E30:1325E4:2DC832:5DFEFBE2" + } + }, + "uuid": "4d4e95de-3b21-4c93-afda-838f94d6599e", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel_labels_foo-5-3b93b5.json b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel_labels_foo-5-3b93b5.json new file mode 100644 index 0000000000..a9156cd9c2 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel_labels_foo-5-3b93b5.json @@ -0,0 +1,51 @@ +{ + "id": "3b93b57e-3e16-4dda-ad79-7762f5946188", + "name": "repos_github-api-test-org_temp-test_create_updatelabel_labels_foo", + "request": { + "url": "/repos/github-api-test-org/temp-test_create_updateLabel/labels/foo", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"color\":\"221100\",\"description\":\"label foo test\",\"new_name\":\"newfoo\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 200, + "body": "{\"id\":1747637599,\"node_id\":\"MDU6TGFiZWwxNzQ3NjM3NTk5\",\"url\":\"https://api.github.com/repos/github-api-test-org/temp-test_create_updateLabel/labels/newfoo\",\"name\":\"newfoo\",\"color\":\"221100\",\"default\":false,\"description\":\"label foo test\"}", + "headers": { + "Server": "GitHub.com", + "Date": "Sun, 22 Dec 2019 05:15:15 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4981", + "X-RateLimit-Reset": "1576995265", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", + "ETag": "W/\"c925604b756ac63a44af5d61905826ac\"", + "X-OAuth-Scopes": "admin:org, delete_repo, repo", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "3ADE:1E30:1325E6:2DC835:5DFEFBE3" + } + }, + "uuid": "3b93b57e-3e16-4dda-ad79-7762f5946188", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel_labels_newfoo-6-c7ceb0.json b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel_labels_newfoo-6-c7ceb0.json new file mode 100644 index 0000000000..e4017361a1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_create_updateLabel/mappings/repos_github-api-test-org_temp-test_create_updatelabel_labels_newfoo-6-c7ceb0.json @@ -0,0 +1,39 @@ +{ + "id": "c7ceb02b-fd1a-4d80-897f-5a88c36eb1ae", + "name": "repos_github-api-test-org_temp-test_create_updatelabel_labels_newfoo", + "request": { + "url": "/repos/github-api-test-org/temp-test_create_updateLabel/labels/newfoo", + "method": "DELETE", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 204, + "headers": { + "Server": "GitHub.com", + "Date": "Sun, 22 Dec 2019 05:15:15 GMT", + "Status": "204 No Content", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4980", + "X-RateLimit-Reset": "1576995265", + "X-OAuth-Scopes": "admin:org, delete_repo, repo", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "3ADE:1E30:1325E8:2DC83B:5DFEFBE3" + } + }, + "uuid": "c7ceb02b-fd1a-4d80-897f-5a88c36eb1ae", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_toString/__files/repos_github-api-test-org_temp-test_tostring-66791257-bc14-4b7c-bd5a-ec08788e4f39.json b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_toString/__files/repos_github-api-test-org_temp-test_tostring-66791257-bc14-4b7c-bd5a-ec08788e4f39.json new file mode 100644 index 0000000000..aedac5abcd --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_toString/__files/repos_github-api-test-org_temp-test_tostring-66791257-bc14-4b7c-bd5a-ec08788e4f39.json @@ -0,0 +1,125 @@ +{ + "id": 229521570, + "node_id": "MDEwOlJlcG9zaXRvcnkyMjk1MjE1NzA=", + "name": "temp-test_toString", + "full_name": "github-api-test-org/temp-test_toString", + "private": false, + "owner": { + "login": "github-api-test-org", + "id": 59067752, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU5MDY3NzUy", + "avatar_url": "https://avatars3.githubusercontent.com/u/59067752?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github-api-test-org", + "html_url": "https://github.com/github-api-test-org", + "followers_url": "https://api.github.com/users/github-api-test-org/followers", + "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/github-api-test-org/orgs", + "repos_url": "https://api.github.com/users/github-api-test-org/repos", + "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/github-api-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/github-api-test-org/temp-test_toString", + "description": "A test repository for testing the github-api project: temp-test_toString", + "fork": false, + "url": "https://api.github.com/repos/github-api-test-org/temp-test_toString", + "forks_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/forks", + "keys_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/teams", + "hooks_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/hooks", + "issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/issues/events{/number}", + "events_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/events", + "assignees_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/assignees{/user}", + "branches_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/branches{/branch}", + "tags_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/tags", + "blobs_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/statuses/{sha}", + "languages_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/languages", + "stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/stargazers", + "contributors_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/contributors", + "subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/subscribers", + "subscription_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/subscription", + "commits_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/contents/{+path}", + "compare_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/merges", + "archive_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/downloads", + "issues_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/issues{/number}", + "pulls_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/pulls{/number}", + "milestones_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/milestones{/number}", + "notifications_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/labels{/name}", + "releases_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/releases{/id}", + "deployments_url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/deployments", + "created_at": "2019-12-22T05:15:17Z", + "updated_at": "2019-12-22T05:15:21Z", + "pushed_at": "2019-12-22T05:15:19Z", + "git_url": "git://github.com/github-api-test-org/temp-test_toString.git", + "ssh_url": "git@github.com:github-api-test-org/temp-test_toString.git", + "clone_url": "https://github.com/github-api-test-org/temp-test_toString.git", + "svn_url": "https://github.com/github-api-test-org/temp-test_toString", + "homepage": "http://github-api.kohsuke.org/", + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "temp_clone_token": "", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "organization": { + "login": "github-api-test-org", + "id": 59067752, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU5MDY3NzUy", + "avatar_url": "https://avatars3.githubusercontent.com/u/59067752?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github-api-test-org", + "html_url": "https://github.com/github-api-test-org", + "followers_url": "https://api.github.com/users/github-api-test-org/followers", + "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/github-api-test-org/orgs", + "repos_url": "https://api.github.com/users/github-api-test-org/repos", + "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/github-api-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "network_count": 0, + "subscribers_count": 0 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_toString/__files/repos_github-api-test-org_temp-test_tostring_labels-b1aef196-d0b5-4fc8-a538-fe1362aa63e0.json b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_toString/__files/repos_github-api-test-org_temp-test_tostring_labels-b1aef196-d0b5-4fc8-a538-fe1362aa63e0.json new file mode 100644 index 0000000000..9113a024b7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_toString/__files/repos_github-api-test-org_temp-test_tostring_labels-b1aef196-d0b5-4fc8-a538-fe1362aa63e0.json @@ -0,0 +1,92 @@ +[ + { + "id": 1747637662, + "node_id": "MDU6TGFiZWwxNzQ3NjM3NjYy", + "url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/labels/bug", + "name": "bug", + "color": "d73a4a", + "default": true, + "description": "Something isn't working" + }, + { + "id": 1747637664, + "node_id": "MDU6TGFiZWwxNzQ3NjM3NjY0", + "url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/labels/documentation", + "name": "documentation", + "color": "0075ca", + "default": true, + "description": "Improvements or additions to documentation" + }, + { + "id": 1747637665, + "node_id": "MDU6TGFiZWwxNzQ3NjM3NjY1", + "url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/labels/duplicate", + "name": "duplicate", + "color": "cfd3d7", + "default": true, + "description": "This issue or pull request already exists" + }, + { + "id": 1747637667, + "node_id": "MDU6TGFiZWwxNzQ3NjM3NjY3", + "url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/labels/enhancement", + "name": "enhancement", + "color": "a2eeef", + "default": true, + "description": "New feature or request" + }, + { + "id": 1747637719, + "node_id": "MDU6TGFiZWwxNzQ3NjM3NzE5", + "url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/labels/foo", + "name": "foo", + "color": "001122", + "default": false, + "description": "test foo label" + }, + { + "id": 1747637669, + "node_id": "MDU6TGFiZWwxNzQ3NjM3NjY5", + "url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/labels/good%20first%20issue", + "name": "good first issue", + "color": "7057ff", + "default": true, + "description": "Good for newcomers" + }, + { + "id": 1747637671, + "node_id": "MDU6TGFiZWwxNzQ3NjM3Njcx", + "url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/labels/help%20wanted", + "name": "help wanted", + "color": "008672", + "default": true, + "description": "Extra attention is needed" + }, + { + "id": 1747637674, + "node_id": "MDU6TGFiZWwxNzQ3NjM3Njc0", + "url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/labels/invalid", + "name": "invalid", + "color": "e4e669", + "default": true, + "description": "This doesn't seem right" + }, + { + "id": 1747637675, + "node_id": "MDU6TGFiZWwxNzQ3NjM3Njc1", + "url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/labels/question", + "name": "question", + "color": "d876e3", + "default": true, + "description": "Further information is requested" + }, + { + "id": 1747637677, + "node_id": "MDU6TGFiZWwxNzQ3NjM3Njc3", + "url": "https://api.github.com/repos/github-api-test-org/temp-test_toString/labels/wontfix", + "name": "wontfix", + "color": "ffffff", + "default": true, + "description": "This will not be worked on" + } +] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_toString/mappings/repos_github-api-test-org_temp-test_tostring-1-667912.json b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_toString/mappings/repos_github-api-test-org_temp-test_tostring-1-667912.json new file mode 100644 index 0000000000..60f85e983d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_toString/mappings/repos_github-api-test-org_temp-test_tostring-1-667912.json @@ -0,0 +1,45 @@ +{ + "id": "66791257-bc14-4b7c-bd5a-ec08788e4f39", + "name": "repos_github-api-test-org_temp-test_tostring", + "request": { + "url": "/repos/github-api-test-org/temp-test_toString", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_temp-test_tostring-66791257-bc14-4b7c-bd5a-ec08788e4f39.json", + "headers": { + "Server": "GitHub.com", + "Date": "Sun, 22 Dec 2019 05:15:22 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4974", + "X-RateLimit-Reset": "1576995265", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", + "ETag": "W/\"2655f9a48a23b97da69f41d2a781b619\"", + "Last-Modified": "Sun, 22 Dec 2019 05:15:21 GMT", + "X-OAuth-Scopes": "admin:org, delete_repo, repo", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F99D:4B3C:75C287:1129E2F:5DFEFBEA" + } + }, + "uuid": "66791257-bc14-4b7c-bd5a-ec08788e4f39", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_toString/mappings/repos_github-api-test-org_temp-test_tostring_labels-2-015b90.json b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_toString/mappings/repos_github-api-test-org_temp-test_tostring_labels-2-015b90.json new file mode 100644 index 0000000000..f5703e16a7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_toString/mappings/repos_github-api-test-org_temp-test_tostring_labels-2-015b90.json @@ -0,0 +1,52 @@ +{ + "id": "015b90d7-0429-4719-bf92-91c41ccd5775", + "name": "repos_github-api-test-org_temp-test_tostring_labels", + "request": { + "url": "/repos/github-api-test-org/temp-test_toString/labels", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"color\":\"001122\",\"name\":\"foo\",\"description\":\"test foo label\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 201, + "body": "{\"id\":1747637719,\"node_id\":\"MDU6TGFiZWwxNzQ3NjM3NzE5\",\"url\":\"https://api.github.com/repos/github-api-test-org/temp-test_toString/labels/foo\",\"name\":\"foo\",\"color\":\"001122\",\"default\":false,\"description\":\"test foo label\"}", + "headers": { + "Server": "GitHub.com", + "Date": "Sun, 22 Dec 2019 05:15:23 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4973", + "X-RateLimit-Reset": "1576995265", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", + "ETag": "\"cc28330c01f358b0ba11f0c6d0eced7a\"", + "X-OAuth-Scopes": "admin:org, delete_repo, repo", + "X-Accepted-OAuth-Scopes": "", + "Location": "https://api.github.com/repos/github-api-test-org/temp-test_toString/labels/foo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F99D:4B3C:75C28D:1129E3C:5DFEFBEA" + } + }, + "uuid": "015b90d7-0429-4719-bf92-91c41ccd5775", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_toString/mappings/repos_github-api-test-org_temp-test_tostring_labels-3-b1aef1.json b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_toString/mappings/repos_github-api-test-org_temp-test_tostring_labels-3-b1aef1.json new file mode 100644 index 0000000000..43b4d80a97 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHLabelTest/wiremock/test_toString/mappings/repos_github-api-test-org_temp-test_tostring_labels-3-b1aef1.json @@ -0,0 +1,44 @@ +{ + "id": "b1aef196-d0b5-4fc8-a538-fe1362aa63e0", + "name": "repos_github-api-test-org_temp-test_tostring_labels", + "request": { + "url": "/repos/github-api-test-org/temp-test_toString/labels", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_temp-test_tostring_labels-b1aef196-d0b5-4fc8-a538-fe1362aa63e0.json", + "headers": { + "Server": "GitHub.com", + "Date": "Sun, 22 Dec 2019 05:15:23 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4972", + "X-RateLimit-Reset": "1576995265", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", + "ETag": "W/\"40d077cf6b500998dbfde72b0d37bc5c\"", + "X-OAuth-Scopes": "admin:org, delete_repo, repo", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F99D:4B3C:75C297:1129E4B:5DFEFBEB" + } + }, + "uuid": "b1aef196-d0b5-4fc8-a538-fe1362aa63e0", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file