diff --git a/src/main/java/org/kohsuke/github/GHMilestone.java b/src/main/java/org/kohsuke/github/GHMilestone.java index 50ad549e82..3ed54636c7 100644 --- a/src/main/java/org/kohsuke/github/GHMilestone.java +++ b/src/main/java/org/kohsuke/github/GHMilestone.java @@ -85,10 +85,29 @@ public void reopen() throws IOException { edit("state", "open"); } + /** + * Deletes this milestone. + */ + public void delete() throws IOException { + root.retrieve().method("DELETE").to(getApiRoute()); + } + private void edit(String key, Object value) throws IOException { new Requester(root)._with(key, value).method("PATCH").to(getApiRoute()); } + public void setTitle(String title) throws IOException { + edit("title", title); + } + + public void setDescription(String description) throws IOException { + edit("description", description); + } + + public void setDueOn(Date dueOn) throws IOException { + edit("due_on", GitHub.printDate(dueOn)); + } + protected String getApiRoute() { return "/repos/"+owner.getOwnerName()+"/"+owner.getName()+"/milestones/"+number; } diff --git a/src/main/java/org/kohsuke/github/GitHub.java b/src/main/java/org/kohsuke/github/GitHub.java index 9fbcac916e..0cbf425970 100644 --- a/src/main/java/org/kohsuke/github/GitHub.java +++ b/src/main/java/org/kohsuke/github/GitHub.java @@ -956,7 +956,9 @@ public Reader renderMarkdown(String text) throws IOException { } /*package*/ static String printDate(Date dt) { - return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(dt); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + df.setTimeZone(TimeZone.getTimeZone("GMT")); + return df.format(dt); } /*package*/ static final ObjectMapper MAPPER = new ObjectMapper(); diff --git a/src/test/java/org/kohsuke/github/GHMilestoneTest.java b/src/test/java/org/kohsuke/github/GHMilestoneTest.java new file mode 100644 index 0000000000..c0ab886743 --- /dev/null +++ b/src/test/java/org/kohsuke/github/GHMilestoneTest.java @@ -0,0 +1,64 @@ +package org.kohsuke.github; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; +import java.util.Date; + +/** + * @author Martin van Zijl + */ +public class GHMilestoneTest extends AbstractGitHubWireMockTest { + + @Before + @After + public void cleanUp() throws Exception { + // Cleanup is only needed when proxying + if (!mockGitHub.isUseProxy()) { + return; + } + + for (GHMilestone milestone : getRepository(gitHubBeforeAfter).listMilestones(GHIssueState.ALL)) { + if ("Original Title".equals(milestone.getTitle()) || + "Updated Title".equals(milestone.getTitle())) { + milestone.delete(); + } + } + } + + @Test + public void testUpdateMilestone() throws Exception { + GHRepository repo = getRepository(); + GHMilestone milestone = repo.createMilestone("Original Title", + "To test the update methods"); + + String NEW_TITLE = "Updated Title"; + String NEW_DESCRIPTION = "Updated Description"; + Date NEW_DUE_DATE = GitHub.parseDate("2020-10-05T13:00:00Z"); + Date OUTPUT_DUE_DATE = GitHub.parseDate("2020-10-05T07:00:00Z"); + + milestone.setTitle(NEW_TITLE); + milestone.setDescription(NEW_DESCRIPTION); + milestone.setDueOn(NEW_DUE_DATE); + + // Force reload. + milestone = repo.getMilestone(milestone.getNumber()); + + assertEquals(NEW_TITLE, milestone.getTitle()); + assertEquals(NEW_DESCRIPTION, milestone.getDescription()); + + // The time is truncated when sent to the server, but still part of the returned value + // 07:00 midnight PDT + assertEquals(OUTPUT_DUE_DATE, milestone.getDueOn()); + } + + protected GHRepository getRepository() throws IOException { + return getRepository(gitHub); + } + + private GHRepository getRepository(GitHub gitHub) throws IOException { + return gitHub.getOrganization("github-api-test-org").getRepository("github-api"); + } +} diff --git a/src/test/java/org/kohsuke/github/GitHubStaticTest.java b/src/test/java/org/kohsuke/github/GitHubStaticTest.java new file mode 100644 index 0000000000..793f23cc7c --- /dev/null +++ b/src/test/java/org/kohsuke/github/GitHubStaticTest.java @@ -0,0 +1,72 @@ +package org.kohsuke.github; + +import org.junit.Assert; +import org.junit.Test; + +import java.text.SimpleDateFormat; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.Date; +import java.util.TimeZone; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.not; + +/** + * Unit test for {@link GitHub} static helpers. + * + * @author Liam Newman + */ +public class GitHubStaticTest extends Assert { + + @Test + public void timeRoundTrip() throws Exception { + Instant instantNow = Instant.now(); + + Date instantSeconds = Date.from(instantNow.truncatedTo(ChronoUnit.SECONDS)); + Date instantMillis = Date.from(instantNow.truncatedTo(ChronoUnit.MILLIS)); + + // TODO: other formats + String instantFormatSlash = formatDate(instantMillis, "yyyy/MM/dd HH:mm:ss ZZZZ"); + String instantFormatDash = formatDate(instantMillis, "yyyy-MM-dd'T'HH:mm:ss'Z'"); + String instantFormatMillis = formatDate(instantMillis, "yyyy-MM-dd'T'HH:mm:ss.S'Z'"); + String instantSecondsFormatMillis = formatDate(instantSeconds, "yyyy-MM-dd'T'HH:mm:ss.S'Z'"); + String instantBadFormat = formatDate(instantMillis, "yy-MM-dd'T'HH:mm'Z'"); + + + assertThat(GitHub.parseDate(GitHub.printDate(instantSeconds)), + equalTo(GitHub.parseDate(GitHub.printDate(instantMillis)))); + + assertThat(instantSeconds, + equalTo(GitHub.parseDate(GitHub.printDate(instantSeconds)))); + + assertThat(instantMillis, + not(equalTo(GitHub.parseDate(GitHub.printDate(instantMillis))))); + + assertThat(instantSeconds, + equalTo(GitHub.parseDate(instantFormatSlash))); + + assertThat(instantSeconds, + equalTo(GitHub.parseDate(instantFormatDash))); + + assertThat(instantMillis, + equalTo(GitHub.parseDate(instantFormatMillis))); + + assertThat(instantSeconds, + equalTo(GitHub.parseDate(instantSecondsFormatMillis))); + + try { + GitHub.parseDate(instantBadFormat); + fail("Bad time format should throw."); + } catch (IllegalStateException e) { + assertThat(e.getMessage(), equalTo("Unable to parse the timestamp: " + instantBadFormat)); + } + } + + static String formatDate(Date dt, String format) { + SimpleDateFormat df = new SimpleDateFormat(format); + df.setTimeZone(TimeZone.getTimeZone("GMT")); + return df.format(dt); + } + +} diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/orgs_github-api-test-org-fdbcaf38-478b-440a-851a-b5913757f6f3.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/orgs_github-api-test-org-fdbcaf38-478b-440a-851a-b5913757f6f3.json new file mode 100644 index 0000000000..99b5920ccb --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/orgs_github-api-test-org-fdbcaf38-478b-440a-851a-b5913757f6f3.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": 10, + "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": 132, + "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": 7, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api-701999a2-14ad-4078-ab89-b0f722cbc52f.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api-701999a2-14ad-4078-ab89-b0f722cbc52f.json new file mode 100644 index 0000000000..0f9bc22b6b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api-701999a2-14ad-4078-ab89-b0f722cbc52f.json @@ -0,0 +1,330 @@ +{ + "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": "2019-10-30T01:54:39Z", + "pushed_at": "2019-10-21T22:34:49Z", + "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": 11391, + "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": 0, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "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": "2019-10-30T19:56:01Z", + "pushed_at": "2019-10-30T19:57:20Z", + "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": "http://github-api.kohsuke.org/", + "size": 14762, + "stargazers_count": 568, + "watchers_count": 568, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 433, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 66, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 433, + "open_issues": 66, + "watchers": 568, + "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": "2019-10-30T19:56:01Z", + "pushed_at": "2019-10-30T19:57:20Z", + "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": "http://github-api.kohsuke.org/", + "size": 14762, + "stargazers_count": 568, + "watchers_count": 568, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 433, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 66, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 433, + "open_issues": 66, + "watchers": 568, + "default_branch": "master" + }, + "network_count": 433, + "subscribers_count": 0 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api_milestones-a7ebf1ae-cbbb-4c59-8844-6888ad2493ba.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api_milestones-a7ebf1ae-cbbb-4c59-8844-6888ad2493ba.json new file mode 100644 index 0000000000..bdc4076cb0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api_milestones-a7ebf1ae-cbbb-4c59-8844-6888ad2493ba.json @@ -0,0 +1,37 @@ +{ + "url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2", + "html_url": "https://github.com/github-api-test-org/github-api/milestone/2", + "labels_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2/labels", + "id": 4800108, + "node_id": "MDk6TWlsZXN0b25lNDgwMDEwOA==", + "number": 2, + "title": "Original Title", + "description": "To test the update methods", + "creator": { + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false + }, + "open_issues": 0, + "closed_issues": 0, + "state": "open", + "created_at": "2019-10-30T22:04:20Z", + "updated_at": "2019-10-30T22:04:20Z", + "due_on": null, + "closed_at": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api_milestones_2-80930c65-6614-40e9-8cfb-51244eb49764.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api_milestones_2-80930c65-6614-40e9-8cfb-51244eb49764.json new file mode 100644 index 0000000000..12e70dbbd6 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api_milestones_2-80930c65-6614-40e9-8cfb-51244eb49764.json @@ -0,0 +1,37 @@ +{ + "url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2", + "html_url": "https://github.com/github-api-test-org/github-api/milestone/2", + "labels_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2/labels", + "id": 4800108, + "node_id": "MDk6TWlsZXN0b25lNDgwMDEwOA==", + "number": 2, + "title": "Updated Title", + "description": "To test the update methods", + "creator": { + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false + }, + "open_issues": 0, + "closed_issues": 0, + "state": "open", + "created_at": "2019-10-30T22:04:20Z", + "updated_at": "2019-10-30T22:04:21Z", + "due_on": null, + "closed_at": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api_milestones_2-865125bf-0f31-4650-b668-9d5d72c47680.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api_milestones_2-865125bf-0f31-4650-b668-9d5d72c47680.json new file mode 100644 index 0000000000..d1d89fe992 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api_milestones_2-865125bf-0f31-4650-b668-9d5d72c47680.json @@ -0,0 +1,37 @@ +{ + "url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2", + "html_url": "https://github.com/github-api-test-org/github-api/milestone/2", + "labels_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2/labels", + "id": 4800108, + "node_id": "MDk6TWlsZXN0b25lNDgwMDEwOA==", + "number": 2, + "title": "Updated Title", + "description": "Updated Description", + "creator": { + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false + }, + "open_issues": 0, + "closed_issues": 0, + "state": "open", + "created_at": "2019-10-30T22:04:20Z", + "updated_at": "2019-10-30T22:04:21Z", + "due_on": null, + "closed_at": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api_milestones_2-b24a5b3a-76c0-44f6-950b-d0fdec878349.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api_milestones_2-b24a5b3a-76c0-44f6-950b-d0fdec878349.json new file mode 100644 index 0000000000..a388cf456d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api_milestones_2-b24a5b3a-76c0-44f6-950b-d0fdec878349.json @@ -0,0 +1,37 @@ +{ + "url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2", + "html_url": "https://github.com/github-api-test-org/github-api/milestone/2", + "labels_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2/labels", + "id": 4800108, + "node_id": "MDk6TWlsZXN0b25lNDgwMDEwOA==", + "number": 2, + "title": "Updated Title", + "description": "Updated Description", + "creator": { + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false + }, + "open_issues": 0, + "closed_issues": 0, + "state": "open", + "created_at": "2019-10-30T22:04:20Z", + "updated_at": "2019-10-30T22:04:21Z", + "due_on": "2020-10-05T07:00:00Z", + "closed_at": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api_milestones_2-fffe46e8-0b2e-4195-8e42-857e3127cd0b.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api_milestones_2-fffe46e8-0b2e-4195-8e42-857e3127cd0b.json new file mode 100644 index 0000000000..a388cf456d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api_milestones_2-fffe46e8-0b2e-4195-8e42-857e3127cd0b.json @@ -0,0 +1,37 @@ +{ + "url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2", + "html_url": "https://github.com/github-api-test-org/github-api/milestone/2", + "labels_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2/labels", + "id": 4800108, + "node_id": "MDk6TWlsZXN0b25lNDgwMDEwOA==", + "number": 2, + "title": "Updated Title", + "description": "Updated Description", + "creator": { + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false + }, + "open_issues": 0, + "closed_issues": 0, + "state": "open", + "created_at": "2019-10-30T22:04:20Z", + "updated_at": "2019-10-30T22:04:21Z", + "due_on": "2020-10-05T07:00:00Z", + "closed_at": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/user-7feb269c-7db0-4c3f-8c58-f99bdf1cafe8.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/user-7feb269c-7db0-4c3f-8c58-f99bdf1cafe8.json new file mode 100644 index 0000000000..a4b576e8a7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/user-7feb269c-7db0-4c3f-8c58-f99bdf1cafe8.json @@ -0,0 +1,45 @@ +{ + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": "https://twitter.com/bitwiseman", + "public_repos": 169, + "public_gists": 7, + "followers": 139, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2019-09-24T19:32:29Z", + "private_gists": 7, + "total_private_repos": 9, + "owned_private_repos": 0, + "disk_usage": 33697, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/orgs_github-api-test-org-2-fdbcaf.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/orgs_github-api-test-org-2-fdbcaf.json new file mode 100644 index 0000000000..e42826ff10 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/orgs_github-api-test-org-2-fdbcaf.json @@ -0,0 +1,43 @@ +{ + "id": "fdbcaf38-478b-440a-851a-b5913757f6f3", + "name": "orgs_github-api-test-org", + "request": { + "url": "/orgs/github-api-test-org", + "method": "GET" + }, + "response": { + "status": 200, + "bodyFileName": "orgs_github-api-test-org-fdbcaf38-478b-440a-851a-b5913757f6f3.json", + "headers": { + "Date": "Wed, 30 Oct 2019 22:04:20 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4950", + "X-RateLimit-Reset": "1572476616", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"bbee0a14a82ca84871298052e1bcb545\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F2AC:26CD:64AA4:B171A:5DBA08E2" + } + }, + "uuid": "fdbcaf38-478b-440a-851a-b5913757f6f3", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api-3-701999.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api-3-701999.json new file mode 100644 index 0000000000..2770826787 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api-3-701999.json @@ -0,0 +1,43 @@ +{ + "id": "701999a2-14ad-4078-ab89-b0f722cbc52f", + "name": "repos_github-api-test-org_github-api", + "request": { + "url": "/repos/github-api-test-org/github-api", + "method": "GET" + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_github-api-701999a2-14ad-4078-ab89-b0f722cbc52f.json", + "headers": { + "Date": "Wed, 30 Oct 2019 22:04:20 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4949", + "X-RateLimit-Reset": "1572476616", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"50590b38f0a75703e69533e84bda5c10\"", + "Last-Modified": "Wed, 30 Oct 2019 01:54:39 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "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": "F2AC:26CD:64AA6:B173A:5DBA08E4" + } + }, + "uuid": "701999a2-14ad-4078-ab89-b0f722cbc52f", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api_milestones-4-a7ebf1.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api_milestones-4-a7ebf1.json new file mode 100644 index 0000000000..6cccf55064 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api_milestones-4-a7ebf1.json @@ -0,0 +1,47 @@ +{ + "id": "a7ebf1ae-cbbb-4c59-8844-6888ad2493ba", + "name": "repos_github-api-test-org_github-api_milestones", + "request": { + "url": "/repos/github-api-test-org/github-api/milestones", + "method": "POST", + "bodyPatterns": [ + { + "equalToJson": "{\"description\":\"To test the update methods\",\"title\":\"Original Title\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "repos_github-api-test-org_github-api_milestones-a7ebf1ae-cbbb-4c59-8844-6888ad2493ba.json", + "headers": { + "Server": "GitHub.com", + "Date": "Wed, 30 Oct 2019 22:04:20 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4948", + "X-RateLimit-Reset": "1572476616", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", + "ETag": "\"ce66f12f4b019a623862f9099dd8ac06\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "Location": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2", + "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": "F2AC:26CD:64AA9:B173C:5DBA08E4" + } + }, + "uuid": "a7ebf1ae-cbbb-4c59-8844-6888ad2493ba", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api_milestones_2-5-80930c.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api_milestones_2-5-80930c.json new file mode 100644 index 0000000000..031df1abd5 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api_milestones_2-5-80930c.json @@ -0,0 +1,49 @@ +{ + "id": "80930c65-6614-40e9-8cfb-51244eb49764", + "name": "repos_github-api-test-org_github-api_milestones_2", + "request": { + "url": "/repos/github-api-test-org/github-api/milestones/2", + "method": "PATCH", + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Updated Title\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_github-api_milestones_2-80930c65-6614-40e9-8cfb-51244eb49764.json", + "headers": { + "Date": "Wed, 30 Oct 2019 22:04:21 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4947", + "X-RateLimit-Reset": "1572476616", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"870c796ce201b8d104442df63f095b43\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F2AC:26CD:64AAB:B1740:5DBA08E4" + } + }, + "uuid": "80930c65-6614-40e9-8cfb-51244eb49764", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api_milestones_2-6-865125.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api_milestones_2-6-865125.json new file mode 100644 index 0000000000..6f622186ac --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api_milestones_2-6-865125.json @@ -0,0 +1,46 @@ +{ + "id": "865125bf-0f31-4650-b668-9d5d72c47680", + "name": "repos_github-api-test-org_github-api_milestones_2", + "request": { + "url": "/repos/github-api-test-org/github-api/milestones/2", + "method": "PATCH", + "bodyPatterns": [ + { + "equalToJson": "{\"description\":\"Updated Description\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_github-api_milestones_2-865125bf-0f31-4650-b668-9d5d72c47680.json", + "headers": { + "Server": "GitHub.com", + "Date": "Wed, 30 Oct 2019 22:04:21 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4946", + "X-RateLimit-Reset": "1572476616", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", + "ETag": "W/\"d4dd5030d06a729043f3d03079e9fe3d\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F2AC:26CD:64AAE:B1744:5DBA08E5" + } + }, + "uuid": "865125bf-0f31-4650-b668-9d5d72c47680", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api_milestones_2-7-b24a5b.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api_milestones_2-7-b24a5b.json new file mode 100644 index 0000000000..c34ee3e36b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api_milestones_2-7-b24a5b.json @@ -0,0 +1,49 @@ +{ + "id": "b24a5b3a-76c0-44f6-950b-d0fdec878349", + "name": "repos_github-api-test-org_github-api_milestones_2", + "request": { + "url": "/repos/github-api-test-org/github-api/milestones/2", + "method": "PATCH", + "bodyPatterns": [ + { + "equalToJson": "{\"due_on\":\"2020-10-05T13:00:00Z\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_github-api_milestones_2-b24a5b3a-76c0-44f6-950b-d0fdec878349.json", + "headers": { + "Date": "Wed, 30 Oct 2019 22:04:21 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4945", + "X-RateLimit-Reset": "1572476616", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"f6b5158570f599d271e8d001b807457e\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F2AC:26CD:64AB1:B1749:5DBA08E5" + } + }, + "uuid": "b24a5b3a-76c0-44f6-950b-d0fdec878349", + "persistent": true, + "insertionIndex": 7 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api_milestones_2-8-fffe46.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api_milestones_2-8-fffe46.json new file mode 100644 index 0000000000..8261347b99 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/repos_github-api-test-org_github-api_milestones_2-8-fffe46.json @@ -0,0 +1,43 @@ +{ + "id": "fffe46e8-0b2e-4195-8e42-857e3127cd0b", + "name": "repos_github-api-test-org_github-api_milestones_2", + "request": { + "url": "/repos/github-api-test-org/github-api/milestones/2", + "method": "GET" + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_github-api_milestones_2-fffe46e8-0b2e-4195-8e42-857e3127cd0b.json", + "headers": { + "Date": "Wed, 30 Oct 2019 22:04:21 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4944", + "X-RateLimit-Reset": "1572476616", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"f6b5158570f599d271e8d001b807457e\"", + "Last-Modified": "Wed, 30 Oct 2019 22:04:21 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, 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": "F2AC:26CD:64AB3:B174F:5DBA08E5" + } + }, + "uuid": "fffe46e8-0b2e-4195-8e42-857e3127cd0b", + "persistent": true, + "insertionIndex": 8 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/user-1-7feb26.json b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/user-1-7feb26.json new file mode 100644 index 0000000000..9d8543b240 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/mappings/user-1-7feb26.json @@ -0,0 +1,40 @@ +{ + "id": "7feb269c-7db0-4c3f-8c58-f99bdf1cafe8", + "name": "user", + "request": { + "url": "/user", + "method": "GET" + }, + "response": { + "status": 200, + "bodyFileName": "user-7feb269c-7db0-4c3f-8c58-f99bdf1cafe8.json", + "headers": { + "Server": "GitHub.com", + "Date": "Wed, 30 Oct 2019 22:04:18 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4955", + "X-RateLimit-Reset": "1572476616", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", + "ETag": "W/\"8c3d3dcf6fc5f9edaf26c902295396e5\"", + "Last-Modified": "Tue, 24 Sep 2019 19:32:29 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F2AC:26CD:64A8F:B1718:5DBA08E2" + } + }, + "uuid": "7feb269c-7db0-4c3f-8c58-f99bdf1cafe8", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file