diff --git a/src/main/java/org/kohsuke/github/GHIssue.java b/src/main/java/org/kohsuke/github/GHIssue.java index 30cfd89b6f..878195be91 100644 --- a/src/main/java/org/kohsuke/github/GHIssue.java +++ b/src/main/java/org/kohsuke/github/GHIssue.java @@ -228,6 +228,13 @@ private void edit(String key, Object value) throws IOException { root.createRequest().with(key, value).method("PATCH").withUrlPath(getApiRoute()).send(); } + /** + * Identical to edit(), but allows null for the value. + */ + private void editNullable(String key, Object value) throws IOException { + root.createRequest().withNullable(key, value).method("PATCH").withUrlPath(getApiRoute()).send(); + } + private void editIssue(String key, Object value) throws IOException { root.createRequest().with(key, value).method("PATCH").withUrlPath(getIssuesApiRoute()).send(); } @@ -277,15 +284,19 @@ public void setBody(String body) throws IOException { } /** - * Sets milestone. + * Sets the milestone for this issue. * * @param milestone - * the milestone + * The milestone to assign this issue to. Use null to remove the milestone for this issue. * @throws IOException - * the io exception + * The io exception */ public void setMilestone(GHMilestone milestone) throws IOException { - edit("milestone", milestone.getNumber()); + if (milestone == null) { + editNullable("milestone", null); + } else { + edit("milestone", milestone.getNumber()); + } } /** diff --git a/src/test/java/org/kohsuke/github/GHMilestoneTest.java b/src/test/java/org/kohsuke/github/GHMilestoneTest.java index 40c03db7cf..11f72b97bd 100644 --- a/src/test/java/org/kohsuke/github/GHMilestoneTest.java +++ b/src/test/java/org/kohsuke/github/GHMilestoneTest.java @@ -7,8 +7,6 @@ import java.io.IOException; import java.util.Date; -import static org.junit.Assert.assertEquals; - /** * @author Martin van Zijl */ @@ -23,7 +21,8 @@ public void cleanUp() throws Exception { } for (GHMilestone milestone : getRepository(getGitHubBeforeAfter()).listMilestones(GHIssueState.ALL)) { - if ("Original Title".equals(milestone.getTitle()) || "Updated Title".equals(milestone.getTitle())) { + if ("Original Title".equals(milestone.getTitle()) || "Updated Title".equals(milestone.getTitle()) + || "Unset Test Milestone".equals(milestone.getTitle())) { milestone.delete(); } } @@ -54,6 +53,23 @@ public void testUpdateMilestone() throws Exception { assertEquals(OUTPUT_DUE_DATE, milestone.getDueOn()); } + @Test + public void testUnsetMilestone() throws IOException { + GHRepository repo = getRepository(); + GHMilestone milestone = repo.createMilestone("Unset Test Milestone", "For testUnsetMilestone"); + GHIssue issue = repo.createIssue("Issue for testUnsetMilestone").create(); + + // set the milestone + issue.setMilestone(milestone); + issue = repo.getIssue(issue.getNumber()); // force reload + assertEquals(milestone.getNumber(), issue.getMilestone().getNumber()); + + // remove the milestone + issue.setMilestone(null); + issue = repo.getIssue(issue.getNumber()); // force reload + assertEquals(null, issue.getMilestone()); + } + protected GHRepository getRepository() throws IOException { return getRepository(gitHub); } diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/orgs_github-api-test-org-2.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/orgs_github-api-test-org-2.json new file mode 100644 index 0000000000..6745adcb15 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/orgs_github-api-test-org-2.json @@ -0,0 +1,41 @@ +{ + "login": "github-api-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/github-api-test-org", + "repos_url": "https://api.github.com/orgs/github-api-test-org/repos", + "events_url": "https://api.github.com/orgs/github-api-test-org/events", + "hooks_url": "https://api.github.com/orgs/github-api-test-org/hooks", + "issues_url": "https://api.github.com/orgs/github-api-test-org/issues", + "members_url": "https://api.github.com/orgs/github-api-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/github-api-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 25, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/github-api-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 15, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api-3.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api-3.json new file mode 100644 index 0000000000..d9e9e083e4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api-3.json @@ -0,0 +1,332 @@ +{ + "id": 206888201, + "node_id": "MDEwOlJlcG9zaXRvcnkyMDY4ODgyMDE=", + "name": "github-api", + "full_name": "github-api-test-org/github-api", + "private": false, + "owner": { + "login": "github-api-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/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/github-api", + "description": "Tricky", + "fork": true, + "url": "https://api.github.com/repos/github-api-test-org/github-api", + "forks_url": "https://api.github.com/repos/github-api-test-org/github-api/forks", + "keys_url": "https://api.github.com/repos/github-api-test-org/github-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/github-api-test-org/github-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/github-api-test-org/github-api/teams", + "hooks_url": "https://api.github.com/repos/github-api-test-org/github-api/hooks", + "issue_events_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/github-api-test-org/github-api/events", + "assignees_url": "https://api.github.com/repos/github-api-test-org/github-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/github-api-test-org/github-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/github-api-test-org/github-api/tags", + "blobs_url": "https://api.github.com/repos/github-api-test-org/github-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/github-api-test-org/github-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/github-api-test-org/github-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/github-api-test-org/github-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/github-api-test-org/github-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/github-api-test-org/github-api/languages", + "stargazers_url": "https://api.github.com/repos/github-api-test-org/github-api/stargazers", + "contributors_url": "https://api.github.com/repos/github-api-test-org/github-api/contributors", + "subscribers_url": "https://api.github.com/repos/github-api-test-org/github-api/subscribers", + "subscription_url": "https://api.github.com/repos/github-api-test-org/github-api/subscription", + "commits_url": "https://api.github.com/repos/github-api-test-org/github-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/github-api-test-org/github-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/github-api-test-org/github-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/github-api-test-org/github-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/github-api-test-org/github-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/github-api-test-org/github-api/merges", + "archive_url": "https://api.github.com/repos/github-api-test-org/github-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/github-api-test-org/github-api/downloads", + "issues_url": "https://api.github.com/repos/github-api-test-org/github-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/github-api-test-org/github-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/github-api-test-org/github-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/github-api-test-org/github-api/labels{/name}", + "releases_url": "https://api.github.com/repos/github-api-test-org/github-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/github-api-test-org/github-api/deployments", + "created_at": "2019-09-06T23:26:04Z", + "updated_at": "2020-01-16T21:22:56Z", + "pushed_at": "2020-01-18T00:47:43Z", + "git_url": "git://github.com/github-api-test-org/github-api.git", + "ssh_url": "git@github.com:github-api-test-org/github-api.git", + "clone_url": "https://github.com/github-api-test-org/github-api.git", + "svn_url": "https://github.com/github-api-test-org/github-api", + "homepage": "http://github-api.kohsuke.org/", + "size": 11414, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Java", + "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": 4, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 0, + "open_issues": 4, + "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, + "delete_branch_on_merge": false, + "organization": { + "login": "github-api-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/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 + }, + "parent": { + "id": 617210, + "node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=", + "name": "github-api", + "full_name": "github-api/github-api", + "private": false, + "owner": { + "login": "github-api", + "id": 54909825, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github-api", + "html_url": "https://github.com/github-api", + "followers_url": "https://api.github.com/users/github-api/followers", + "following_url": "https://api.github.com/users/github-api/following{/other_user}", + "gists_url": "https://api.github.com/users/github-api/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github-api/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github-api/subscriptions", + "organizations_url": "https://api.github.com/users/github-api/orgs", + "repos_url": "https://api.github.com/users/github-api/repos", + "events_url": "https://api.github.com/users/github-api/events{/privacy}", + "received_events_url": "https://api.github.com/users/github-api/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/github-api/github-api", + "description": "Java API for GitHub", + "fork": false, + "url": "https://api.github.com/repos/github-api/github-api", + "forks_url": "https://api.github.com/repos/github-api/github-api/forks", + "keys_url": "https://api.github.com/repos/github-api/github-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/github-api/github-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/github-api/github-api/teams", + "hooks_url": "https://api.github.com/repos/github-api/github-api/hooks", + "issue_events_url": "https://api.github.com/repos/github-api/github-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/github-api/github-api/events", + "assignees_url": "https://api.github.com/repos/github-api/github-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/github-api/github-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/github-api/github-api/tags", + "blobs_url": "https://api.github.com/repos/github-api/github-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/github-api/github-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/github-api/github-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/github-api/github-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/github-api/github-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/github-api/github-api/languages", + "stargazers_url": "https://api.github.com/repos/github-api/github-api/stargazers", + "contributors_url": "https://api.github.com/repos/github-api/github-api/contributors", + "subscribers_url": "https://api.github.com/repos/github-api/github-api/subscribers", + "subscription_url": "https://api.github.com/repos/github-api/github-api/subscription", + "commits_url": "https://api.github.com/repos/github-api/github-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/github-api/github-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/github-api/github-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/github-api/github-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/github-api/github-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/github-api/github-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/github-api/github-api/merges", + "archive_url": "https://api.github.com/repos/github-api/github-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/github-api/github-api/downloads", + "issues_url": "https://api.github.com/repos/github-api/github-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/github-api/github-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/github-api/github-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/github-api/github-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/github-api/github-api/labels{/name}", + "releases_url": "https://api.github.com/repos/github-api/github-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/github-api/github-api/deployments", + "created_at": "2010-04-19T04:13:03Z", + "updated_at": "2020-04-03T00:50:10Z", + "pushed_at": "2020-04-04T14:50:15Z", + "git_url": "git://github.com/github-api/github-api.git", + "ssh_url": "git@github.com:github-api/github-api.git", + "clone_url": "https://github.com/github-api/github-api.git", + "svn_url": "https://github.com/github-api/github-api", + "homepage": "https://github-api.kohsuke.org/", + "size": 22022, + "stargazers_count": 634, + "watchers_count": 634, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 470, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 63, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 470, + "open_issues": 63, + "watchers": 634, + "default_branch": "master" + }, + "source": { + "id": 617210, + "node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=", + "name": "github-api", + "full_name": "github-api/github-api", + "private": false, + "owner": { + "login": "github-api", + "id": 54909825, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github-api", + "html_url": "https://github.com/github-api", + "followers_url": "https://api.github.com/users/github-api/followers", + "following_url": "https://api.github.com/users/github-api/following{/other_user}", + "gists_url": "https://api.github.com/users/github-api/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github-api/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github-api/subscriptions", + "organizations_url": "https://api.github.com/users/github-api/orgs", + "repos_url": "https://api.github.com/users/github-api/repos", + "events_url": "https://api.github.com/users/github-api/events{/privacy}", + "received_events_url": "https://api.github.com/users/github-api/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/github-api/github-api", + "description": "Java API for GitHub", + "fork": false, + "url": "https://api.github.com/repos/github-api/github-api", + "forks_url": "https://api.github.com/repos/github-api/github-api/forks", + "keys_url": "https://api.github.com/repos/github-api/github-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/github-api/github-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/github-api/github-api/teams", + "hooks_url": "https://api.github.com/repos/github-api/github-api/hooks", + "issue_events_url": "https://api.github.com/repos/github-api/github-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/github-api/github-api/events", + "assignees_url": "https://api.github.com/repos/github-api/github-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/github-api/github-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/github-api/github-api/tags", + "blobs_url": "https://api.github.com/repos/github-api/github-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/github-api/github-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/github-api/github-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/github-api/github-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/github-api/github-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/github-api/github-api/languages", + "stargazers_url": "https://api.github.com/repos/github-api/github-api/stargazers", + "contributors_url": "https://api.github.com/repos/github-api/github-api/contributors", + "subscribers_url": "https://api.github.com/repos/github-api/github-api/subscribers", + "subscription_url": "https://api.github.com/repos/github-api/github-api/subscription", + "commits_url": "https://api.github.com/repos/github-api/github-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/github-api/github-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/github-api/github-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/github-api/github-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/github-api/github-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/github-api/github-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/github-api/github-api/merges", + "archive_url": "https://api.github.com/repos/github-api/github-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/github-api/github-api/downloads", + "issues_url": "https://api.github.com/repos/github-api/github-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/github-api/github-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/github-api/github-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/github-api/github-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/github-api/github-api/labels{/name}", + "releases_url": "https://api.github.com/repos/github-api/github-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/github-api/github-api/deployments", + "created_at": "2010-04-19T04:13:03Z", + "updated_at": "2020-04-03T00:50:10Z", + "pushed_at": "2020-04-04T14:50:15Z", + "git_url": "git://github.com/github-api/github-api.git", + "ssh_url": "git@github.com:github-api/github-api.git", + "clone_url": "https://github.com/github-api/github-api.git", + "svn_url": "https://github.com/github-api/github-api", + "homepage": "https://github-api.kohsuke.org/", + "size": 22022, + "stargazers_count": 634, + "watchers_count": 634, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 470, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 63, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 470, + "open_issues": 63, + "watchers": 634, + "default_branch": "master" + }, + "network_count": 470, + "subscribers_count": 0 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_issues-5.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_issues-5.json new file mode 100644 index 0000000000..9c9c6b2ed0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_issues-5.json @@ -0,0 +1,45 @@ +{ + "url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368", + "repository_url": "https://api.github.com/repos/github-api-test-org/github-api", + "labels_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368/labels{/name}", + "comments_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368/comments", + "events_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368/events", + "html_url": "https://github.com/github-api-test-org/github-api/issues/368", + "id": 594244130, + "node_id": "MDU6SXNzdWU1OTQyNDQxMzA=", + "number": 368, + "title": "Issue for testUnsetMilestone", + "user": { + "login": "martinvanzijl", + "id": 24422213, + "node_id": "MDQ6VXNlcjI0NDIyMjEz", + "avatar_url": "https://avatars0.githubusercontent.com/u/24422213?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/martinvanzijl", + "html_url": "https://github.com/martinvanzijl", + "followers_url": "https://api.github.com/users/martinvanzijl/followers", + "following_url": "https://api.github.com/users/martinvanzijl/following{/other_user}", + "gists_url": "https://api.github.com/users/martinvanzijl/gists{/gist_id}", + "starred_url": "https://api.github.com/users/martinvanzijl/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/martinvanzijl/subscriptions", + "organizations_url": "https://api.github.com/users/martinvanzijl/orgs", + "repos_url": "https://api.github.com/users/martinvanzijl/repos", + "events_url": "https://api.github.com/users/martinvanzijl/events{/privacy}", + "received_events_url": "https://api.github.com/users/martinvanzijl/received_events", + "type": "User", + "site_admin": false + }, + "labels": [], + "state": "open", + "locked": false, + "assignee": null, + "assignees": [], + "milestone": null, + "comments": 0, + "created_at": "2020-04-05T04:12:50Z", + "updated_at": "2020-04-05T04:12:50Z", + "closed_at": null, + "author_association": "MEMBER", + "body": null, + "closed_by": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_issues_368-6.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_issues_368-6.json new file mode 100644 index 0000000000..fbcdd21fc3 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_issues_368-6.json @@ -0,0 +1,81 @@ +{ + "url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368", + "repository_url": "https://api.github.com/repos/github-api-test-org/github-api", + "labels_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368/labels{/name}", + "comments_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368/comments", + "events_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368/events", + "html_url": "https://github.com/github-api-test-org/github-api/issues/368", + "id": 594244130, + "node_id": "MDU6SXNzdWU1OTQyNDQxMzA=", + "number": 368, + "title": "Issue for testUnsetMilestone", + "user": { + "login": "martinvanzijl", + "id": 24422213, + "node_id": "MDQ6VXNlcjI0NDIyMjEz", + "avatar_url": "https://avatars0.githubusercontent.com/u/24422213?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/martinvanzijl", + "html_url": "https://github.com/martinvanzijl", + "followers_url": "https://api.github.com/users/martinvanzijl/followers", + "following_url": "https://api.github.com/users/martinvanzijl/following{/other_user}", + "gists_url": "https://api.github.com/users/martinvanzijl/gists{/gist_id}", + "starred_url": "https://api.github.com/users/martinvanzijl/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/martinvanzijl/subscriptions", + "organizations_url": "https://api.github.com/users/martinvanzijl/orgs", + "repos_url": "https://api.github.com/users/martinvanzijl/repos", + "events_url": "https://api.github.com/users/martinvanzijl/events{/privacy}", + "received_events_url": "https://api.github.com/users/martinvanzijl/received_events", + "type": "User", + "site_admin": false + }, + "labels": [], + "state": "open", + "locked": false, + "assignee": null, + "assignees": [], + "milestone": { + "url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/1", + "html_url": "https://github.com/github-api-test-org/github-api/milestone/1", + "labels_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/1/labels", + "id": 5275434, + "node_id": "MDk6TWlsZXN0b25lNTI3NTQzNA==", + "number": 1, + "title": "Unset Test Milestone", + "description": "For testUnsetMilestone", + "creator": { + "login": "martinvanzijl", + "id": 24422213, + "node_id": "MDQ6VXNlcjI0NDIyMjEz", + "avatar_url": "https://avatars0.githubusercontent.com/u/24422213?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/martinvanzijl", + "html_url": "https://github.com/martinvanzijl", + "followers_url": "https://api.github.com/users/martinvanzijl/followers", + "following_url": "https://api.github.com/users/martinvanzijl/following{/other_user}", + "gists_url": "https://api.github.com/users/martinvanzijl/gists{/gist_id}", + "starred_url": "https://api.github.com/users/martinvanzijl/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/martinvanzijl/subscriptions", + "organizations_url": "https://api.github.com/users/martinvanzijl/orgs", + "repos_url": "https://api.github.com/users/martinvanzijl/repos", + "events_url": "https://api.github.com/users/martinvanzijl/events{/privacy}", + "received_events_url": "https://api.github.com/users/martinvanzijl/received_events", + "type": "User", + "site_admin": false + }, + "open_issues": 1, + "closed_issues": 0, + "state": "open", + "created_at": "2020-04-05T04:12:49Z", + "updated_at": "2020-04-05T04:12:50Z", + "due_on": null, + "closed_at": null + }, + "comments": 0, + "created_at": "2020-04-05T04:12:50Z", + "updated_at": "2020-04-05T04:12:50Z", + "closed_at": null, + "author_association": "MEMBER", + "body": null, + "closed_by": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_issues_368-7.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_issues_368-7.json new file mode 100644 index 0000000000..fbcdd21fc3 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_issues_368-7.json @@ -0,0 +1,81 @@ +{ + "url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368", + "repository_url": "https://api.github.com/repos/github-api-test-org/github-api", + "labels_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368/labels{/name}", + "comments_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368/comments", + "events_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368/events", + "html_url": "https://github.com/github-api-test-org/github-api/issues/368", + "id": 594244130, + "node_id": "MDU6SXNzdWU1OTQyNDQxMzA=", + "number": 368, + "title": "Issue for testUnsetMilestone", + "user": { + "login": "martinvanzijl", + "id": 24422213, + "node_id": "MDQ6VXNlcjI0NDIyMjEz", + "avatar_url": "https://avatars0.githubusercontent.com/u/24422213?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/martinvanzijl", + "html_url": "https://github.com/martinvanzijl", + "followers_url": "https://api.github.com/users/martinvanzijl/followers", + "following_url": "https://api.github.com/users/martinvanzijl/following{/other_user}", + "gists_url": "https://api.github.com/users/martinvanzijl/gists{/gist_id}", + "starred_url": "https://api.github.com/users/martinvanzijl/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/martinvanzijl/subscriptions", + "organizations_url": "https://api.github.com/users/martinvanzijl/orgs", + "repos_url": "https://api.github.com/users/martinvanzijl/repos", + "events_url": "https://api.github.com/users/martinvanzijl/events{/privacy}", + "received_events_url": "https://api.github.com/users/martinvanzijl/received_events", + "type": "User", + "site_admin": false + }, + "labels": [], + "state": "open", + "locked": false, + "assignee": null, + "assignees": [], + "milestone": { + "url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/1", + "html_url": "https://github.com/github-api-test-org/github-api/milestone/1", + "labels_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/1/labels", + "id": 5275434, + "node_id": "MDk6TWlsZXN0b25lNTI3NTQzNA==", + "number": 1, + "title": "Unset Test Milestone", + "description": "For testUnsetMilestone", + "creator": { + "login": "martinvanzijl", + "id": 24422213, + "node_id": "MDQ6VXNlcjI0NDIyMjEz", + "avatar_url": "https://avatars0.githubusercontent.com/u/24422213?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/martinvanzijl", + "html_url": "https://github.com/martinvanzijl", + "followers_url": "https://api.github.com/users/martinvanzijl/followers", + "following_url": "https://api.github.com/users/martinvanzijl/following{/other_user}", + "gists_url": "https://api.github.com/users/martinvanzijl/gists{/gist_id}", + "starred_url": "https://api.github.com/users/martinvanzijl/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/martinvanzijl/subscriptions", + "organizations_url": "https://api.github.com/users/martinvanzijl/orgs", + "repos_url": "https://api.github.com/users/martinvanzijl/repos", + "events_url": "https://api.github.com/users/martinvanzijl/events{/privacy}", + "received_events_url": "https://api.github.com/users/martinvanzijl/received_events", + "type": "User", + "site_admin": false + }, + "open_issues": 1, + "closed_issues": 0, + "state": "open", + "created_at": "2020-04-05T04:12:49Z", + "updated_at": "2020-04-05T04:12:50Z", + "due_on": null, + "closed_at": null + }, + "comments": 0, + "created_at": "2020-04-05T04:12:50Z", + "updated_at": "2020-04-05T04:12:50Z", + "closed_at": null, + "author_association": "MEMBER", + "body": null, + "closed_by": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_issues_368-8.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_issues_368-8.json new file mode 100644 index 0000000000..fdca0145a1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_issues_368-8.json @@ -0,0 +1,45 @@ +{ + "url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368", + "repository_url": "https://api.github.com/repos/github-api-test-org/github-api", + "labels_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368/labels{/name}", + "comments_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368/comments", + "events_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368/events", + "html_url": "https://github.com/github-api-test-org/github-api/issues/368", + "id": 594244130, + "node_id": "MDU6SXNzdWU1OTQyNDQxMzA=", + "number": 368, + "title": "Issue for testUnsetMilestone", + "user": { + "login": "martinvanzijl", + "id": 24422213, + "node_id": "MDQ6VXNlcjI0NDIyMjEz", + "avatar_url": "https://avatars0.githubusercontent.com/u/24422213?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/martinvanzijl", + "html_url": "https://github.com/martinvanzijl", + "followers_url": "https://api.github.com/users/martinvanzijl/followers", + "following_url": "https://api.github.com/users/martinvanzijl/following{/other_user}", + "gists_url": "https://api.github.com/users/martinvanzijl/gists{/gist_id}", + "starred_url": "https://api.github.com/users/martinvanzijl/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/martinvanzijl/subscriptions", + "organizations_url": "https://api.github.com/users/martinvanzijl/orgs", + "repos_url": "https://api.github.com/users/martinvanzijl/repos", + "events_url": "https://api.github.com/users/martinvanzijl/events{/privacy}", + "received_events_url": "https://api.github.com/users/martinvanzijl/received_events", + "type": "User", + "site_admin": false + }, + "labels": [], + "state": "open", + "locked": false, + "assignee": null, + "assignees": [], + "milestone": null, + "comments": 0, + "created_at": "2020-04-05T04:12:50Z", + "updated_at": "2020-04-05T04:12:51Z", + "closed_at": null, + "author_association": "MEMBER", + "body": null, + "closed_by": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_issues_368-9.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_issues_368-9.json new file mode 100644 index 0000000000..fdca0145a1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_issues_368-9.json @@ -0,0 +1,45 @@ +{ + "url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368", + "repository_url": "https://api.github.com/repos/github-api-test-org/github-api", + "labels_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368/labels{/name}", + "comments_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368/comments", + "events_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/368/events", + "html_url": "https://github.com/github-api-test-org/github-api/issues/368", + "id": 594244130, + "node_id": "MDU6SXNzdWU1OTQyNDQxMzA=", + "number": 368, + "title": "Issue for testUnsetMilestone", + "user": { + "login": "martinvanzijl", + "id": 24422213, + "node_id": "MDQ6VXNlcjI0NDIyMjEz", + "avatar_url": "https://avatars0.githubusercontent.com/u/24422213?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/martinvanzijl", + "html_url": "https://github.com/martinvanzijl", + "followers_url": "https://api.github.com/users/martinvanzijl/followers", + "following_url": "https://api.github.com/users/martinvanzijl/following{/other_user}", + "gists_url": "https://api.github.com/users/martinvanzijl/gists{/gist_id}", + "starred_url": "https://api.github.com/users/martinvanzijl/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/martinvanzijl/subscriptions", + "organizations_url": "https://api.github.com/users/martinvanzijl/orgs", + "repos_url": "https://api.github.com/users/martinvanzijl/repos", + "events_url": "https://api.github.com/users/martinvanzijl/events{/privacy}", + "received_events_url": "https://api.github.com/users/martinvanzijl/received_events", + "type": "User", + "site_admin": false + }, + "labels": [], + "state": "open", + "locked": false, + "assignee": null, + "assignees": [], + "milestone": null, + "comments": 0, + "created_at": "2020-04-05T04:12:50Z", + "updated_at": "2020-04-05T04:12:51Z", + "closed_at": null, + "author_association": "MEMBER", + "body": null, + "closed_by": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_milestones-4.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_milestones-4.json new file mode 100644 index 0000000000..d7d72267f8 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/repos_github-api-test-org_github-api_milestones-4.json @@ -0,0 +1,37 @@ +{ + "url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/1", + "html_url": "https://github.com/github-api-test-org/github-api/milestone/1", + "labels_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/1/labels", + "id": 5275434, + "node_id": "MDk6TWlsZXN0b25lNTI3NTQzNA==", + "number": 1, + "title": "Unset Test Milestone", + "description": "For testUnsetMilestone", + "creator": { + "login": "martinvanzijl", + "id": 24422213, + "node_id": "MDQ6VXNlcjI0NDIyMjEz", + "avatar_url": "https://avatars0.githubusercontent.com/u/24422213?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/martinvanzijl", + "html_url": "https://github.com/martinvanzijl", + "followers_url": "https://api.github.com/users/martinvanzijl/followers", + "following_url": "https://api.github.com/users/martinvanzijl/following{/other_user}", + "gists_url": "https://api.github.com/users/martinvanzijl/gists{/gist_id}", + "starred_url": "https://api.github.com/users/martinvanzijl/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/martinvanzijl/subscriptions", + "organizations_url": "https://api.github.com/users/martinvanzijl/orgs", + "repos_url": "https://api.github.com/users/martinvanzijl/repos", + "events_url": "https://api.github.com/users/martinvanzijl/events{/privacy}", + "received_events_url": "https://api.github.com/users/martinvanzijl/received_events", + "type": "User", + "site_admin": false + }, + "open_issues": 0, + "closed_issues": 0, + "state": "open", + "created_at": "2020-04-05T04:12:49Z", + "updated_at": "2020-04-05T04:12:49Z", + "due_on": null, + "closed_at": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/user-1.json new file mode 100644 index 0000000000..dddc4d0c73 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/__files/user-1.json @@ -0,0 +1,33 @@ +{ + "login": "martinvanzijl", + "id": 24422213, + "node_id": "MDQ6VXNlcjI0NDIyMjEz", + "avatar_url": "https://avatars0.githubusercontent.com/u/24422213?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/martinvanzijl", + "html_url": "https://github.com/martinvanzijl", + "followers_url": "https://api.github.com/users/martinvanzijl/followers", + "following_url": "https://api.github.com/users/martinvanzijl/following{/other_user}", + "gists_url": "https://api.github.com/users/martinvanzijl/gists{/gist_id}", + "starred_url": "https://api.github.com/users/martinvanzijl/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/martinvanzijl/subscriptions", + "organizations_url": "https://api.github.com/users/martinvanzijl/orgs", + "repos_url": "https://api.github.com/users/martinvanzijl/repos", + "events_url": "https://api.github.com/users/martinvanzijl/events{/privacy}", + "received_events_url": "https://api.github.com/users/martinvanzijl/received_events", + "type": "User", + "site_admin": false, + "name": "Martin van Zijl", + "company": null, + "blog": "", + "location": null, + "email": null, + "hireable": true, + "bio": "My strongest language is C++, but I also know C, Java, Python and SQL.", + "public_repos": 15, + "public_gists": 0, + "followers": 3, + "following": 0, + "created_at": "2016-12-07T00:18:58Z", + "updated_at": "2020-04-05T03:19:50Z" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/orgs_github-api-test-org-2.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/orgs_github-api-test-org-2.json new file mode 100644 index 0000000000..d627e71429 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/orgs_github-api-test-org-2.json @@ -0,0 +1,46 @@ +{ + "id": "0add6197-77cb-4c2e-ba1f-f27c47ec5a54", + "name": "orgs_github-api-test-org", + "request": { + "url": "/orgs/github-api-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_github-api-test-org-2.json", + "headers": { + "Date": "Sun, 05 Apr 2020 04:12:48 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4960", + "X-RateLimit-Reset": "1586062476", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"25f3c370394361a6164baa51e2437136\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "admin:org, admin:repo_hook, delete_repo, gist, repo", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "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": "8F8C:6DE8:3763E2:3EE9D7:5E895ABE" + } + }, + "uuid": "0add6197-77cb-4c2e-ba1f-f27c47ec5a54", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api-3.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api-3.json new file mode 100644 index 0000000000..424db1f0a3 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api-3.json @@ -0,0 +1,46 @@ +{ + "id": "5db09408-86e6-41cf-9c3c-f02c5d384702", + "name": "repos_github-api-test-org_github-api", + "request": { + "url": "/repos/github-api-test-org/github-api", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_github-api-3.json", + "headers": { + "Date": "Sun, 05 Apr 2020 04:12:49 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4959", + "X-RateLimit-Reset": "1586062477", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"f70f9c015fa2b5769fb68726e5626916\"", + "Last-Modified": "Thu, 16 Jan 2020 21:22:56 GMT", + "X-OAuth-Scopes": "admin:org, admin:repo_hook, delete_repo, gist, repo", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "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": "8F8C:6DE8:3763F2:3EEA1A:5E895AC0" + } + }, + "uuid": "5db09408-86e6-41cf-9c3c-f02c5d384702", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_issues-5.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_issues-5.json new file mode 100644 index 0000000000..72079c1a60 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_issues-5.json @@ -0,0 +1,53 @@ +{ + "id": "b8afb86b-c8b2-45ec-9ea4-775d470669b3", + "name": "repos_github-api-test-org_github-api_issues", + "request": { + "url": "/repos/github-api-test-org/github-api/issues", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"assignees\":[],\"title\":\"Issue for testUnsetMilestone\",\"labels\":[]}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "repos_github-api-test-org_github-api_issues-5.json", + "headers": { + "Date": "Sun, 05 Apr 2020 04:12:50 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4957", + "X-RateLimit-Reset": "1586062476", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "\"69a006d264422a49583ebfb0ffa6a4d2\"", + "X-OAuth-Scopes": "admin:org, admin:repo_hook, delete_repo, gist, repo", + "X-Accepted-OAuth-Scopes": "", + "Location": "https://api.github.com/repos/github-api-test-org/github-api/issues/368", + "X-GitHub-Media-Type": "unknown, github.v3", + "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": "8F8C:6DE8:376410:3EEA3E:5E895AC1" + } + }, + "uuid": "b8afb86b-c8b2-45ec-9ea4-775d470669b3", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_issues_368-6.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_issues_368-6.json new file mode 100644 index 0000000000..a43f151fc2 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_issues_368-6.json @@ -0,0 +1,52 @@ +{ + "id": "de40d490-10aa-4a9c-a0ef-2bc4c1c7ccea", + "name": "repos_github-api-test-org_github-api_issues_368", + "request": { + "url": "/repos/github-api-test-org/github-api/issues/368", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"milestone\":1}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_github-api_issues_368-6.json", + "headers": { + "Date": "Sun, 05 Apr 2020 04:12:51 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4956", + "X-RateLimit-Reset": "1586062476", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"eeca7474dc0b6117d9f5b64d03c21d14\"", + "X-OAuth-Scopes": "admin:org, admin:repo_hook, delete_repo, gist, repo", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "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": "8F8C:6DE8:376421:3EEA4F:5E895AC2" + } + }, + "uuid": "de40d490-10aa-4a9c-a0ef-2bc4c1c7ccea", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_issues_368-7.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_issues_368-7.json new file mode 100644 index 0000000000..b36d6fce71 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_issues_368-7.json @@ -0,0 +1,49 @@ +{ + "id": "2c5be75b-5533-47e9-9911-eadfac6ce62a", + "name": "repos_github-api-test-org_github-api_issues_368", + "request": { + "url": "/repos/github-api-test-org/github-api/issues/368", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_github-api_issues_368-7.json", + "headers": { + "Date": "Sun, 05 Apr 2020 04:12:51 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4955", + "X-RateLimit-Reset": "1586062476", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"eeca7474dc0b6117d9f5b64d03c21d14\"", + "Last-Modified": "Sun, 05 Apr 2020 04:12:50 GMT", + "X-OAuth-Scopes": "admin:org, admin:repo_hook, delete_repo, gist, repo", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "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": "8F8C:6DE8:37642D:3EEA61:5E895AC3" + } + }, + "uuid": "2c5be75b-5533-47e9-9911-eadfac6ce62a", + "persistent": true, + "scenarioName": "scenario-1-repos-github-api-test-org-github-api-issues-368", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-1-repos-github-api-test-org-github-api-issues-368-2", + "insertionIndex": 7 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_issues_368-8.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_issues_368-8.json new file mode 100644 index 0000000000..51e3b35d32 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_issues_368-8.json @@ -0,0 +1,52 @@ +{ + "id": "360f7d78-206c-44c0-8442-3bdb65b3bee9", + "name": "repos_github-api-test-org_github-api_issues_368", + "request": { + "url": "/repos/github-api-test-org/github-api/issues/368", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"milestone\":null}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_github-api_issues_368-8.json", + "headers": { + "Date": "Sun, 05 Apr 2020 04:12:52 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4954", + "X-RateLimit-Reset": "1586062476", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"0227fb592a36d2fbf90846648d050739\"", + "X-OAuth-Scopes": "admin:org, admin:repo_hook, delete_repo, gist, repo", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "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": "8F8C:6DE8:376438:3EEA69:5E895AC3" + } + }, + "uuid": "360f7d78-206c-44c0-8442-3bdb65b3bee9", + "persistent": true, + "insertionIndex": 8 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_issues_368-9.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_issues_368-9.json new file mode 100644 index 0000000000..1bd7313c99 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_issues_368-9.json @@ -0,0 +1,48 @@ +{ + "id": "a1754b36-909b-4f49-bab3-baa2fda219b6", + "name": "repos_github-api-test-org_github-api_issues_368", + "request": { + "url": "/repos/github-api-test-org/github-api/issues/368", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_github-api_issues_368-9.json", + "headers": { + "Date": "Sun, 05 Apr 2020 04:12:52 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4953", + "X-RateLimit-Reset": "1586062476", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"0227fb592a36d2fbf90846648d050739\"", + "Last-Modified": "Sun, 05 Apr 2020 04:12:51 GMT", + "X-OAuth-Scopes": "admin:org, admin:repo_hook, delete_repo, gist, repo", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "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": "8F8C:6DE8:376444:3EEA7A:5E895AC4" + } + }, + "uuid": "a1754b36-909b-4f49-bab3-baa2fda219b6", + "persistent": true, + "scenarioName": "scenario-1-repos-github-api-test-org-github-api-issues-368", + "requiredScenarioState": "scenario-1-repos-github-api-test-org-github-api-issues-368-2", + "insertionIndex": 9 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_milestones-4.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_milestones-4.json new file mode 100644 index 0000000000..9a40b8f8f4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/repos_github-api-test-org_github-api_milestones-4.json @@ -0,0 +1,53 @@ +{ + "id": "ae26042c-8183-4aa0-ae61-31a3cdc405b3", + "name": "repos_github-api-test-org_github-api_milestones", + "request": { + "url": "/repos/github-api-test-org/github-api/milestones", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"description\":\"For testUnsetMilestone\",\"title\":\"Unset Test Milestone\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "repos_github-api-test-org_github-api_milestones-4.json", + "headers": { + "Date": "Sun, 05 Apr 2020 04:12:49 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4958", + "X-RateLimit-Reset": "1586062476", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "\"ce0223ff2b8df9b4c1d9d8c3836eec06\"", + "X-OAuth-Scopes": "admin:org, admin:repo_hook, delete_repo, gist, repo", + "X-Accepted-OAuth-Scopes": "", + "Location": "https://api.github.com/repos/github-api-test-org/github-api/milestones/1", + "X-GitHub-Media-Type": "unknown, github.v3", + "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": "8F8C:6DE8:376400:3EEA2B:5E895AC1" + } + }, + "uuid": "ae26042c-8183-4aa0-ae61-31a3cdc405b3", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/user-1.json new file mode 100644 index 0000000000..ac3aa133fd --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUnsetMilestone/mappings/user-1.json @@ -0,0 +1,46 @@ +{ + "id": "ed8d65ef-b07b-4911-a644-62c833a31fc2", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "user-1.json", + "headers": { + "Date": "Sun, 05 Apr 2020 04:12:46 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4965", + "X-RateLimit-Reset": "1586062477", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"1897f380310d09efda5bcab7775c207d\"", + "Last-Modified": "Sun, 05 Apr 2020 03:19:50 GMT", + "X-OAuth-Scopes": "admin:org, admin:repo_hook, delete_repo, gist, repo", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "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": "8F8C:6DE8:3763AD:3EE9CD:5E895ABD" + } + }, + "uuid": "ed8d65ef-b07b-4911-a644-62c833a31fc2", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file