From af67eb7f0b7c276ce9d5a79e16e9ec323efd1a16 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Fri, 29 May 2020 16:28:47 +0200 Subject: [PATCH 01/34] feat: add new APi for Discussion --- src/main/java/org/kohsuke/github/GHTeam.java | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHTeam.java b/src/main/java/org/kohsuke/github/GHTeam.java index 421c18bb06..508944b1f4 100644 --- a/src/main/java/org/kohsuke/github/GHTeam.java +++ b/src/main/java/org/kohsuke/github/GHTeam.java @@ -130,6 +130,19 @@ public void setPrivacy(Privacy privacy) throws IOException { root.createRequest().method("PATCH").with("privacy", privacy).withUrlPath(api("")).send(); } + /** + * Retrieves the discussions. + * + * @return the paged iterable + * @throws IOException + * the io exception + */ + public PagedIterable listDiscussions() throws IOException { + return root.createRequest() + .withUrlPath(api("/discussions")) + .toIterable(GHDiscussion[].class, item -> item.wrapUp(root)); + } + /** * Retrieves the current members. * @@ -297,6 +310,21 @@ private String api(String tail) { return "/teams/" + getId() + tail; } + /** + * Starts a builder that creates a new discussion. + * + *

+ * You use the returned builder to set various properties, then call {@link GHDiscussionBuilder#create()} to finally + * create a discussion. + * + * @param name + * the name + * @return the gh create discussion builder + */ + public GHDiscussionBuilder createDiscussion(String name) throws IOException { + return new GHDiscussionBuilder(this, name); + } + /** * Gets organization. * From 29aab9e9f4bdab4949a78a9f59789284fba6d33c Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Fri, 29 May 2020 16:34:07 +0200 Subject: [PATCH 02/34] chore: Add missing classes and test case --- .../java/org/kohsuke/github/GHDiscussion.java | 41 +++++++++++++ .../kohsuke/github/GHDiscussionBuilder.java | 57 +++++++++++++++++++ .../org/kohsuke/github/GHDiscussionTest.java | 27 +++++++++ .../__files/orgs_hub4j-test-org-1.json | 25 ++++++++ .../mappings/orgs_hub4j-test-org-1.json | 47 +++++++++++++++ ...rgs_hub4j-test-org_teams_dummy-team-2.json | 40 +++++++++++++ 6 files changed, 237 insertions(+) create mode 100644 src/main/java/org/kohsuke/github/GHDiscussion.java create mode 100644 src/main/java/org/kohsuke/github/GHDiscussionBuilder.java create mode 100644 src/test/java/org/kohsuke/github/GHDiscussionTest.java create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json diff --git a/src/main/java/org/kohsuke/github/GHDiscussion.java b/src/main/java/org/kohsuke/github/GHDiscussion.java new file mode 100644 index 0000000000..3cd113ffb0 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHDiscussion.java @@ -0,0 +1,41 @@ +package org.kohsuke.github; + +import java.io.IOException; +import java.net.URL; + +/** + * A discussion in GitHub Team. + * + * @author Charles Moulliard + */ +public class GHDiscussion extends GHObject { + + protected String body, title, html_url; + + @Override + public URL getHtmlUrl() throws IOException { + return GitHubClient.parseURL(html_url); + } + + public GHDiscussion wrapUp(GitHub root) { + return this; + } + + /** + * Get the title of the discussion. + * + * @return the title + */ + public String getTitle() { + return title; + } + + /** + * The description of this discussion. + * + * @return the body + */ + public String getBody() { + return body; + } +} diff --git a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java new file mode 100644 index 0000000000..b0d23d5a1c --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java @@ -0,0 +1,57 @@ +package org.kohsuke.github; + +import java.io.IOException; + +/** + * Creates a Discussion. + * + * https://developer.github.com/v3/teams/discussions/#create-a-discussion + */ +public class GHDiscussionBuilder { + + protected final Requester builder; + private final GHTeam team; + + public GHDiscussionBuilder(GHTeam team, String title) { + this.team = team; + this.builder = team.root.createRequest(); + builder.with("title", title); + } + + /** + * Title for this discussion. + * + * @param title + * title of discussion + * @return a builder to continue with building + */ + public GHDiscussionBuilder title(String title) { + this.builder.with("title", title); + return this; + } + + /** + * Body content for this discussion. + * + * @param body + * title of discussion + * @return a builder to continue with building + */ + public GHDiscussionBuilder body(String body) { + this.builder.with("body", body); + return this; + } + + /** + * Creates a discussion with all the parameters. + * + * @return the gh discussion + * @throws IOException + * if discussion cannot be created + */ + public GHDiscussion create() throws IOException { + return builder.method("POST") + .withUrlPath("/orgs/" + team.getOrganization().getName() + "/teams/" + team.getSlug() + "/discussions") + .fetch(GHDiscussion.class); + } +} diff --git a/src/test/java/org/kohsuke/github/GHDiscussionTest.java b/src/test/java/org/kohsuke/github/GHDiscussionTest.java new file mode 100644 index 0000000000..76845ec07f --- /dev/null +++ b/src/test/java/org/kohsuke/github/GHDiscussionTest.java @@ -0,0 +1,27 @@ +package org.kohsuke.github; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class GHDiscussionTest extends AbstractGitHubWireMockTest { + + private GHDiscussion discussion; + + @Before + public void setUp() throws Exception { + discussion = gitHub.getOrganization(GITHUB_API_TEST_ORG) + .getTeamBySlug("dummy-team") + .createDiscussion("Dummy") + .body("This is a dummy discussion") + .create(); + } + + @Test + public void testCreatedDiscussion() { + Assert.assertNotNull(discussion); + Assert.assertEquals("Dummy", discussion.getTitle()); + Assert.assertEquals("This is a dummy discussion", discussion.getBody()); + } + +} diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-1.json new file mode 100644 index 0000000000..7351d45003 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-1.json @@ -0,0 +1,25 @@ +{ + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 15, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-05-15T15:14:14Z", + "type": "Organization" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json new file mode 100644 index 0000000000..803e8376ba --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json @@ -0,0 +1,47 @@ +{ + "id": "0538209e-9688-48a6-a4ba-dd1aa235fd8f", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org-1.json", + "headers": { + "Date": "Fri, 29 May 2020 14:11:47 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4971", + "X-RateLimit-Reset": "1590761616", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"8d423aedcf453f644f288ee2e4447514\"", + "Last-Modified": "Fri, 15 May 2020 15:14:14 GMT", + "X-OAuth-Scopes": "admin:org, 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", + "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": "D7D6:28A9C:27E8D8:2FB989:5ED11823" + } + }, + "uuid": "0538209e-9688-48a6-a4ba-dd1aa235fd8f", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json new file mode 100644 index 0000000000..b97f9131ce --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json @@ -0,0 +1,40 @@ +{ + "id": "87a05847-f898-4c2c-9efa-c16e9592ec00", + "name": "orgs_hub4j-test-org_teams_dummy-team", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 404, + "body": "{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/teams/#get-team-by-name\"}", + "headers": { + "Date": "Fri, 29 May 2020 14:11:48 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "404 Not Found", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4970", + "X-RateLimit-Reset": "1590761617", + "X-OAuth-Scopes": "admin:org, 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", + "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'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "X-GitHub-Request-Id": "D7D6:28A9C:27E916:2FB9A5:5ED11823" + } + }, + "uuid": "87a05847-f898-4c2c-9efa-c16e9592ec00", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file From 9df5871f6b097b280d865eb8864839e108c8e92c Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Fri, 29 May 2020 17:20:54 +0200 Subject: [PATCH 03/34] chore: wrapUp Github instance --- src/main/java/org/kohsuke/github/GHDiscussion.java | 2 ++ src/main/java/org/kohsuke/github/GHDiscussionBuilder.java | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/kohsuke/github/GHDiscussion.java b/src/main/java/org/kohsuke/github/GHDiscussion.java index 3cd113ffb0..0d7bd9ebc7 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussion.java +++ b/src/main/java/org/kohsuke/github/GHDiscussion.java @@ -10,6 +10,7 @@ */ public class GHDiscussion extends GHObject { + protected GitHub root; protected String body, title, html_url; @Override @@ -18,6 +19,7 @@ public URL getHtmlUrl() throws IOException { } public GHDiscussion wrapUp(GitHub root) { + this.root = root; return this; } diff --git a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java index b0d23d5a1c..3c6a5cec54 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java +++ b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java @@ -52,6 +52,7 @@ public GHDiscussionBuilder body(String body) { public GHDiscussion create() throws IOException { return builder.method("POST") .withUrlPath("/orgs/" + team.getOrganization().getName() + "/teams/" + team.getSlug() + "/discussions") - .fetch(GHDiscussion.class); + .fetch(GHDiscussion.class) + .wrapUp(team.root); } } From dd7b4712f17ebbdd13592e7263ac40e4245edcee Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Fri, 29 May 2020 17:24:49 +0200 Subject: [PATCH 04/34] fix: Add missing @throws IOException --- src/main/java/org/kohsuke/github/GHTeam.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHTeam.java b/src/main/java/org/kohsuke/github/GHTeam.java index 508944b1f4..ce30fbff27 100644 --- a/src/main/java/org/kohsuke/github/GHTeam.java +++ b/src/main/java/org/kohsuke/github/GHTeam.java @@ -320,6 +320,8 @@ private String api(String tail) { * @param name * the name * @return the gh create discussion builder + * @throws IOException + * the io exception */ public GHDiscussionBuilder createDiscussion(String name) throws IOException { return new GHDiscussionBuilder(this, name); From d3a66f6605e8c244e925f510737587d48dffc9e6 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Fri, 29 May 2020 17:37:49 +0200 Subject: [PATCH 05/34] chore: Regenerate new testing files --- .../mappings/orgs_hub4j-test-org-1.json | 12 ++++++------ .../orgs_hub4j-test-org_teams_dummy-team-2.json | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json index 803e8376ba..8d0a0265f5 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json @@ -1,5 +1,5 @@ { - "id": "0538209e-9688-48a6-a4ba-dd1aa235fd8f", + "id": "cf32d65d-af91-4245-a6f3-4fc584c92a62", "name": "orgs_hub4j-test-org", "request": { "url": "/orgs/hub4j-test-org", @@ -14,13 +14,13 @@ "status": 200, "bodyFileName": "orgs_hub4j-test-org-1.json", "headers": { - "Date": "Fri, 29 May 2020 14:11:47 GMT", + "Date": "Fri, 29 May 2020 15:36:03 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4971", - "X-RateLimit-Reset": "1590761616", + "X-RateLimit-Remaining": "4966", + "X-RateLimit-Reset": "1590769193", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", @@ -38,10 +38,10 @@ "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": "D7D6:28A9C:27E8D8:2FB989:5ED11823" + "X-GitHub-Request-Id": "DF3F:33B78:373058:421023:5ED12BE3" } }, - "uuid": "0538209e-9688-48a6-a4ba-dd1aa235fd8f", + "uuid": "cf32d65d-af91-4245-a6f3-4fc584c92a62", "persistent": true, "insertionIndex": 1 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json index b97f9131ce..196d6c5355 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json @@ -1,5 +1,5 @@ { - "id": "87a05847-f898-4c2c-9efa-c16e9592ec00", + "id": "c88115f4-b5d0-403c-b953-d7770ec00923", "name": "orgs_hub4j-test-org_teams_dummy-team", "request": { "url": "/orgs/hub4j-test-org/teams/dummy-team", @@ -14,13 +14,13 @@ "status": 404, "body": "{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/teams/#get-team-by-name\"}", "headers": { - "Date": "Fri, 29 May 2020 14:11:48 GMT", + "Date": "Fri, 29 May 2020 15:36:04 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "404 Not Found", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4970", - "X-RateLimit-Reset": "1590761617", + "X-RateLimit-Remaining": "4965", + "X-RateLimit-Reset": "1590769194", "X-OAuth-Scopes": "admin:org, 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", @@ -31,10 +31,10 @@ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", "Content-Security-Policy": "default-src 'none'", "Vary": "Accept-Encoding, Accept, X-Requested-With", - "X-GitHub-Request-Id": "D7D6:28A9C:27E916:2FB9A5:5ED11823" + "X-GitHub-Request-Id": "DF3F:33B78:3730C4:421040:5ED12BE3" } }, - "uuid": "87a05847-f898-4c2c-9efa-c16e9592ec00", + "uuid": "c88115f4-b5d0-403c-b953-d7770ec00923", "persistent": true, "insertionIndex": 2 } \ No newline at end of file From 56fe7452eb5fd4485f3858ae069c924e9eabe600 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 06:59:41 +0200 Subject: [PATCH 06/34] chore. Review test case. Add new wrapUp methods --- .../java/org/kohsuke/github/GHDiscussion.java | 15 ++++++++++++++ .../kohsuke/github/GHDiscussionBuilder.java | 2 +- .../org/kohsuke/github/GHDiscussionTest.java | 20 ++++++------------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHDiscussion.java b/src/main/java/org/kohsuke/github/GHDiscussion.java index 0d7bd9ebc7..8db18862b4 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussion.java +++ b/src/main/java/org/kohsuke/github/GHDiscussion.java @@ -11,6 +11,8 @@ public class GHDiscussion extends GHObject { protected GitHub root; + protected GHOrganization organization; + protected GHTeam team; protected String body, title, html_url; @Override @@ -18,11 +20,24 @@ public URL getHtmlUrl() throws IOException { return GitHubClient.parseURL(html_url); } + public GHDiscussion wrapUp(GHTeam team) throws IOException { + this.root = team.root; + this.organization = team.getOrganization(); + this.team = team; + return this; + } + public GHDiscussion wrapUp(GitHub root) { this.root = root; return this; } + public GHDiscussion wrapUp(GHOrganization owner) { + this.organization = owner; + this.root = owner.root; + return this; + } + /** * Get the title of the discussion. * diff --git a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java index 3c6a5cec54..e03474ed7a 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java +++ b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java @@ -53,6 +53,6 @@ public GHDiscussion create() throws IOException { return builder.method("POST") .withUrlPath("/orgs/" + team.getOrganization().getName() + "/teams/" + team.getSlug() + "/discussions") .fetch(GHDiscussion.class) - .wrapUp(team.root); + .wrapUp(team); } } diff --git a/src/test/java/org/kohsuke/github/GHDiscussionTest.java b/src/test/java/org/kohsuke/github/GHDiscussionTest.java index 76845ec07f..269e967186 100644 --- a/src/test/java/org/kohsuke/github/GHDiscussionTest.java +++ b/src/test/java/org/kohsuke/github/GHDiscussionTest.java @@ -1,27 +1,19 @@ package org.kohsuke.github; import org.junit.Assert; -import org.junit.Before; import org.junit.Test; -public class GHDiscussionTest extends AbstractGitHubWireMockTest { - - private GHDiscussion discussion; +import java.io.IOException; - @Before - public void setUp() throws Exception { - discussion = gitHub.getOrganization(GITHUB_API_TEST_ORG) - .getTeamBySlug("dummy-team") - .createDiscussion("Dummy") - .body("This is a dummy discussion") - .create(); - } +public class GHDiscussionTest extends AbstractGitHubWireMockTest { @Test - public void testCreatedDiscussion() { + public void testCreatedDiscussion() throws IOException { + GHTeam team = gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamBySlug("dummy-team"); + GHDiscussion discussion = team.createDiscussion("Dummy").body("This is a dummy discussion").create(); Assert.assertNotNull(discussion); Assert.assertEquals("Dummy", discussion.getTitle()); Assert.assertEquals("This is a dummy discussion", discussion.getBody()); } -} +} \ No newline at end of file From 6b80bb2b112875e4fe28e66e98c6b2a02819ca2c Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 07:00:14 +0200 Subject: [PATCH 07/34] chore: Remove deleted resources files --- .../__files/orgs_hub4j-test-org-1.json | 25 ---------- .../mappings/orgs_hub4j-test-org-1.json | 47 ------------------- ...rgs_hub4j-test-org_teams_dummy-team-2.json | 40 ---------------- 3 files changed, 112 deletions(-) delete mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-1.json delete mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json delete mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-1.json deleted file mode 100644 index 7351d45003..0000000000 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-1.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "login": "hub4j-test-org", - "id": 7544739, - "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", - "url": "https://api.github.com/orgs/hub4j-test-org", - "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", - "events_url": "https://api.github.com/orgs/hub4j-test-org/events", - "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", - "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", - "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", - "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", - "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", - "description": null, - "is_verified": false, - "has_organization_projects": true, - "has_repository_projects": true, - "public_repos": 15, - "public_gists": 0, - "followers": 0, - "following": 0, - "html_url": "https://github.com/hub4j-test-org", - "created_at": "2014-05-10T19:39:11Z", - "updated_at": "2020-05-15T15:14:14Z", - "type": "Organization" -} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json deleted file mode 100644 index 8d0a0265f5..0000000000 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "id": "cf32d65d-af91-4245-a6f3-4fc584c92a62", - "name": "orgs_hub4j-test-org", - "request": { - "url": "/orgs/hub4j-test-org", - "method": "GET", - "headers": { - "Accept": { - "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" - } - } - }, - "response": { - "status": 200, - "bodyFileName": "orgs_hub4j-test-org-1.json", - "headers": { - "Date": "Fri, 29 May 2020 15:36:03 GMT", - "Content-Type": "application/json; charset=utf-8", - "Server": "GitHub.com", - "Status": "200 OK", - "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4966", - "X-RateLimit-Reset": "1590769193", - "Cache-Control": "private, max-age=60, s-maxage=60", - "Vary": [ - "Accept, Authorization, Cookie, X-GitHub-OTP", - "Accept-Encoding, Accept, X-Requested-With", - "Accept-Encoding" - ], - "ETag": "W/\"8d423aedcf453f644f288ee2e4447514\"", - "Last-Modified": "Fri, 15 May 2020 15:14:14 GMT", - "X-OAuth-Scopes": "admin:org, 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", - "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": "DF3F:33B78:373058:421023:5ED12BE3" - } - }, - "uuid": "cf32d65d-af91-4245-a6f3-4fc584c92a62", - "persistent": true, - "insertionIndex": 1 -} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json deleted file mode 100644 index 196d6c5355..0000000000 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "id": "c88115f4-b5d0-403c-b953-d7770ec00923", - "name": "orgs_hub4j-test-org_teams_dummy-team", - "request": { - "url": "/orgs/hub4j-test-org/teams/dummy-team", - "method": "GET", - "headers": { - "Accept": { - "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" - } - } - }, - "response": { - "status": 404, - "body": "{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/teams/#get-team-by-name\"}", - "headers": { - "Date": "Fri, 29 May 2020 15:36:04 GMT", - "Content-Type": "application/json; charset=utf-8", - "Server": "GitHub.com", - "Status": "404 Not Found", - "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4965", - "X-RateLimit-Reset": "1590769194", - "X-OAuth-Scopes": "admin:org, 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", - "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'", - "Vary": "Accept-Encoding, Accept, X-Requested-With", - "X-GitHub-Request-Id": "DF3F:33B78:3730C4:421040:5ED12BE3" - } - }, - "uuid": "c88115f4-b5d0-403c-b953-d7770ec00923", - "persistent": true, - "insertionIndex": 2 -} \ No newline at end of file From 343d623e02e77f6412617cd425e87da564d34809 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 07:22:53 +0200 Subject: [PATCH 08/34] chore: Push new resource files generated --- .../__files/orgs_hub4j-test-org-1.json | 41 ++++++++++++++++ ...rgs_hub4j-test-org_teams_dummy-team-2.json | 43 +++++++++++++++++ .../mappings/orgs_hub4j-test-org-1.json | 47 +++++++++++++++++++ ...rgs_hub4j-test-org_teams_dummy-team-2.json | 47 +++++++++++++++++++ ...s_null_teams_dummy-team_discussions-3.json | 47 +++++++++++++++++++ 5 files changed, 225 insertions(+) create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_null_teams_dummy-team_discussions-3.json diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-1.json new file mode 100644 index 0000000000..f5d028a8d5 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-1.json @@ -0,0 +1,41 @@ +{ + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 15, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-05-15T15:14:14Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 148, + "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": 10000, + "filled_seats": 18, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json new file mode 100644 index 0000000000..935d098d3a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json @@ -0,0 +1,43 @@ +{ + "name": "dummy-team", + "id": 3451996, + "node_id": "MDQ6VGVhbTM0NTE5OTY=", + "slug": "dummy-team", + "description": "Updated by API TestModified", + "privacy": "closed", + "url": "https://api.github.com/organizations/7544739/team/3451996", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team", + "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", + "permission": "pull", + "created_at": "2019-10-03T21:46:12Z", + "updated_at": "2020-06-02T19:31:50Z", + "members_count": 1, + "repos_count": 1, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 15, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-05-15T15:14:14Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json new file mode 100644 index 0000000000..274cd11375 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json @@ -0,0 +1,47 @@ +{ + "id": "c9af335c-1f76-4548-bee5-06d9d165a0c8", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org-1.json", + "headers": { + "Date": "Thu, 04 Jun 2020 05:21:53 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4969", + "X-RateLimit-Reset": "1591249749", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"85d9357381beb9e67471f6657732a1e3\"", + "Last-Modified": "Fri, 15 May 2020 15:14:14 GMT", + "X-OAuth-Scopes": "admin:org, 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", + "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": "D969:2285A:ADDD4E:CE8715:5ED884F1" + } + }, + "uuid": "c9af335c-1f76-4548-bee5-06d9d165a0c8", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json new file mode 100644 index 0000000000..2d9d75a7df --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json @@ -0,0 +1,47 @@ +{ + "id": "0e1a2398-b107-43a3-b289-145d9a383da9", + "name": "orgs_hub4j-test-org_teams_dummy-team", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-2.json", + "headers": { + "Date": "Thu, 04 Jun 2020 05:21:53 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4968", + "X-RateLimit-Reset": "1591249749", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"eaf40cdc7114f49ddddf745b65131b00\"", + "Last-Modified": "Tue, 02 Jun 2020 19:31:50 GMT", + "X-OAuth-Scopes": "admin:org, 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", + "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": "D969:2285A:ADDDC7:CE8740:5ED884F1" + } + }, + "uuid": "0e1a2398-b107-43a3-b289-145d9a383da9", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_null_teams_dummy-team_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_null_teams_dummy-team_discussions-3.json new file mode 100644 index 0000000000..31dcdd3ec9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_null_teams_dummy-team_discussions-3.json @@ -0,0 +1,47 @@ +{ + "id": "00d7317e-48cb-4f70-9efb-148d34750fdb", + "name": "orgs_null_teams_dummy-team_discussions", + "request": { + "url": "/orgs/null/teams/dummy-team/discussions", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Dummy\",\"body\":\"This is a dummy discussion\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 404, + "body": "{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3\"}", + "headers": { + "Date": "Thu, 04 Jun 2020 05:21:54 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "404 Not Found", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4967", + "X-RateLimit-Reset": "1591249749", + "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "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'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "X-GitHub-Request-Id": "D969:2285A:ADDDF8:CE87CD:5ED884F1" + } + }, + "uuid": "00d7317e-48cb-4f70-9efb-148d34750fdb", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file From 3cacbc552c987814f728393b9ba632ad3eeadf48 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 07:30:44 +0200 Subject: [PATCH 09/34] Fix: Set the organisation name to avoid to populate a url request having /orgs/null --- src/test/java/org/kohsuke/github/GHDiscussionTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/kohsuke/github/GHDiscussionTest.java b/src/test/java/org/kohsuke/github/GHDiscussionTest.java index 269e967186..d896b09d1d 100644 --- a/src/test/java/org/kohsuke/github/GHDiscussionTest.java +++ b/src/test/java/org/kohsuke/github/GHDiscussionTest.java @@ -9,7 +9,9 @@ public class GHDiscussionTest extends AbstractGitHubWireMockTest { @Test public void testCreatedDiscussion() throws IOException { - GHTeam team = gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamBySlug("dummy-team"); + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + org.name = GITHUB_API_TEST_ORG; + GHTeam team = org.getTeamBySlug("dummy-team"); GHDiscussion discussion = team.createDiscussion("Dummy").body("This is a dummy discussion").create(); Assert.assertNotNull(discussion); Assert.assertEquals("Dummy", discussion.getTitle()); From 6573f44d412c1e97876652967bed94e1d3f2cc49 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 07:46:51 +0200 Subject: [PATCH 10/34] Fix: As the name of the organization could be empty/null, then use getLogin to get the org name --- src/main/java/org/kohsuke/github/GHDiscussionBuilder.java | 2 +- src/test/java/org/kohsuke/github/GHDiscussionTest.java | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java index e03474ed7a..5cadf5cd1a 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java +++ b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java @@ -51,7 +51,7 @@ public GHDiscussionBuilder body(String body) { */ public GHDiscussion create() throws IOException { return builder.method("POST") - .withUrlPath("/orgs/" + team.getOrganization().getName() + "/teams/" + team.getSlug() + "/discussions") + .withUrlPath("/orgs/" + team.getOrganization().getLogin() + "/teams/" + team.getSlug() + "/discussions") .fetch(GHDiscussion.class) .wrapUp(team); } diff --git a/src/test/java/org/kohsuke/github/GHDiscussionTest.java b/src/test/java/org/kohsuke/github/GHDiscussionTest.java index d896b09d1d..269e967186 100644 --- a/src/test/java/org/kohsuke/github/GHDiscussionTest.java +++ b/src/test/java/org/kohsuke/github/GHDiscussionTest.java @@ -9,9 +9,7 @@ public class GHDiscussionTest extends AbstractGitHubWireMockTest { @Test public void testCreatedDiscussion() throws IOException { - GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); - org.name = GITHUB_API_TEST_ORG; - GHTeam team = org.getTeamBySlug("dummy-team"); + GHTeam team = gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamBySlug("dummy-team"); GHDiscussion discussion = team.createDiscussion("Dummy").body("This is a dummy discussion").create(); Assert.assertNotNull(discussion); Assert.assertEquals("Dummy", discussion.getTitle()); From 84c87ecb32fbbe1a620a0aa14b710e5e2aeafb3e Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 08:49:16 +0200 Subject: [PATCH 11/34] Chore: Fixed the null org within the generated json file but we still get an error 404 --- ...> orgs_hub4j-test-org_teams_dummy-team_discussions-3.json} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/{orgs_null_teams_dummy-team_discussions-3.json => orgs_hub4j-test-org_teams_dummy-team_discussions-3.json} (92%) diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_null_teams_dummy-team_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json similarity index 92% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_null_teams_dummy-team_discussions-3.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json index 31dcdd3ec9..3f9b2a960a 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_null_teams_dummy-team_discussions-3.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json @@ -1,8 +1,8 @@ { "id": "00d7317e-48cb-4f70-9efb-148d34750fdb", - "name": "orgs_null_teams_dummy-team_discussions", + "name": "orgs_hub4j-test-org_teams_dummy-team_discussions", "request": { - "url": "/orgs/null/teams/dummy-team/discussions", + "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions", "method": "POST", "headers": { "Accept": { From f0a3c26ee64b8bdf3809c7a52acd24c28f61cd63 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 10:44:26 +0200 Subject: [PATCH 12/34] Fix: Add the missing correct file to check the discussion created using wiremock --- ...st-org_teams_dummy-team_discussions-1.json | 42 +++++++++++++++++++ ...st-org_teams_dummy-team_discussions-3.json | 6 +-- 2 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-1.json diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-1.json new file mode 100644 index 0000000000..83b4c951dd --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-1.json @@ -0,0 +1,42 @@ +{ + "body": "This is a dummy discussion", + "body_html": "Dummy", + "body_version": "ed736e2c6a052645201cf73d1488260c", + "created_at": "2020-05-28T09:50:20Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/2", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE1NzEz", + "number": 2, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Dummy", + "updated_at": "2020-05-28T09:50:20Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/2", + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 15, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-05-15T15:14:14Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json index 3f9b2a960a..8ecdcd173d 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json @@ -18,13 +18,13 @@ ] }, "response": { - "status": 404, - "body": "{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3\"}", + "status": 200, + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team_discussions-1.json", "headers": { "Date": "Thu, 04 Jun 2020 05:21:54 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", - "Status": "404 Not Found", + "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4967", "X-RateLimit-Reset": "1591249749", From a88e9b28ea0cf69c5fd094ea0ab351ab1c2530d1 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 11:09:24 +0200 Subject: [PATCH 13/34] Update src/main/java/org/kohsuke/github/GHDiscussion.java Change the visibility of the fields from protected to private. Add @JacksonInject annotation. Rename html_url to htmlUrl as needed by Jackson Co-authored-by: Liam Newman --- src/main/java/org/kohsuke/github/GHDiscussion.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHDiscussion.java b/src/main/java/org/kohsuke/github/GHDiscussion.java index 8db18862b4..97ed04b28e 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussion.java +++ b/src/main/java/org/kohsuke/github/GHDiscussion.java @@ -10,10 +10,11 @@ */ public class GHDiscussion extends GHObject { - protected GitHub root; - protected GHOrganization organization; - protected GHTeam team; - protected String body, title, html_url; + @JacksonInject + private GitHub root; + private GHOrganization organization; + private GHTeam team; + private String body, title, htmlUrl; @Override public URL getHtmlUrl() throws IOException { From 2613ce0ac9c1a7f1618f06cb132f36645b200370 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 11:10:21 +0200 Subject: [PATCH 14/34] Update src/main/java/org/kohsuke/github/GHDiscussion.java Remove to set the field `root` Co-authored-by: Liam Newman --- src/main/java/org/kohsuke/github/GHDiscussion.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/kohsuke/github/GHDiscussion.java b/src/main/java/org/kohsuke/github/GHDiscussion.java index 97ed04b28e..3988c57147 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussion.java +++ b/src/main/java/org/kohsuke/github/GHDiscussion.java @@ -22,7 +22,6 @@ public URL getHtmlUrl() throws IOException { } public GHDiscussion wrapUp(GHTeam team) throws IOException { - this.root = team.root; this.organization = team.getOrganization(); this.team = team; return this; From 5d09e6d9abe21fc5053724de0054a94d974b9a0e Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 11:12:38 +0200 Subject: [PATCH 15/34] Update src/main/java/org/kohsuke/github/GHDiscussion.java Remove `this.root` as it is already set with the org Co-authored-by: Liam Newman --- src/main/java/org/kohsuke/github/GHDiscussion.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/kohsuke/github/GHDiscussion.java b/src/main/java/org/kohsuke/github/GHDiscussion.java index 3988c57147..55773dd8bc 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussion.java +++ b/src/main/java/org/kohsuke/github/GHDiscussion.java @@ -34,7 +34,6 @@ public GHDiscussion wrapUp(GitHub root) { public GHDiscussion wrapUp(GHOrganization owner) { this.organization = owner; - this.root = owner.root; return this; } From c116b60d12f4d49b0f404f0231f73cc2798aa6d3 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 11:13:19 +0200 Subject: [PATCH 16/34] Update src/main/java/org/kohsuke/github/GHDiscussion.java Add doc link to github team discussion API Co-authored-by: Liam Newman --- src/main/java/org/kohsuke/github/GHDiscussion.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/kohsuke/github/GHDiscussion.java b/src/main/java/org/kohsuke/github/GHDiscussion.java index 55773dd8bc..2d13bea634 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussion.java +++ b/src/main/java/org/kohsuke/github/GHDiscussion.java @@ -7,6 +7,7 @@ * A discussion in GitHub Team. * * @author Charles Moulliard + * @see GitHub Team Discussions */ public class GHDiscussion extends GHObject { From c6ebf42a47324d51fe6849ce37be7fd060005d91 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 11:14:42 +0200 Subject: [PATCH 17/34] Update src/main/java/org/kohsuke/github/GHTeam.java Dont wrapUp using the team object Co-authored-by: Liam Newman --- src/main/java/org/kohsuke/github/GHTeam.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/kohsuke/github/GHTeam.java b/src/main/java/org/kohsuke/github/GHTeam.java index ce30fbff27..ad73593298 100644 --- a/src/main/java/org/kohsuke/github/GHTeam.java +++ b/src/main/java/org/kohsuke/github/GHTeam.java @@ -140,7 +140,7 @@ public void setPrivacy(Privacy privacy) throws IOException { public PagedIterable listDiscussions() throws IOException { return root.createRequest() .withUrlPath(api("/discussions")) - .toIterable(GHDiscussion[].class, item -> item.wrapUp(root)); + .toIterable(GHDiscussion[].class, item -> item.wrapUp(this)); } /** From 3190bde34339b1be138b902f2b638f4800b78262 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 11:31:50 +0200 Subject: [PATCH 18/34] Fix: Add mising try/catch block to report the exeption when no discussions are found --- src/main/java/org/kohsuke/github/GHTeam.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHTeam.java b/src/main/java/org/kohsuke/github/GHTeam.java index ad73593298..9369ea8906 100644 --- a/src/main/java/org/kohsuke/github/GHTeam.java +++ b/src/main/java/org/kohsuke/github/GHTeam.java @@ -138,9 +138,13 @@ public void setPrivacy(Privacy privacy) throws IOException { * the io exception */ public PagedIterable listDiscussions() throws IOException { - return root.createRequest() - .withUrlPath(api("/discussions")) - .toIterable(GHDiscussion[].class, item -> item.wrapUp(this)); + return root.createRequest().withUrlPath(api("/discussions")).toIterable(GHDiscussion[].class, item -> { + try { + item.wrapUp(this); + } catch (IOException e) { + throw new GHException("Failed to retrieve discussions", e); + } + }); } /** From eca2f017d8085398cd677de7c637dd54f5edf46b Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 11:32:33 +0200 Subject: [PATCH 19/34] Fix: Add missing import statement for the Jackson Annotation. Use the correct htmlUrl field --- src/main/java/org/kohsuke/github/GHDiscussion.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/kohsuke/github/GHDiscussion.java b/src/main/java/org/kohsuke/github/GHDiscussion.java index 2d13bea634..908e3e780c 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussion.java +++ b/src/main/java/org/kohsuke/github/GHDiscussion.java @@ -1,5 +1,7 @@ package org.kohsuke.github; +import com.fasterxml.jackson.annotation.JacksonInject; + import java.io.IOException; import java.net.URL; @@ -19,7 +21,7 @@ public class GHDiscussion extends GHObject { @Override public URL getHtmlUrl() throws IOException { - return GitHubClient.parseURL(html_url); + return GitHubClient.parseURL(htmlUrl); } public GHDiscussion wrapUp(GHTeam team) throws IOException { From ddf625ca04b6c5100c36fd1aab9f64b428a0b672 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 12:20:36 +0200 Subject: [PATCH 20/34] Chore: Add method to delete a discussion using its number. Add field number --- .../java/org/kohsuke/github/GHDiscussion.java | 11 ++++++++++- .../org/kohsuke/github/GHDiscussionBuilder.java | 15 +++++++++++++++ src/main/java/org/kohsuke/github/GHTeam.java | 8 ++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/kohsuke/github/GHDiscussion.java b/src/main/java/org/kohsuke/github/GHDiscussion.java index 908e3e780c..add03ae65f 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussion.java +++ b/src/main/java/org/kohsuke/github/GHDiscussion.java @@ -17,7 +17,7 @@ public class GHDiscussion extends GHObject { private GitHub root; private GHOrganization organization; private GHTeam team; - private String body, title, htmlUrl; + private String number, body, title, htmlUrl; @Override public URL getHtmlUrl() throws IOException { @@ -57,4 +57,13 @@ public String getTitle() { public String getBody() { return body; } + + /** + * The number of this discussion. + * + * @return the number + */ + public String getNumber() { + return number; + } } diff --git a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java index 5cadf5cd1a..d294db8158 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java +++ b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java @@ -55,4 +55,19 @@ public GHDiscussion create() throws IOException { .fetch(GHDiscussion.class) .wrapUp(team); } + + /** + * Delete this discussion from the team. + * + * @param number + * number of the discussion + * @throws IOException + * the io exception + */ + public void delete(String number) throws IOException { + builder.method("DELETE") + .withUrlPath("/orgs/" + team.getOrganization().getLogin() + "/teams/" + team.getSlug() + "/discussions/" + + number) + .send(); + } } diff --git a/src/main/java/org/kohsuke/github/GHTeam.java b/src/main/java/org/kohsuke/github/GHTeam.java index 9369ea8906..21a762869a 100644 --- a/src/main/java/org/kohsuke/github/GHTeam.java +++ b/src/main/java/org/kohsuke/github/GHTeam.java @@ -331,6 +331,14 @@ public GHDiscussionBuilder createDiscussion(String name) throws IOException { return new GHDiscussionBuilder(this, name); } + public void deleteDiscussion(String number) { + try { + new GHDiscussionBuilder(this, name).delete(number); + } catch (IOException e) { + throw new GHException("Failed to delete the discussion : " + number, e); + } + } + /** * Gets organization. * From 74db42a703cd286b28d8a7902024bd5663be8e31 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 12:52:58 +0200 Subject: [PATCH 21/34] Chore: Add method to update a discussion --- .../kohsuke/github/GHDiscussionBuilder.java | 20 +++++++++++++++++++ src/main/java/org/kohsuke/github/GHTeam.java | 19 ++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java index d294db8158..62a4066bd2 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java +++ b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java @@ -18,6 +18,11 @@ public GHDiscussionBuilder(GHTeam team, String title) { builder.with("title", title); } + public GHDiscussionBuilder(GHTeam team) { + this.team = team; + this.builder = team.root.createRequest(); + } + /** * Title for this discussion. * @@ -56,6 +61,21 @@ public GHDiscussion create() throws IOException { .wrapUp(team); } + /** + * Update a discussion with all the parameters. + * + * @return the gh discussion + * @throws IOException + * if discussion cannot be updated + */ + public GHDiscussion update(String number) throws IOException { + return builder.method("PATCH") + .withUrlPath("/orgs/" + team.getOrganization().getLogin() + "/teams/" + team.getSlug() + "/discussions/" + + number) + .fetch(GHDiscussion.class) + .wrapUp(team); + } + /** * Delete this discussion from the team. * diff --git a/src/main/java/org/kohsuke/github/GHTeam.java b/src/main/java/org/kohsuke/github/GHTeam.java index 21a762869a..fc0bbc584a 100644 --- a/src/main/java/org/kohsuke/github/GHTeam.java +++ b/src/main/java/org/kohsuke/github/GHTeam.java @@ -331,6 +331,14 @@ public GHDiscussionBuilder createDiscussion(String name) throws IOException { return new GHDiscussionBuilder(this, name); } + /** + * Creates a builder that delete the discussion + * + * @param number + * the number + * @throws IOException + * the io exception + */ public void deleteDiscussion(String number) { try { new GHDiscussionBuilder(this, name).delete(number); @@ -339,6 +347,17 @@ public void deleteDiscussion(String number) { } } + /** + * Starts a builder that update a new discussion. + * + * @throws IOException + * the io exception + * @return the GHDiscussionBuilder + */ + public GHDiscussionBuilder updateDiscussion() throws IOException { + return new GHDiscussionBuilder(this); + } + /** * Gets organization. * From b00a9faea6dcb995cd9f0d38cb80d27ede7afa9f Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 12:58:07 +0200 Subject: [PATCH 22/34] Fix: Add missing parameter --- src/main/java/org/kohsuke/github/GHDiscussionBuilder.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java index 62a4066bd2..26dcaa54df 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java +++ b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java @@ -64,6 +64,8 @@ public GHDiscussion create() throws IOException { /** * Update a discussion with all the parameters. * + * @param number + * number of the discussion to be updated * @return the gh discussion * @throws IOException * if discussion cannot be updated From 5a612e1332b03fd6d5db9f172b1b6be282c66d34 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 13:25:57 +0200 Subject: [PATCH 23/34] Chore: Add try/catch block if we cannot find the discussion to be updated --- .../org/kohsuke/github/GHDiscussionBuilder.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java index 26dcaa54df..c4d7680539 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java +++ b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java @@ -70,12 +70,16 @@ public GHDiscussion create() throws IOException { * @throws IOException * if discussion cannot be updated */ - public GHDiscussion update(String number) throws IOException { - return builder.method("PATCH") - .withUrlPath("/orgs/" + team.getOrganization().getLogin() + "/teams/" + team.getSlug() + "/discussions/" - + number) - .fetch(GHDiscussion.class) - .wrapUp(team); + public GHDiscussion update(String number) { + try { + return builder.method("PATCH") + .withUrlPath("/orgs/" + team.getOrganization().getLogin() + "/teams/" + team.getSlug() + "/discussions/" + + number) + .fetch(GHDiscussion.class) + .wrapUp(team); + } catch (IOException e) { + throw new GHException("Discussion to be updated not found", e); + } } /** From d1952bf591a377a33c1a75e1427b8fc391ca15d5 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 13:37:08 +0200 Subject: [PATCH 24/34] Chore: Reformat method --- src/main/java/org/kohsuke/github/GHDiscussionBuilder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java index c4d7680539..962450e3b5 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java +++ b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java @@ -73,8 +73,8 @@ public GHDiscussion create() throws IOException { public GHDiscussion update(String number) { try { return builder.method("PATCH") - .withUrlPath("/orgs/" + team.getOrganization().getLogin() + "/teams/" + team.getSlug() + "/discussions/" - + number) + .withUrlPath("/orgs/" + team.getOrganization().getLogin() + "/teams/" + team.getSlug() + + "/discussions/" + number) .fetch(GHDiscussion.class) .wrapUp(team); } catch (IOException e) { From 73f07f13c57d0f4fa5c1894767541524d020a531 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 13:47:41 +0200 Subject: [PATCH 25/34] Chore: Remove javadoc Throwing the exception --- src/main/java/org/kohsuke/github/GHTeam.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHTeam.java b/src/main/java/org/kohsuke/github/GHTeam.java index fc0bbc584a..c9799998f6 100644 --- a/src/main/java/org/kohsuke/github/GHTeam.java +++ b/src/main/java/org/kohsuke/github/GHTeam.java @@ -336,8 +336,6 @@ public GHDiscussionBuilder createDiscussion(String name) throws IOException { * * @param number * the number - * @throws IOException - * the io exception */ public void deleteDiscussion(String number) { try { From 870090e8df263db3a7daf5ed15e87f9c642afd57 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 13:51:04 +0200 Subject: [PATCH 26/34] Chore: Remove javadoc Throwing the exception for the GHDiscussionbuilder - update method --- src/main/java/org/kohsuke/github/GHDiscussionBuilder.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java index 962450e3b5..b2bda60650 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java +++ b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java @@ -67,8 +67,6 @@ public GHDiscussion create() throws IOException { * @param number * number of the discussion to be updated * @return the gh discussion - * @throws IOException - * if discussion cannot be updated */ public GHDiscussion update(String number) { try { From 947caffe0aaa3644f59e14c0b60b8ea23abfdb45 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 17:27:15 +0200 Subject: [PATCH 27/34] Chore: Add method to get a discussion using a number/id --- src/main/java/org/kohsuke/github/GHTeam.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHTeam.java b/src/main/java/org/kohsuke/github/GHTeam.java index c9799998f6..0e7a67be4a 100644 --- a/src/main/java/org/kohsuke/github/GHTeam.java +++ b/src/main/java/org/kohsuke/github/GHTeam.java @@ -147,6 +147,25 @@ public PagedIterable listDiscussions() throws IOException { }); } + /** + * Gets a single discussion by ID. + * + * @param discussionId + * id of the discussion that we want to query for + * @return the discussion + * @throws IOException + * the io exception + * + * @see documentation + */ + public GHDiscussion getDiscussion(String discussionId) throws IOException { + return root.createRequest() + .withUrlPath("/orgs/" + this.getOrganization().getLogin() + "/teams/" + this.getSlug() + "/discussions/" + + discussionId) + .fetch(GHDiscussion.class) + .wrapUp(this); + } + /** * Retrieves the current members. * From 9484f8e0f52dc25ae3297af3e3f52260b25b0c33 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 18:19:41 +0200 Subject: [PATCH 28/34] Chore: Add more methods to test CRUD operations on discusions --- .../java/org/kohsuke/github/GHDiscussion.java | 59 ++++ .../org/kohsuke/github/GHDiscussionTest.java | 58 +++- .../__files/orgs_hub4j-test-org-1.json | 47 +++ ...rgs_hub4j-test-org_teams_dummy-team-2.json | 49 ++++ ...rgs_hub4j-test-org_teams_dummy-team-6.json | 49 ++++ ...st-org_teams_dummy-team_discussions-3.json | 38 +++ ...-org_teams_dummy-team_discussions_6-4.json | 38 +++ ...-org_teams_dummy-team_discussions_6-5.json | 38 +++ ...-org_teams_dummy-team_discussions_6-7.json | 38 +++ .../mappings/orgs_hub4j-test-org-1.json | 47 +++ ...rgs_hub4j-test-org_teams_dummy-team-2.json | 50 ++++ ...rgs_hub4j-test-org_teams_dummy-team-6.json | 49 ++++ ...st-org_teams_dummy-team_discussions-3.json | 54 ++++ ...-org_teams_dummy-team_discussions_6-4.json | 53 ++++ ...-org_teams_dummy-team_discussions_6-5.json | 53 ++++ ...-org_teams_dummy-team_discussions_6-7.json | 46 +++ .../__files/orgs_hub4j-test-org-1.json | 47 +++ ...rgs_hub4j-test-org_teams_dummy-team-2.json | 49 ++++ ...rgs_hub4j-test-org_teams_dummy-team-4.json | 49 ++++ ...st-org_teams_dummy-team_discussions-3.json | 38 +++ .../__files/teams_3451996_discussions-5.json | 268 ++++++++++++++++++ .../mappings/orgs_hub4j-test-org-1.json | 47 +++ ...rgs_hub4j-test-org_teams_dummy-team-2.json | 50 ++++ ...rgs_hub4j-test-org_teams_dummy-team-4.json | 49 ++++ ...st-org_teams_dummy-team_discussions-3.json | 54 ++++ .../mappings/teams_3451996_discussions-5.json | 49 ++++ .../__files/orgs_hub4j-test-org-1.json | 47 +++ ...rgs_hub4j-test-org_teams_dummy-team-2.json | 49 ++++ ...rgs_hub4j-test-org_teams_dummy-team-5.json | 49 ++++ ...st-org_teams_dummy-team_discussions-3.json | 38 +++ .../mappings/orgs_hub4j-test-org-1.json | 47 +++ ...rgs_hub4j-test-org_teams_dummy-team-2.json | 50 ++++ ...rgs_hub4j-test-org_teams_dummy-team-5.json | 49 ++++ ...st-org_teams_dummy-team_discussions-3.json | 54 ++++ ...-org_teams_dummy-team_discussions_8-4.json | 41 +++ ...-org_teams_dummy-team_discussions_8-6.json | 40 +++ 36 files changed, 1927 insertions(+), 3 deletions(-) create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-6.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-6.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-4.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/teams_3451996_discussions-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-4.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/teams_3451996_discussions-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_8-4.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_8-6.json diff --git a/src/main/java/org/kohsuke/github/GHDiscussion.java b/src/main/java/org/kohsuke/github/GHDiscussion.java index add03ae65f..00ec27c2c3 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussion.java +++ b/src/main/java/org/kohsuke/github/GHDiscussion.java @@ -66,4 +66,63 @@ public String getBody() { public String getNumber() { return number; } + + /** + * Sets body. + * + * @param body + * the body + * @throws IOException + * the io exception + */ + public void setBody(String body) throws IOException { + edit("body", body); + } + + /** + * Sets title. + * + * @param title + * the title + * @throws IOException + * the io exception + */ + public void setTitle(String title) throws IOException { + edit("title", title); + } + + /** + * Edit the discussion + * + * @param key + * the key + * @param value + * the value + * @throws IOException + * the io exception + */ + private void edit(String key, Object value) throws IOException { + root.createRequest() + .method("PATCH") + // .withPreview(INERTIA) + .with(key, value) + .withUrlPath("/orgs/" + team.getOrganization().getLogin() + "/teams/" + team.getSlug() + "/discussions/" + + number) + .send(); + } + + /** + * Delete the discussion + * + * @throws IOException + * the io exception + */ + public void delete(String number) throws IOException { + root.createRequest() + // .withPreview(INERTIA) + .method("DELETE") + .withUrlPath("/orgs/" + team.getOrganization().getLogin() + "/teams/" + team.getSlug() + "/discussions/" + + number) + .send(); + } } diff --git a/src/test/java/org/kohsuke/github/GHDiscussionTest.java b/src/test/java/org/kohsuke/github/GHDiscussionTest.java index 269e967186..af6e9a1114 100644 --- a/src/test/java/org/kohsuke/github/GHDiscussionTest.java +++ b/src/test/java/org/kohsuke/github/GHDiscussionTest.java @@ -1,19 +1,71 @@ package org.kohsuke.github; import org.junit.Assert; +import org.junit.Before; +import org.junit.FixMethodOrder; import org.junit.Test; +import org.junit.runners.MethodSorters; +import java.io.FileNotFoundException; import java.io.IOException; +import java.util.HashSet; +import java.util.Set; +/** + * @author Charles Moulliard + */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class GHDiscussionTest extends AbstractGitHubWireMockTest { + private final String TEAM_SLUG = "dummy-team"; + private GHDiscussion discussion; + + @Before + public void setUp() throws Exception { + discussion = gitHub.getOrganization(GITHUB_API_TEST_ORG) + .getTeamBySlug(TEAM_SLUG) + .createDiscussion("Dummy") + .body("This is a dummy discussion") + .create(); + } @Test public void testCreatedDiscussion() throws IOException { - GHTeam team = gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamBySlug("dummy-team"); - GHDiscussion discussion = team.createDiscussion("Dummy").body("This is a dummy discussion").create(); Assert.assertNotNull(discussion); Assert.assertEquals("Dummy", discussion.getTitle()); Assert.assertEquals("This is a dummy discussion", discussion.getBody()); } -} \ No newline at end of file + @Test + public void testGetAndEditDiscussion() throws IOException { + discussion.setBody("This is a dummy discussion changed"); + discussion.setTitle("Dummy title changed"); + discussion = gitHub.getOrganization(GITHUB_API_TEST_ORG) + .getTeamBySlug(TEAM_SLUG) + .getDiscussion(discussion.getNumber()); + Assert.assertEquals("Dummy title changed", discussion.getTitle()); + Assert.assertEquals("This is a dummy discussion changed", discussion.getBody()); + } + + @Test + public void testListDiscussion() throws IOException { + Set all = new HashSet(); + for (GHDiscussion d : gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamBySlug(TEAM_SLUG).listDiscussions()) { + all.add(d); + } ; + assertFalse(all.isEmpty()); + } + + @Test + public void testToDeleteDiscussion() throws IOException { + discussion.delete(discussion.getNumber()); + try { + discussion = gitHub.getOrganization(GITHUB_API_TEST_ORG) + .getTeamBySlug(TEAM_SLUG) + .getDiscussion(discussion.getNumber()); + Assert.assertNull(discussion); + } catch (FileNotFoundException e) { + discussion = null; + } + } + +} diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org-1.json new file mode 100644 index 0000000000..7121c693d7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org-1.json @@ -0,0 +1,47 @@ +{ + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 15, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 148, + "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": 10000, + "filled_seats": 18, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json new file mode 100644 index 0000000000..050225e208 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json @@ -0,0 +1,49 @@ +{ + "name": "dummy-team", + "id": 3451996, + "node_id": "MDQ6VGVhbTM0NTE5OTY=", + "slug": "dummy-team", + "description": "Updated by API TestModified", + "privacy": "closed", + "url": "https://api.github.com/organizations/7544739/team/3451996", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team", + "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", + "permission": "pull", + "created_at": "2019-10-03T21:46:12Z", + "updated_at": "2020-06-02T19:31:50Z", + "members_count": 1, + "repos_count": 1, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 15, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-6.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-6.json new file mode 100644 index 0000000000..050225e208 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-6.json @@ -0,0 +1,49 @@ +{ + "name": "dummy-team", + "id": 3451996, + "node_id": "MDQ6VGVhbTM0NTE5OTY=", + "slug": "dummy-team", + "description": "Updated by API TestModified", + "privacy": "closed", + "url": "https://api.github.com/organizations/7544739/team/3451996", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team", + "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", + "permission": "pull", + "created_at": "2019-10-03T21:46:12Z", + "updated_at": "2020-06-02T19:31:50Z", + "members_count": 1, + "repos_count": 1, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 15, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json new file mode 100644 index 0000000000..f8c84e5be6 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json @@ -0,0 +1,38 @@ +{ + "author": { + "login": "cmoulliard", + "id": 463790, + "node_id": "MDQ6VXNlcjQ2Mzc5MA==", + "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/cmoulliard", + "html_url": "https://github.com/cmoulliard", + "followers_url": "https://api.github.com/users/cmoulliard/followers", + "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", + "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", + "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", + "organizations_url": "https://api.github.com/users/cmoulliard/orgs", + "repos_url": "https://api.github.com/users/cmoulliard/repos", + "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", + "received_events_url": "https://api.github.com/users/cmoulliard/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a dummy discussion", + "body_html": "

This is a dummy discussion

", + "body_version": "d8112c0f6ca6b581773869e497b2bf2e", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6/comments", + "created_at": "2020-06-04T16:17:19Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/6", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3NDI5", + "number": 6, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Dummy", + "updated_at": "2020-06-04T16:17:19Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json new file mode 100644 index 0000000000..d01d5a1fc5 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json @@ -0,0 +1,38 @@ +{ + "author": { + "login": "cmoulliard", + "id": 463790, + "node_id": "MDQ6VXNlcjQ2Mzc5MA==", + "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/cmoulliard", + "html_url": "https://github.com/cmoulliard", + "followers_url": "https://api.github.com/users/cmoulliard/followers", + "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", + "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", + "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", + "organizations_url": "https://api.github.com/users/cmoulliard/orgs", + "repos_url": "https://api.github.com/users/cmoulliard/repos", + "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", + "received_events_url": "https://api.github.com/users/cmoulliard/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a dummy discussion changed", + "body_html": "

This is a dummy discussion changed

", + "body_version": "7e0aad8a790deafb5b416a0c3fe220b4", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6/comments", + "created_at": "2020-06-04T16:17:19Z", + "last_edited_at": "2020-06-04T16:17:19Z", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/6", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3NDI5", + "number": 6, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Dummy", + "updated_at": "2020-06-04T16:17:19Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json new file mode 100644 index 0000000000..ccc00b78f9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json @@ -0,0 +1,38 @@ +{ + "author": { + "login": "cmoulliard", + "id": 463790, + "node_id": "MDQ6VXNlcjQ2Mzc5MA==", + "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/cmoulliard", + "html_url": "https://github.com/cmoulliard", + "followers_url": "https://api.github.com/users/cmoulliard/followers", + "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", + "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", + "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", + "organizations_url": "https://api.github.com/users/cmoulliard/orgs", + "repos_url": "https://api.github.com/users/cmoulliard/repos", + "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", + "received_events_url": "https://api.github.com/users/cmoulliard/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a dummy discussion changed", + "body_html": "

This is a dummy discussion changed

", + "body_version": "7e0aad8a790deafb5b416a0c3fe220b4", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6/comments", + "created_at": "2020-06-04T16:17:19Z", + "last_edited_at": "2020-06-04T16:17:19Z", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/6", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3NDI5", + "number": 6, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Dummy title changed", + "updated_at": "2020-06-04T16:17:20Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json new file mode 100644 index 0000000000..ccc00b78f9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json @@ -0,0 +1,38 @@ +{ + "author": { + "login": "cmoulliard", + "id": 463790, + "node_id": "MDQ6VXNlcjQ2Mzc5MA==", + "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/cmoulliard", + "html_url": "https://github.com/cmoulliard", + "followers_url": "https://api.github.com/users/cmoulliard/followers", + "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", + "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", + "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", + "organizations_url": "https://api.github.com/users/cmoulliard/orgs", + "repos_url": "https://api.github.com/users/cmoulliard/repos", + "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", + "received_events_url": "https://api.github.com/users/cmoulliard/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a dummy discussion changed", + "body_html": "

This is a dummy discussion changed

", + "body_version": "7e0aad8a790deafb5b416a0c3fe220b4", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6/comments", + "created_at": "2020-06-04T16:17:19Z", + "last_edited_at": "2020-06-04T16:17:19Z", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/6", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3NDI5", + "number": 6, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Dummy title changed", + "updated_at": "2020-06-04T16:17:20Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org-1.json new file mode 100644 index 0000000000..52fb4a7805 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org-1.json @@ -0,0 +1,47 @@ +{ + "id": "c7e2c0af-4ef4-48bc-9718-df70a72f3bfd", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org-1.json", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:18 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4999", + "X-RateLimit-Reset": "1591291038", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"1a6a487ed52f9d847d59925e769484a5\"", + "Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT", + "X-OAuth-Scopes": "admin:org, 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", + "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": "FAEC:41F9D:1D0705:233380:5ED91E8E" + } + }, + "uuid": "c7e2c0af-4ef4-48bc-9718-df70a72f3bfd", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json new file mode 100644 index 0000000000..43465dcda4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json @@ -0,0 +1,50 @@ +{ + "id": "0d1be07c-f1d0-4edb-9b3d-2ed1af106287", + "name": "orgs_hub4j-test-org_teams_dummy-team", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-2.json", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:19 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4998", + "X-RateLimit-Reset": "1591291039", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"5b8a20b94c28536e4d7b9af6bd1a2f0a\"", + "Last-Modified": "Tue, 02 Jun 2020 19:31:50 GMT", + "X-OAuth-Scopes": "admin:org, 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", + "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": "FAEC:41F9D:1D0749:2333C0:5ED91E8E" + } + }, + "uuid": "0d1be07c-f1d0-4edb-9b3d-2ed1af106287", + "persistent": true, + "scenarioName": "scenario-1-orgs-hub4j-test-org-teams-dummy-team", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-1-orgs-hub4j-test-org-teams-dummy-team-2", + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-6.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-6.json new file mode 100644 index 0000000000..bc4ce74936 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-6.json @@ -0,0 +1,49 @@ +{ + "id": "1be6b364-bae0-4cc9-9507-66ea542c0c78", + "name": "orgs_hub4j-test-org_teams_dummy-team", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-6.json", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:20 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4994", + "X-RateLimit-Reset": "1591291038", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"5b8a20b94c28536e4d7b9af6bd1a2f0a\"", + "Last-Modified": "Tue, 02 Jun 2020 19:31:50 GMT", + "X-OAuth-Scopes": "admin:org, 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", + "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": "FAEC:41F9D:1D08CB:2335A5:5ED91E90" + } + }, + "uuid": "1be6b364-bae0-4cc9-9507-66ea542c0c78", + "persistent": true, + "scenarioName": "scenario-1-orgs-hub4j-test-org-teams-dummy-team", + "requiredScenarioState": "scenario-1-orgs-hub4j-test-org-teams-dummy-team-2", + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json new file mode 100644 index 0000000000..7b77783b9c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json @@ -0,0 +1,54 @@ +{ + "id": "3d1ae726-74eb-4126-b357-8f4a46cb8393", + "name": "orgs_hub4j-test-org_teams_dummy-team_discussions", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Dummy\",\"body\":\"This is a dummy discussion\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team_discussions-3.json", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:19 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4997", + "X-RateLimit-Reset": "1591291038", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "\"474ad2795527698f2308bfe04055a67e\"", + "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "write:discussion", + "Location": "https://api.github.com/organizations/7544739/team/3451996/discussions/6", + "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": "FAEC:41F9D:1D0786:233411:5ED91E8F" + } + }, + "uuid": "3d1ae726-74eb-4126-b357-8f4a46cb8393", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json new file mode 100644 index 0000000000..be17f8377e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json @@ -0,0 +1,53 @@ +{ + "id": "7f9371c0-638b-488b-918a-11a55e3afd70", + "name": "orgs_hub4j-test-org_teams_dummy-team_discussions_6", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions/6", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"body\":\"This is a dummy discussion changed\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:19 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4996", + "X-RateLimit-Reset": "1591291038", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"bd5a552e2939078a1b746a2bd9889283\"", + "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "write:discussion", + "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": "FAEC:41F9D:1D07DB:23347F:5ED91E8F" + } + }, + "uuid": "7f9371c0-638b-488b-918a-11a55e3afd70", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json new file mode 100644 index 0000000000..aff4636451 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json @@ -0,0 +1,53 @@ +{ + "id": "c5c18eef-a963-40bb-9d14-4d8a1b2b94cb", + "name": "orgs_hub4j-test-org_teams_dummy-team_discussions_6", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions/6", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Dummy title changed\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:20 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4995", + "X-RateLimit-Reset": "1591291039", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"21f9a8bf1c804ea7bcc4c757dd4e94c8\"", + "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "write:discussion", + "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": "FAEC:41F9D:1D0860:23351E:5ED91E8F" + } + }, + "uuid": "c5c18eef-a963-40bb-9d14-4d8a1b2b94cb", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json new file mode 100644 index 0000000000..7dfd1a1eeb --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json @@ -0,0 +1,46 @@ +{ + "id": "f89ff323-7894-4a03-8564-f4494188d54a", + "name": "orgs_hub4j-test-org_teams_dummy-team_discussions_6", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions/6", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:20 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4993", + "X-RateLimit-Reset": "1591291038", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"21f9a8bf1c804ea7bcc4c757dd4e94c8\"", + "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "read:discussion, write:discussion", + "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": "FAEC:41F9D:1D0903:2335ED:5ED91E90" + } + }, + "uuid": "f89ff323-7894-4a03-8564-f4494188d54a", + "persistent": true, + "insertionIndex": 7 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org-1.json new file mode 100644 index 0000000000..7121c693d7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org-1.json @@ -0,0 +1,47 @@ +{ + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 15, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 148, + "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": 10000, + "filled_seats": 18, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json new file mode 100644 index 0000000000..050225e208 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json @@ -0,0 +1,49 @@ +{ + "name": "dummy-team", + "id": 3451996, + "node_id": "MDQ6VGVhbTM0NTE5OTY=", + "slug": "dummy-team", + "description": "Updated by API TestModified", + "privacy": "closed", + "url": "https://api.github.com/organizations/7544739/team/3451996", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team", + "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", + "permission": "pull", + "created_at": "2019-10-03T21:46:12Z", + "updated_at": "2020-06-02T19:31:50Z", + "members_count": 1, + "repos_count": 1, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 15, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-4.json new file mode 100644 index 0000000000..050225e208 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-4.json @@ -0,0 +1,49 @@ +{ + "name": "dummy-team", + "id": 3451996, + "node_id": "MDQ6VGVhbTM0NTE5OTY=", + "slug": "dummy-team", + "description": "Updated by API TestModified", + "privacy": "closed", + "url": "https://api.github.com/organizations/7544739/team/3451996", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team", + "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", + "permission": "pull", + "created_at": "2019-10-03T21:46:12Z", + "updated_at": "2020-06-02T19:31:50Z", + "members_count": 1, + "repos_count": 1, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 15, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json new file mode 100644 index 0000000000..8448c5c953 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json @@ -0,0 +1,38 @@ +{ + "author": { + "login": "cmoulliard", + "id": 463790, + "node_id": "MDQ6VXNlcjQ2Mzc5MA==", + "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/cmoulliard", + "html_url": "https://github.com/cmoulliard", + "followers_url": "https://api.github.com/users/cmoulliard/followers", + "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", + "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", + "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", + "organizations_url": "https://api.github.com/users/cmoulliard/orgs", + "repos_url": "https://api.github.com/users/cmoulliard/repos", + "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", + "received_events_url": "https://api.github.com/users/cmoulliard/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a dummy discussion", + "body_html": "

This is a dummy discussion

", + "body_version": "d8112c0f6ca6b581773869e497b2bf2e", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/7/comments", + "created_at": "2020-06-04T16:17:21Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/7", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3NDMw", + "number": 7, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Dummy", + "updated_at": "2020-06-04T16:17:21Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/7" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/teams_3451996_discussions-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/teams_3451996_discussions-5.json new file mode 100644 index 0000000000..b84b5b778a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/teams_3451996_discussions-5.json @@ -0,0 +1,268 @@ +[ + { + "author": { + "login": "cmoulliard", + "id": 463790, + "node_id": "MDQ6VXNlcjQ2Mzc5MA==", + "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/cmoulliard", + "html_url": "https://github.com/cmoulliard", + "followers_url": "https://api.github.com/users/cmoulliard/followers", + "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", + "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", + "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", + "organizations_url": "https://api.github.com/users/cmoulliard/orgs", + "repos_url": "https://api.github.com/users/cmoulliard/repos", + "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", + "received_events_url": "https://api.github.com/users/cmoulliard/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a dummy discussion", + "body_html": "

This is a dummy discussion

", + "body_version": "d8112c0f6ca6b581773869e497b2bf2e", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/7/comments", + "created_at": "2020-06-04T16:17:21Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/7", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3NDMw", + "number": 7, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Dummy", + "updated_at": "2020-06-04T16:17:21Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/7" + }, + { + "author": { + "login": "cmoulliard", + "id": 463790, + "node_id": "MDQ6VXNlcjQ2Mzc5MA==", + "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/cmoulliard", + "html_url": "https://github.com/cmoulliard", + "followers_url": "https://api.github.com/users/cmoulliard/followers", + "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", + "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", + "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", + "organizations_url": "https://api.github.com/users/cmoulliard/orgs", + "repos_url": "https://api.github.com/users/cmoulliard/repos", + "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", + "received_events_url": "https://api.github.com/users/cmoulliard/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a dummy discussion changed", + "body_html": "

This is a dummy discussion changed

", + "body_version": "7e0aad8a790deafb5b416a0c3fe220b4", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6/comments", + "created_at": "2020-06-04T16:17:19Z", + "last_edited_at": "2020-06-04T16:17:19Z", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/6", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3NDI5", + "number": 6, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Dummy title changed", + "updated_at": "2020-06-04T16:17:20Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6" + }, + { + "author": { + "login": "cmoulliard", + "id": 463790, + "node_id": "MDQ6VXNlcjQ2Mzc5MA==", + "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/cmoulliard", + "html_url": "https://github.com/cmoulliard", + "followers_url": "https://api.github.com/users/cmoulliard/followers", + "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", + "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", + "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", + "organizations_url": "https://api.github.com/users/cmoulliard/orgs", + "repos_url": "https://api.github.com/users/cmoulliard/repos", + "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", + "received_events_url": "https://api.github.com/users/cmoulliard/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a dummy discussion", + "body_html": "

This is a dummy discussion

", + "body_version": "d8112c0f6ca6b581773869e497b2bf2e", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/5/comments", + "created_at": "2020-06-04T06:16:03Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/5", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3MjQ2", + "number": 5, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Dummy", + "updated_at": "2020-06-04T06:16:03Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/5" + }, + { + "author": { + "login": "cmoulliard", + "id": 463790, + "node_id": "MDQ6VXNlcjQ2Mzc5MA==", + "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/cmoulliard", + "html_url": "https://github.com/cmoulliard", + "followers_url": "https://api.github.com/users/cmoulliard/followers", + "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", + "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", + "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", + "organizations_url": "https://api.github.com/users/cmoulliard/orgs", + "repos_url": "https://api.github.com/users/cmoulliard/repos", + "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", + "received_events_url": "https://api.github.com/users/cmoulliard/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a dummy discussion", + "body_html": "

This is a dummy discussion

", + "body_version": "d8112c0f6ca6b581773869e497b2bf2e", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/4/comments", + "created_at": "2020-06-04T05:45:32Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/4", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3MjQ1", + "number": 4, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Dummy", + "updated_at": "2020-06-04T05:45:32Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/4" + }, + { + "author": { + "login": "cmoulliard", + "id": 463790, + "node_id": "MDQ6VXNlcjQ2Mzc5MA==", + "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/cmoulliard", + "html_url": "https://github.com/cmoulliard", + "followers_url": "https://api.github.com/users/cmoulliard/followers", + "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", + "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", + "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", + "organizations_url": "https://api.github.com/users/cmoulliard/orgs", + "repos_url": "https://api.github.com/users/cmoulliard/repos", + "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", + "received_events_url": "https://api.github.com/users/cmoulliard/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a dummy discussion", + "body_html": "

This is a dummy discussion

", + "body_version": "d8112c0f6ca6b581773869e497b2bf2e", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/3/comments", + "created_at": "2020-06-04T05:45:13Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/3", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3MjQ0", + "number": 3, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Dummy", + "updated_at": "2020-06-04T05:45:13Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/3" + }, + { + "author": { + "login": "cmoulliard", + "id": 463790, + "node_id": "MDQ6VXNlcjQ2Mzc5MA==", + "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/cmoulliard", + "html_url": "https://github.com/cmoulliard", + "followers_url": "https://api.github.com/users/cmoulliard/followers", + "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", + "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", + "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", + "organizations_url": "https://api.github.com/users/cmoulliard/orgs", + "repos_url": "https://api.github.com/users/cmoulliard/repos", + "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", + "received_events_url": "https://api.github.com/users/cmoulliard/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a dummy discussion", + "body_html": "

This is a dummy discussion

", + "body_version": "d8112c0f6ca6b581773869e497b2bf2e", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/2/comments", + "created_at": "2020-06-04T05:29:38Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/2", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3MjQw", + "number": 2, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Dummy", + "updated_at": "2020-06-04T05:29:38Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/2" + }, + { + "author": { + "login": "cmoulliard", + "id": 463790, + "node_id": "MDQ6VXNlcjQ2Mzc5MA==", + "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/cmoulliard", + "html_url": "https://github.com/cmoulliard", + "followers_url": "https://api.github.com/users/cmoulliard/followers", + "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", + "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", + "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", + "organizations_url": "https://api.github.com/users/cmoulliard/orgs", + "repos_url": "https://api.github.com/users/cmoulliard/repos", + "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", + "received_events_url": "https://api.github.com/users/cmoulliard/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a dummy discussion", + "body_html": "

This is a dummy discussion

", + "body_version": "d8112c0f6ca6b581773869e497b2bf2e", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/1/comments", + "created_at": "2020-06-04T05:29:06Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/1", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3MjM5", + "number": 1, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Dummy", + "updated_at": "2020-06-04T05:29:06Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/1" + } +] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org-1.json new file mode 100644 index 0000000000..4a416c6ff3 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org-1.json @@ -0,0 +1,47 @@ +{ + "id": "05732ae7-d8d8-4b1a-a3dd-e3038d14eeb5", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org-1.json", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:21 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4992", + "X-RateLimit-Reset": "1591291039", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"1a6a487ed52f9d847d59925e769484a5\"", + "Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT", + "X-OAuth-Scopes": "admin:org, 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", + "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": "FAF1:20614:1CB0B3:22B36C:5ED91E90" + } + }, + "uuid": "05732ae7-d8d8-4b1a-a3dd-e3038d14eeb5", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json new file mode 100644 index 0000000000..751b779bee --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json @@ -0,0 +1,50 @@ +{ + "id": "817fa46d-cb4e-4ae8-9087-7cd92b0aa5af", + "name": "orgs_hub4j-test-org_teams_dummy-team", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-2.json", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:21 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4991", + "X-RateLimit-Reset": "1591291038", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"5b8a20b94c28536e4d7b9af6bd1a2f0a\"", + "Last-Modified": "Tue, 02 Jun 2020 19:31:50 GMT", + "X-OAuth-Scopes": "admin:org, 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", + "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": "FAF1:20614:1CB0EF:22B3A1:5ED91E91" + } + }, + "uuid": "817fa46d-cb4e-4ae8-9087-7cd92b0aa5af", + "persistent": true, + "scenarioName": "scenario-1-orgs-hub4j-test-org-teams-dummy-team", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-1-orgs-hub4j-test-org-teams-dummy-team-2", + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-4.json new file mode 100644 index 0000000000..35ecd18fe0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-4.json @@ -0,0 +1,49 @@ +{ + "id": "b29d3637-79cb-435c-a350-e6db09c8a127", + "name": "orgs_hub4j-test-org_teams_dummy-team", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-4.json", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:22 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4989", + "X-RateLimit-Reset": "1591291038", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"5b8a20b94c28536e4d7b9af6bd1a2f0a\"", + "Last-Modified": "Tue, 02 Jun 2020 19:31:50 GMT", + "X-OAuth-Scopes": "admin:org, 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", + "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": "FAF1:20614:1CB186:22B45A:5ED91E91" + } + }, + "uuid": "b29d3637-79cb-435c-a350-e6db09c8a127", + "persistent": true, + "scenarioName": "scenario-1-orgs-hub4j-test-org-teams-dummy-team", + "requiredScenarioState": "scenario-1-orgs-hub4j-test-org-teams-dummy-team-2", + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json new file mode 100644 index 0000000000..1aecd9f36e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json @@ -0,0 +1,54 @@ +{ + "id": "da11720f-169a-4998-9136-030e0cfa65a9", + "name": "orgs_hub4j-test-org_teams_dummy-team_discussions", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Dummy\",\"body\":\"This is a dummy discussion\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team_discussions-3.json", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:21 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4990", + "X-RateLimit-Reset": "1591291038", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "\"5516ba109ab62bbb8765be2478b4c049\"", + "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "write:discussion", + "Location": "https://api.github.com/organizations/7544739/team/3451996/discussions/7", + "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": "FAF1:20614:1CB137:22B3F8:5ED91E91" + } + }, + "uuid": "da11720f-169a-4998-9136-030e0cfa65a9", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/teams_3451996_discussions-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/teams_3451996_discussions-5.json new file mode 100644 index 0000000000..8f130cda59 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/teams_3451996_discussions-5.json @@ -0,0 +1,49 @@ +{ + "id": "406e7b31-8211-4903-97aa-08e346658ac3", + "name": "teams_3451996_discussions", + "request": { + "url": "/teams/3451996/discussions", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "teams_3451996_discussions-5.json", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:22 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4988", + "X-RateLimit-Reset": "1591291038", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"afa845a7dd9e8740ffaeabc16184beed\"", + "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "read:discussion, write:discussion", + "X-GitHub-Media-Type": "unknown, github.v3", + "Deprecation": "Sat, 01 Feb 2020 00:00:00 GMT", + "Sunset": "Mon, 01 Feb 2021 00:00:00 GMT", + "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": "FAF1:20614:1CB239:22B533:5ED91E92", + "Link": "; rel=\"deprecation\"; type=\"text/html\", ; rel=\"alternate\"" + } + }, + "uuid": "406e7b31-8211-4903-97aa-08e346658ac3", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org-1.json new file mode 100644 index 0000000000..7121c693d7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org-1.json @@ -0,0 +1,47 @@ +{ + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 15, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 148, + "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": 10000, + "filled_seats": 18, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json new file mode 100644 index 0000000000..050225e208 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json @@ -0,0 +1,49 @@ +{ + "name": "dummy-team", + "id": 3451996, + "node_id": "MDQ6VGVhbTM0NTE5OTY=", + "slug": "dummy-team", + "description": "Updated by API TestModified", + "privacy": "closed", + "url": "https://api.github.com/organizations/7544739/team/3451996", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team", + "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", + "permission": "pull", + "created_at": "2019-10-03T21:46:12Z", + "updated_at": "2020-06-02T19:31:50Z", + "members_count": 1, + "repos_count": 1, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 15, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-5.json new file mode 100644 index 0000000000..050225e208 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-5.json @@ -0,0 +1,49 @@ +{ + "name": "dummy-team", + "id": 3451996, + "node_id": "MDQ6VGVhbTM0NTE5OTY=", + "slug": "dummy-team", + "description": "Updated by API TestModified", + "privacy": "closed", + "url": "https://api.github.com/organizations/7544739/team/3451996", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team", + "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", + "permission": "pull", + "created_at": "2019-10-03T21:46:12Z", + "updated_at": "2020-06-02T19:31:50Z", + "members_count": 1, + "repos_count": 1, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 15, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json new file mode 100644 index 0000000000..d5e170a366 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json @@ -0,0 +1,38 @@ +{ + "author": { + "login": "cmoulliard", + "id": 463790, + "node_id": "MDQ6VXNlcjQ2Mzc5MA==", + "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/cmoulliard", + "html_url": "https://github.com/cmoulliard", + "followers_url": "https://api.github.com/users/cmoulliard/followers", + "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", + "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", + "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", + "organizations_url": "https://api.github.com/users/cmoulliard/orgs", + "repos_url": "https://api.github.com/users/cmoulliard/repos", + "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", + "received_events_url": "https://api.github.com/users/cmoulliard/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a dummy discussion", + "body_html": "

This is a dummy discussion

", + "body_version": "d8112c0f6ca6b581773869e497b2bf2e", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/8/comments", + "created_at": "2020-06-04T16:17:23Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/8", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3NDMx", + "number": 8, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Dummy", + "updated_at": "2020-06-04T16:17:23Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/8" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org-1.json new file mode 100644 index 0000000000..a72d6d5031 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org-1.json @@ -0,0 +1,47 @@ +{ + "id": "8528123a-2f6a-43f9-9c90-9b2b40ce5300", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org-1.json", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:23 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4987", + "X-RateLimit-Reset": "1591291039", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"1a6a487ed52f9d847d59925e769484a5\"", + "Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT", + "X-OAuth-Scopes": "admin:org, 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", + "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": "FAF6:C609:26603A:2E8204:5ED91E92" + } + }, + "uuid": "8528123a-2f6a-43f9-9c90-9b2b40ce5300", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json new file mode 100644 index 0000000000..e76699bbed --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json @@ -0,0 +1,50 @@ +{ + "id": "ee07ede6-da15-4639-991a-5d47d2b1bb33", + "name": "orgs_hub4j-test-org_teams_dummy-team", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-2.json", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:23 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4986", + "X-RateLimit-Reset": "1591291038", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"5b8a20b94c28536e4d7b9af6bd1a2f0a\"", + "Last-Modified": "Tue, 02 Jun 2020 19:31:50 GMT", + "X-OAuth-Scopes": "admin:org, 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", + "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": "FAF6:C609:2660AA:2E8275:5ED91E93" + } + }, + "uuid": "ee07ede6-da15-4639-991a-5d47d2b1bb33", + "persistent": true, + "scenarioName": "scenario-1-orgs-hub4j-test-org-teams-dummy-team", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-1-orgs-hub4j-test-org-teams-dummy-team-2", + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-5.json new file mode 100644 index 0000000000..afaaf8332c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-5.json @@ -0,0 +1,49 @@ +{ + "id": "345d180e-4240-4ee1-98e5-efde0cfc2112", + "name": "orgs_hub4j-test-org_teams_dummy-team", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-5.json", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:24 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1591291038", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"5b8a20b94c28536e4d7b9af6bd1a2f0a\"", + "Last-Modified": "Tue, 02 Jun 2020 19:31:50 GMT", + "X-OAuth-Scopes": "admin:org, 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", + "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": "FAF6:C609:266222:2E8441:5ED91E94" + } + }, + "uuid": "345d180e-4240-4ee1-98e5-efde0cfc2112", + "persistent": true, + "scenarioName": "scenario-1-orgs-hub4j-test-org-teams-dummy-team", + "requiredScenarioState": "scenario-1-orgs-hub4j-test-org-teams-dummy-team-2", + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json new file mode 100644 index 0000000000..d3102b7f8b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json @@ -0,0 +1,54 @@ +{ + "id": "da16aef1-de97-46bd-84ee-af9ca1c8bfa7", + "name": "orgs_hub4j-test-org_teams_dummy-team_discussions", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Dummy\",\"body\":\"This is a dummy discussion\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team_discussions-3.json", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:23 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4985", + "X-RateLimit-Reset": "1591291038", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "\"c2e89c5a2d8854d38d7792b71564c2c1\"", + "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "write:discussion", + "Location": "https://api.github.com/organizations/7544739/team/3451996/discussions/8", + "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": "FAF6:C609:266105:2E82DB:5ED91E93" + } + }, + "uuid": "da16aef1-de97-46bd-84ee-af9ca1c8bfa7", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_8-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_8-4.json new file mode 100644 index 0000000000..4e65f8b7f0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_8-4.json @@ -0,0 +1,41 @@ +{ + "id": "097b4abb-4b15-4b1a-9867-ee6281df6499", + "name": "orgs_hub4j-test-org_teams_dummy-team_discussions_8", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions/8", + "method": "DELETE", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 204, + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:24 GMT", + "Server": "GitHub.com", + "Status": "204 No Content", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1591291038", + "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "write:discussion", + "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'", + "Vary": [ + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "X-GitHub-Request-Id": "FAF6:C609:2661A5:2E83A5:5ED91E93" + } + }, + "uuid": "097b4abb-4b15-4b1a-9867-ee6281df6499", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_8-6.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_8-6.json new file mode 100644 index 0000000000..ea2d07e9b9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_8-6.json @@ -0,0 +1,40 @@ +{ + "id": "309b6527-6214-4d16-9322-1f45917e1251", + "name": "orgs_hub4j-test-org_teams_dummy-team_discussions_8", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions/8", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 404, + "body": "{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/teams/discussions/#get-a-single-discussion\"}", + "headers": { + "Date": "Thu, 04 Jun 2020 16:17:24 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "404 Not Found", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4982", + "X-RateLimit-Reset": "1591291038", + "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "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'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "X-GitHub-Request-Id": "FAF6:C609:2662EB:2E852E:5ED91E94" + } + }, + "uuid": "309b6527-6214-4d16-9322-1f45917e1251", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file From e5ed52165ce543e3d6f8a6192653c06da1ecf192 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 4 Jun 2020 18:26:14 +0200 Subject: [PATCH 29/34] Fix: Add missing @param for the delete() method --- src/main/java/org/kohsuke/github/GHDiscussion.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHDiscussion.java b/src/main/java/org/kohsuke/github/GHDiscussion.java index 00ec27c2c3..0a333c5fa5 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussion.java +++ b/src/main/java/org/kohsuke/github/GHDiscussion.java @@ -114,6 +114,8 @@ private void edit(String key, Object value) throws IOException { /** * Delete the discussion * + * @param number + * the number * @throws IOException * the io exception */ From 086425d2da620be1410360fb1357fa9cdd4c6c30 Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Fri, 5 Jun 2020 15:48:29 -0700 Subject: [PATCH 30/34] Tweaks for batch update --- .../java/org/kohsuke/github/GHDiscussion.java | 173 ++++++++--- .../kohsuke/github/GHDiscussionBuilder.java | 111 +++----- src/main/java/org/kohsuke/github/GHTeam.java | 85 +++--- .../org/kohsuke/github/GHDiscussionTest.java | 116 ++++++-- ...ns_7544739_team_3451996_discussions-4.json | 38 +++ ...ns_7544739_team_3451996_discussions-5.json | 38 +++ ...ns_7544739_team_3451996_discussions-6.json | 38 +++ .../__files/orgs_hub4j-test-org-2.json} | 0 ...rgs_hub4j-test-org_teams_dummy-team-2.json | 43 --- ...gs_hub4j-test-org_teams_dummy-team-3.json} | 0 ...st-org_teams_dummy-team_discussions-1.json | 42 --- .../testCreatedDiscussion/__files/user-1.json | 46 +++ ...s_7544739_team_3451996_discussions-4.json} | 30 +- ...ns_7544739_team_3451996_discussions-5.json | 54 ++++ ...ns_7544739_team_3451996_discussions-6.json | 54 ++++ ...ns_7544739_team_3451996_discussions-7.json | 47 +++ .../mappings/orgs_hub4j-test-org-2.json} | 20 +- ...gs_hub4j-test-org_teams_dummy-team-3.json} | 20 +- ...st-org_teams_dummy-team_discussions-3.json | 47 --- .../mappings/user-1.json | 47 +++ ...ns_7544739_team_3451996_discussions-4.json | 38 +++ ...7544739_team_3451996_discussions_56-5.json | 38 +++ ...7544739_team_3451996_discussions_56-6.json | 38 +++ ...7544739_team_3451996_discussions_56-7.json | 38 +++ ...7544739_team_3451996_discussions_56-9.json | 38 +++ .../__files/orgs_hub4j-test-org-2.json} | 0 ...gs_hub4j-test-org_teams_dummy-team-3.json} | 0 ...gs_hub4j-test-org_teams_dummy-team-8.json} | 0 ...st-org_teams_dummy-team_discussions-3.json | 38 --- ...-org_teams_dummy-team_discussions_6-4.json | 38 --- ...-org_teams_dummy-team_discussions_6-5.json | 38 --- ...-org_teams_dummy-team_discussions_6-7.json | 38 --- .../__files/user-1.json | 46 +++ ...s_7544739_team_3451996_discussions-4.json} | 30 +- ...544739_team_3451996_discussions_56-5.json} | 28 +- ...544739_team_3451996_discussions_56-6.json} | 28 +- ...544739_team_3451996_discussions_56-7.json} | 28 +- ...7544739_team_3451996_discussions_56-9.json | 48 ++++ .../mappings/orgs_hub4j-test-org-2.json} | 20 +- ...gs_hub4j-test-org_teams_dummy-team-3.json} | 20 +- ...gs_hub4j-test-org_teams_dummy-team-8.json} | 20 +- .../mappings/user-1.json | 47 +++ ...ns_7544739_team_3451996_discussions-4.json | 38 +++ ...ns_7544739_team_3451996_discussions-5.json | 38 +++ ...ns_7544739_team_3451996_discussions-6.json | 38 +++ ...ns_7544739_team_3451996_discussions-7.json | 116 ++++++++ .../__files/orgs_hub4j-test-org-2.json} | 0 ...gs_hub4j-test-org_teams_dummy-team-3.json} | 0 ...st-org_teams_dummy-team_discussions-3.json | 38 --- .../__files/teams_3451996_discussions-5.json | 268 ------------------ .../testListDiscussion/__files/user-1.json | 46 +++ ...ns_7544739_team_3451996_discussions-4.json | 54 ++++ ...ns_7544739_team_3451996_discussions-5.json | 54 ++++ ...ns_7544739_team_3451996_discussions-6.json | 54 ++++ ...s_7544739_team_3451996_discussions-7.json} | 22 +- .../mappings/orgs_hub4j-test-org-2.json} | 20 +- ...rgs_hub4j-test-org_teams_dummy-team-2.json | 50 ---- ...gs_hub4j-test-org_teams_dummy-team-3.json} | 22 +- .../testListDiscussion/mappings/user-1.json | 47 +++ ...ns_7544739_team_3451996_discussions-4.json | 38 +++ .../__files/orgs_hub4j-test-org-2.json} | 10 +- ...gs_hub4j-test-org_teams_dummy-team-3.json} | 0 ...gs_hub4j-test-org_teams_dummy-team-6.json} | 0 ...st-org_teams_dummy-team_discussions-3.json | 38 --- .../__files/user-1.json | 46 +++ ...s_7544739_team_3451996_discussions-4.json} | 30 +- ...544739_team_3451996_discussions_60-5.json} | 20 +- ...544739_team_3451996_discussions_60-7.json} | 20 +- .../mappings/orgs_hub4j-test-org-2.json} | 22 +- ...gs_hub4j-test-org_teams_dummy-team-3.json} | 20 +- ...rgs_hub4j-test-org_teams_dummy-team-6.json | 16 +- .../mappings/user-1.json | 47 +++ 72 files changed, 1827 insertions(+), 1091 deletions(-) create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/organizations_7544739_team_3451996_discussions-4.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/organizations_7544739_team_3451996_discussions-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/organizations_7544739_team_3451996_discussions-6.json rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testGetAndEditDiscussion/__files/orgs_hub4j-test-org-1.json => testCreatedDiscussion/__files/orgs_hub4j-test-org-2.json} (100%) delete mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json => testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-3.json} (100%) delete mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/user-1.json rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json => testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json} (57%) create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-6.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-7.json rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testToDeleteDiscussion/mappings/orgs_hub4j-test-org-1.json => testCreatedDiscussion/mappings/orgs_hub4j-test-org-2.json} (68%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/{orgs_hub4j-test-org_teams_dummy-team-2.json => orgs_hub4j-test-org_teams_dummy-team-3.json} (68%) delete mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/user-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions-4.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_56-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_56-6.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_56-7.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_56-9.json rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testListDiscussion/__files/orgs_hub4j-test-org-1.json => testGetAndEditDiscussion/__files/orgs_hub4j-test-org-2.json} (100%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/{orgs_hub4j-test-org_teams_dummy-team-6.json => orgs_hub4j-test-org_teams_dummy-team-3.json} (100%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json => testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-8.json} (100%) delete mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json delete mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json delete mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json delete mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/user-1.json rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/{orgs_hub4j-test-org_teams_dummy-team_discussions-3.json => organizations_7544739_team_3451996_discussions-4.json} (57%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testListDiscussion/mappings/teams_3451996_discussions-5.json => testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_56-5.json} (54%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/{orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json => organizations_7544739_team_3451996_discussions_56-6.json} (56%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/{orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json => organizations_7544739_team_3451996_discussions_56-7.json} (56%) create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_56-9.json rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testListDiscussion/mappings/orgs_hub4j-test-org-1.json => testGetAndEditDiscussion/mappings/orgs_hub4j-test-org-2.json} (68%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json => testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json} (71%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-4.json => testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-8.json} (70%) create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/user-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/organizations_7544739_team_3451996_discussions-4.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/organizations_7544739_team_3451996_discussions-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/organizations_7544739_team_3451996_discussions-6.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/organizations_7544739_team_3451996_discussions-7.json rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testToDeleteDiscussion/__files/orgs_hub4j-test-org-1.json => testListDiscussion/__files/orgs_hub4j-test-org-2.json} (100%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/{orgs_hub4j-test-org_teams_dummy-team-4.json => orgs_hub4j-test-org_teams_dummy-team-3.json} (100%) delete mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json delete mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/teams_3451996_discussions-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/user-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-6.json rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json => testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-7.json} (61%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testGetAndEditDiscussion/mappings/orgs_hub4j-test-org-1.json => testListDiscussion/mappings/orgs_hub4j-test-org-2.json} (68%) delete mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-5.json => testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json} (64%) create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/user-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/organizations_7544739_team_3451996_discussions-4.json rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testCreatedDiscussion/__files/orgs_hub4j-test-org-1.json => testToDeleteDiscussion/__files/orgs_hub4j-test-org-2.json} (77%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/{orgs_hub4j-test-org_teams_dummy-team-2.json => orgs_hub4j-test-org_teams_dummy-team-3.json} (100%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/{orgs_hub4j-test-org_teams_dummy-team-5.json => orgs_hub4j-test-org_teams_dummy-team-6.json} (100%) delete mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/user-1.json rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/{orgs_hub4j-test-org_teams_dummy-team_discussions-3.json => organizations_7544739_team_3451996_discussions-4.json} (57%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/{orgs_hub4j-test-org_teams_dummy-team_discussions_8-4.json => organizations_7544739_team_3451996_discussions_60-5.json} (60%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/{orgs_hub4j-test-org_teams_dummy-team_discussions_8-6.json => organizations_7544739_team_3451996_discussions_60-7.json} (63%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json => testToDeleteDiscussion/mappings/orgs_hub4j-test-org-2.json} (64%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json => testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json} (71%) rename src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/{testGetAndEditDiscussion => testToDeleteDiscussion}/mappings/orgs_hub4j-test-org_teams_dummy-team-6.json (74%) create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/user-1.json diff --git a/src/main/java/org/kohsuke/github/GHDiscussion.java b/src/main/java/org/kohsuke/github/GHDiscussion.java index 0a333c5fa5..084bafd245 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussion.java +++ b/src/main/java/org/kohsuke/github/GHDiscussion.java @@ -1,9 +1,13 @@ package org.kohsuke.github; import com.fasterxml.jackson.annotation.JacksonInject; +import com.fasterxml.jackson.annotation.JsonProperty; import java.io.IOException; import java.net.URL; +import java.util.Objects; + +import javax.annotation.Nonnull; /** * A discussion in GitHub Team. @@ -15,29 +19,31 @@ public class GHDiscussion extends GHObject { @JacksonInject private GitHub root; - private GHOrganization organization; private GHTeam team; - private String number, body, title, htmlUrl; + private long number; + private String body, title, htmlUrl; + + @JsonProperty(value = "private") + private boolean isPrivate; @Override public URL getHtmlUrl() throws IOException { return GitHubClient.parseURL(htmlUrl); } - public GHDiscussion wrapUp(GHTeam team) throws IOException { - this.organization = team.getOrganization(); + GHDiscussion wrapUp(GHTeam team) { this.team = team; return this; } - public GHDiscussion wrapUp(GitHub root) { - this.root = root; - return this; - } - - public GHDiscussion wrapUp(GHOrganization owner) { - this.organization = owner; - return this; + /** + * Get the team to which this discussion belongs. + * + * @return the team for this discussion + */ + @Nonnull + public GHTeam getTeam() { + return team; } /** @@ -63,68 +69,141 @@ public String getBody() { * * @return the number */ - public String getNumber() { + public long getNumber() { return number; } /** - * Sets body. + * Whether the discussion is private to the team. * - * @param body - * the body - * @throws IOException - * the io exception + * @return {@code true} if discussion is private. */ - public void setBody(String body) throws IOException { - edit("body", body); + public boolean isPrivate() { + return isPrivate; } /** - * Sets title. + * Begins the creation of a new instance. + * + * Consumer must call {@link GHDiscussion.Creator#done()} to commit changes. * - * @param title - * the title + * @param team + * the team in which the discussion will be created. + * @return a {@link GHLabel.Creator} * @throws IOException * the io exception */ - public void setTitle(String title) throws IOException { - edit("title", title); + static GHDiscussion.Creator create(GHTeam team) throws IOException { + return new GHDiscussion.Creator(team); + } + + static GHDiscussion read(GHTeam team, long discussionNumber) throws IOException { + return team.root.createRequest() + .setRawUrlPath(team.getUrl().toString() + "/discussions/" + discussionNumber) + .fetch(GHDiscussion.class) + .wrapUp(team); + } + + static PagedIterable readAll(GHTeam team) throws IOException { + return team.root.createRequest() + .setRawUrlPath(team.getUrl().toString() + "/discussions") + .toIterable(GHDiscussion[].class, item -> item.wrapUp(team)); } /** - * Edit the discussion + * Begins a batch update * - * @param key - * the key - * @param value - * the value - * @throws IOException - * the io exception + * Consumer must call {@link GHDiscussion.Updater#done()} to commit changes. + * + * @return a {@link GHDiscussion.Updater} */ - private void edit(String key, Object value) throws IOException { - root.createRequest() - .method("PATCH") - // .withPreview(INERTIA) - .with(key, value) - .withUrlPath("/orgs/" + team.getOrganization().getLogin() + "/teams/" + team.getSlug() + "/discussions/" - + number) - .send(); + @Preview + @Deprecated + public GHDiscussion.Updater update() { + return new GHDiscussion.Updater(this); + } + + /** + * Begins a single property update. + * + * @return a {@link GHDiscussion.Setter} + */ + @Preview + @Deprecated + public GHDiscussion.Setter set() { + return new GHDiscussion.Setter(this); } /** * Delete the discussion * - * @param number - * the number * @throws IOException * the io exception */ - public void delete(String number) throws IOException { - root.createRequest() - // .withPreview(INERTIA) + public void delete() throws IOException { + team.root.createRequest() .method("DELETE") - .withUrlPath("/orgs/" + team.getOrganization().getLogin() + "/teams/" + team.getSlug() + "/discussions/" - + number) + .setRawUrlPath(team.getUrl().toString() + "/discussions/" + number) .send(); } + + /** + * A {@link GHLabelBuilder} that updates a single property per request + * + * {@link #done()} is called automatically after the property is set. + */ + public static class Setter extends GHDiscussionBuilder { + private Setter(@Nonnull GHDiscussion base) { + super(GHDiscussion.class, base.team, base); + requester.method("PATCH").setRawUrlPath(base.getUrl().toString()); + } + } + + /** + * A {@link GHLabelBuilder} that allows multiple properties to be updated per request. + * + * Consumer must call {@link #done()} to commit changes. + */ + public static class Updater extends GHDiscussionBuilder { + private Updater(@Nonnull GHDiscussion base) { + super(GHDiscussion.Updater.class, base.team, base); + requester.method("PATCH").setRawUrlPath(base.getUrl().toString()); + } + } + + /** + * A {@link GHLabelBuilder} that creates a new {@link GHLabel} + * + * Consumer must call {@link #done()} to create the new instance. + */ + public static class Creator extends GHDiscussionBuilder { + + private Creator(@Nonnull GHTeam team) { + super(GHDiscussion.Creator.class, team, null); + requester.method("POST").withUrlPath(team.getUrl().toString() + "/discussions"); + } + + @Nonnull + public Creator private_(boolean value) throws IOException { + return with("private", value); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GHDiscussion that = (GHDiscussion) o; + return number == that.number && Objects.equals(getUrl(), that.getUrl()) && Objects.equals(team, that.team) + && Objects.equals(body, that.body) && Objects.equals(title, that.title); + } + + @Override + public int hashCode() { + return Objects.hash(team, number, body, title); + } } diff --git a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java index b2bda60650..0a7686c4c0 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java +++ b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java @@ -2,96 +2,73 @@ import java.io.IOException; +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; + /** - * Creates a Discussion. + * Base class for creating or updating a discussion. * - * https://developer.github.com/v3/teams/discussions/#create-a-discussion + * @param + * Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If {@link S} + * the same as {@link GHLabel}, this builder will commit changes after each call to + * {@link #with(String, Object)}. */ -public class GHDiscussionBuilder { +class GHDiscussionBuilder extends AbstractBuilder { - protected final Requester builder; private final GHTeam team; - public GHDiscussionBuilder(GHTeam team, String title) { - this.team = team; - this.builder = team.root.createRequest(); - builder.with("title", title); - } + /** + * + * @param intermediateReturnType + * Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If + * {@link S} the same as {@link GHDiscussion}, this builder will commit changes after each call to + * {@link #with(String, Object)}. + * @param team + * the GitHub team. Updates will be sent to the root of this team. + * @param baseInstance + * instance on which to base this builder. If {@code null} a new instance will be created. + */ + protected GHDiscussionBuilder(@Nonnull Class intermediateReturnType, + @Nonnull GHTeam team, + @CheckForNull GHDiscussion baseInstance) { + super(GHDiscussion.class, intermediateReturnType, team.root, baseInstance); - public GHDiscussionBuilder(GHTeam team) { this.team = team; - this.builder = team.root.createRequest(); + + if (baseInstance != null) { + requester.with("title", baseInstance.getTitle()); + requester.with("body", baseInstance.getBody()); + } } /** * Title for this discussion. * - * @param title + * @param value * title of discussion - * @return a builder to continue with building + * @return either a continuing builder or an updated {@link GHDiscussion} */ - public GHDiscussionBuilder title(String title) { - this.builder.with("title", title); - return this; + @Nonnull + public S title(String value) throws IOException { + return with("title", value); } /** * Body content for this discussion. * - * @param body - * title of discussion - * @return a builder to continue with building - */ - public GHDiscussionBuilder body(String body) { - this.builder.with("body", body); - return this; - } - - /** - * Creates a discussion with all the parameters. - * - * @return the gh discussion - * @throws IOException - * if discussion cannot be created - */ - public GHDiscussion create() throws IOException { - return builder.method("POST") - .withUrlPath("/orgs/" + team.getOrganization().getLogin() + "/teams/" + team.getSlug() + "/discussions") - .fetch(GHDiscussion.class) - .wrapUp(team); - } - - /** - * Update a discussion with all the parameters. + * @param value + * body of discussion * - * @param number - * number of the discussion to be updated - * @return the gh discussion + * @return either a continuing builder or an updated {@link GHDiscussion} */ - public GHDiscussion update(String number) { - try { - return builder.method("PATCH") - .withUrlPath("/orgs/" + team.getOrganization().getLogin() + "/teams/" + team.getSlug() - + "/discussions/" + number) - .fetch(GHDiscussion.class) - .wrapUp(team); - } catch (IOException e) { - throw new GHException("Discussion to be updated not found", e); - } + @Nonnull + public S body(String value) throws IOException { + return with("body", value); } - /** - * Delete this discussion from the team. - * - * @param number - * number of the discussion - * @throws IOException - * the io exception - */ - public void delete(String number) throws IOException { - builder.method("DELETE") - .withUrlPath("/orgs/" + team.getOrganization().getLogin() + "/teams/" + team.getSlug() + "/discussions/" - + number) - .send(); + @Nonnull + @Override + public GHDiscussion done() throws IOException { + return super.done().wrapUp(team); } } diff --git a/src/main/java/org/kohsuke/github/GHTeam.java b/src/main/java/org/kohsuke/github/GHTeam.java index 0e7a67be4a..60c1be347b 100644 --- a/src/main/java/org/kohsuke/github/GHTeam.java +++ b/src/main/java/org/kohsuke/github/GHTeam.java @@ -3,9 +3,12 @@ import java.io.IOException; import java.net.URL; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.TreeMap; +import javax.annotation.Nonnull; + /** * A team in GitHub organization. * @@ -137,33 +140,27 @@ public void setPrivacy(Privacy privacy) throws IOException { * @throws IOException * the io exception */ + @Nonnull public PagedIterable listDiscussions() throws IOException { - return root.createRequest().withUrlPath(api("/discussions")).toIterable(GHDiscussion[].class, item -> { - try { - item.wrapUp(this); - } catch (IOException e) { - throw new GHException("Failed to retrieve discussions", e); - } - }); + return GHDiscussion.readAll(this); } /** * Gets a single discussion by ID. * - * @param discussionId + * @param discussionNumber * id of the discussion that we want to query for * @return the discussion + * @throws java.io.FileNotFoundException + * if the discussion does not exist * @throws IOException * the io exception * * @see documentation */ - public GHDiscussion getDiscussion(String discussionId) throws IOException { - return root.createRequest() - .withUrlPath("/orgs/" + this.getOrganization().getLogin() + "/teams/" + this.getSlug() + "/discussions/" - + discussionId) - .fetch(GHDiscussion.class) - .wrapUp(this); + @Nonnull + public GHDiscussion getDiscussion(long discussionNumber) throws IOException { + return GHDiscussion.read(this, discussionNumber); } /** @@ -334,45 +331,18 @@ private String api(String tail) { } /** - * Starts a builder that creates a new discussion. + * Begins the creation of a new instance. * - *

- * You use the returned builder to set various properties, then call {@link GHDiscussionBuilder#create()} to finally - * create a discussion. + * Consumer must call {@link GHDiscussion.Creator#done()} to commit changes. * - * @param name - * the name - * @return the gh create discussion builder + * @param title + * title of the discussion to be created + * @return a {@link GHDiscussion.Creator} * @throws IOException * the io exception */ - public GHDiscussionBuilder createDiscussion(String name) throws IOException { - return new GHDiscussionBuilder(this, name); - } - - /** - * Creates a builder that delete the discussion - * - * @param number - * the number - */ - public void deleteDiscussion(String number) { - try { - new GHDiscussionBuilder(this, name).delete(number); - } catch (IOException e) { - throw new GHException("Failed to delete the discussion : " + number, e); - } - } - - /** - * Starts a builder that update a new discussion. - * - * @throws IOException - * the io exception - * @return the GHDiscussionBuilder - */ - public GHDiscussionBuilder updateDiscussion() throws IOException { - return new GHDiscussionBuilder(this); + public GHDiscussion.Creator createDiscussion(String title) throws IOException { + return GHDiscussion.create(this).title(title); } /** @@ -396,4 +366,23 @@ public void refresh() throws IOException { public URL getHtmlUrl() { return GitHubClient.parseURL(html_url); } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GHTeam ghTeam = (GHTeam) o; + return Objects.equals(name, ghTeam.name) && Objects.equals(getUrl(), ghTeam.getUrl()) + && Objects.equals(permission, ghTeam.permission) && Objects.equals(slug, ghTeam.slug) + && Objects.equals(description, ghTeam.description) && privacy == ghTeam.privacy; + } + + @Override + public int hashCode() { + return Objects.hash(name, getUrl(), permission, slug, description, privacy); + } } diff --git a/src/test/java/org/kohsuke/github/GHDiscussionTest.java b/src/test/java/org/kohsuke/github/GHDiscussionTest.java index af6e9a1114..de1d4b4a6f 100644 --- a/src/test/java/org/kohsuke/github/GHDiscussionTest.java +++ b/src/test/java/org/kohsuke/github/GHDiscussionTest.java @@ -1,70 +1,126 @@ package org.kohsuke.github; -import org.junit.Assert; +import org.junit.After; import org.junit.Before; -import org.junit.FixMethodOrder; import org.junit.Test; -import org.junit.runners.MethodSorters; import java.io.FileNotFoundException; import java.io.IOException; -import java.util.HashSet; import java.util.Set; +import static org.hamcrest.Matchers.*; + /** * @author Charles Moulliard */ -@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class GHDiscussionTest extends AbstractGitHubWireMockTest { private final String TEAM_SLUG = "dummy-team"; - private GHDiscussion discussion; + private GHTeam team; @Before public void setUp() throws Exception { - discussion = gitHub.getOrganization(GITHUB_API_TEST_ORG) - .getTeamBySlug(TEAM_SLUG) - .createDiscussion("Dummy") - .body("This is a dummy discussion") - .create(); + team = gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamBySlug(TEAM_SLUG); + } + + @After + public void cleanupDiscussions() throws Exception { + // only need to clean up if we're pointing to the live site + if (mockGitHub.isUseProxy()) { + for (GHDiscussion discussion : getGitHubBeforeAfter().getOrganization(GITHUB_API_TEST_ORG) + .getTeamBySlug(TEAM_SLUG) + .listDiscussions()) { + discussion.delete(); + } + } } @Test public void testCreatedDiscussion() throws IOException { - Assert.assertNotNull(discussion); - Assert.assertEquals("Dummy", discussion.getTitle()); - Assert.assertEquals("This is a dummy discussion", discussion.getBody()); + GHDiscussion discussion = team.createDiscussion("Some Discussion").body("This is a public discussion").done(); + assertThat(discussion, notNullValue()); + assertThat(discussion.getTeam(), notNullValue()); + assertThat(discussion.getTitle(), equalTo("Some Discussion")); + assertThat(discussion.getBody(), equalTo("This is a public discussion")); + assertThat(discussion.isPrivate(), is(false)); + + discussion = team.createDiscussion("Some Discussion") + .body("This is another public discussion") + .private_(false) + .done(); + assertThat(discussion, notNullValue()); + assertThat(discussion.getTitle(), equalTo("Some Discussion")); + assertThat(discussion.getBody(), equalTo("This is another public discussion")); + assertThat(discussion.isPrivate(), is(false)); + + discussion = team.createDiscussion("Some Discussion") + .body("This is a private (secret) discussion") + .private_(true) + .done(); + assertThat(discussion, notNullValue()); + assertThat(discussion.getTitle(), equalTo("Some Discussion")); + assertThat(discussion.getBody(), equalTo("This is a private (secret) discussion")); + assertThat(discussion.isPrivate(), is(true)); + + try { + team.createDiscussion("Some Discussion").done(); + fail("Body is required."); + } catch (HttpException e) { + assertThat(e, instanceOf(HttpException.class)); + assertThat(e.getMessage(), + containsString("https://developer.github.com/v3/teams/discussions/#create-a-discussion")); + } } @Test public void testGetAndEditDiscussion() throws IOException { - discussion.setBody("This is a dummy discussion changed"); - discussion.setTitle("Dummy title changed"); - discussion = gitHub.getOrganization(GITHUB_API_TEST_ORG) + GHDiscussion created = team.createDiscussion("Some Discussion").body("This is a test discussion").done(); + + GHDiscussion discussion = team.getDiscussion(created.getNumber()); + assertThat(discussion.getTeam(), notNullValue()); + + discussion = discussion.set().body("This is a test discussion changed"); + assertThat(discussion.getTeam(), notNullValue()); + + assertThat(discussion.getTitle(), equalTo("Some Discussion")); + assertThat(discussion.getBody(), equalTo("This is a test discussion changed")); + + discussion = discussion.set().title("Title changed"); + + assertThat(discussion.getTitle(), equalTo("Title changed")); + assertThat(discussion.getBody(), equalTo("This is a test discussion changed")); + + GHDiscussion discussion2 = gitHub.getOrganization(GITHUB_API_TEST_ORG) .getTeamBySlug(TEAM_SLUG) .getDiscussion(discussion.getNumber()); - Assert.assertEquals("Dummy title changed", discussion.getTitle()); - Assert.assertEquals("This is a dummy discussion changed", discussion.getBody()); + + assertThat(discussion2, equalTo(discussion)); + assertThat(discussion2.getTitle(), equalTo("Title changed")); + assertThat(discussion2.getBody(), equalTo("This is a test discussion changed")); } @Test public void testListDiscussion() throws IOException { - Set all = new HashSet(); - for (GHDiscussion d : gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamBySlug(TEAM_SLUG).listDiscussions()) { - all.add(d); - } ; - assertFalse(all.isEmpty()); + team.createDiscussion("Some Discussion A").body("This is a test discussion").done(); + team.createDiscussion("Some Discussion B").body("This is a test discussion").done(); + team.createDiscussion("Some Discussion C").body("This is a test discussion").done(); + + Set all = team.listDiscussions().toSet(); + assertThat(all.size(), equalTo(3)); } @Test public void testToDeleteDiscussion() throws IOException { - discussion.delete(discussion.getNumber()); + GHDiscussion discussion = team.createDiscussion("Some Discussion").body("This is a test discussion").done(); + + assertThat(discussion.getTitle(), equalTo("Some Discussion")); + + discussion.delete(); try { - discussion = gitHub.getOrganization(GITHUB_API_TEST_ORG) - .getTeamBySlug(TEAM_SLUG) - .getDiscussion(discussion.getNumber()); - Assert.assertNull(discussion); + gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamBySlug(TEAM_SLUG).getDiscussion(discussion.getNumber()); + fail(); } catch (FileNotFoundException e) { - discussion = null; + assertThat(e.getMessage(), + containsString("https://developer.github.com/v3/teams/discussions/#get-a-single-discussion")); } } diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/organizations_7544739_team_3451996_discussions-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/organizations_7544739_team_3451996_discussions-4.json new file mode 100644 index 0000000000..cff91492d2 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/organizations_7544739_team_3451996_discussions-4.json @@ -0,0 +1,38 @@ +{ + "author": { + "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 + }, + "body": "This is a public discussion", + "body_html": "

This is a public discussion

", + "body_version": "d1ab9311f2fe800dcd6f9499163d5369", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/57/comments", + "created_at": "2020-06-05T23:08:28Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/57", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3ODQ4", + "number": 57, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion", + "updated_at": "2020-06-05T23:08:28Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/57" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/organizations_7544739_team_3451996_discussions-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/organizations_7544739_team_3451996_discussions-5.json new file mode 100644 index 0000000000..548ee572cc --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/organizations_7544739_team_3451996_discussions-5.json @@ -0,0 +1,38 @@ +{ + "author": { + "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 + }, + "body": "This is another public discussion", + "body_html": "

This is another public discussion

", + "body_version": "611e0dcc600e9915b7d96e4bec2b7b35", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/58/comments", + "created_at": "2020-06-05T23:08:29Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/58", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3ODQ5", + "number": 58, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion", + "updated_at": "2020-06-05T23:08:29Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/58" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/organizations_7544739_team_3451996_discussions-6.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/organizations_7544739_team_3451996_discussions-6.json new file mode 100644 index 0000000000..c7575c83f3 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/organizations_7544739_team_3451996_discussions-6.json @@ -0,0 +1,38 @@ +{ + "author": { + "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 + }, + "body": "This is a private (secret) discussion", + "body_html": "

This is a private (secret) discussion

", + "body_version": "32e9a84be65b3a703f5db5b8635388eb", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/59/comments", + "created_at": "2020-06-05T23:08:29Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/59", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3ODUw", + "number": 59, + "pinned": false, + "private": true, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion", + "updated_at": "2020-06-05T23:08:29Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/59" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-2.json similarity index 100% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org-1.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-2.json diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json deleted file mode 100644 index 935d098d3a..0000000000 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "dummy-team", - "id": 3451996, - "node_id": "MDQ6VGVhbTM0NTE5OTY=", - "slug": "dummy-team", - "description": "Updated by API TestModified", - "privacy": "closed", - "url": "https://api.github.com/organizations/7544739/team/3451996", - "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team", - "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", - "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", - "permission": "pull", - "created_at": "2019-10-03T21:46:12Z", - "updated_at": "2020-06-02T19:31:50Z", - "members_count": 1, - "repos_count": 1, - "organization": { - "login": "hub4j-test-org", - "id": 7544739, - "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", - "url": "https://api.github.com/orgs/hub4j-test-org", - "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", - "events_url": "https://api.github.com/orgs/hub4j-test-org/events", - "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", - "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", - "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", - "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", - "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", - "description": null, - "is_verified": false, - "has_organization_projects": true, - "has_repository_projects": true, - "public_repos": 15, - "public_gists": 0, - "followers": 0, - "following": 0, - "html_url": "https://github.com/hub4j-test-org", - "created_at": "2014-05-10T19:39:11Z", - "updated_at": "2020-05-15T15:14:14Z", - "type": "Organization" - }, - "parent": null -} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-3.json similarity index 100% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-3.json diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-1.json deleted file mode 100644 index 83b4c951dd..0000000000 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-1.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "body": "This is a dummy discussion", - "body_html": "Dummy", - "body_version": "ed736e2c6a052645201cf73d1488260c", - "created_at": "2020-05-28T09:50:20Z", - "last_edited_at": null, - "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/2", - "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE1NzEz", - "number": 2, - "pinned": false, - "private": false, - "team_url": "https://api.github.com/organizations/7544739/team/3451996", - "title": "Dummy", - "updated_at": "2020-05-28T09:50:20Z", - "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/2", - "organization": { - "login": "hub4j-test-org", - "id": 7544739, - "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", - "url": "https://api.github.com/orgs/hub4j-test-org", - "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", - "events_url": "https://api.github.com/orgs/hub4j-test-org/events", - "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", - "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", - "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", - "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", - "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", - "description": null, - "is_verified": false, - "has_organization_projects": true, - "has_repository_projects": true, - "public_repos": 15, - "public_gists": 0, - "followers": 0, - "following": 0, - "html_url": "https://github.com/hub4j-test-org", - "created_at": "2014-05-10T19:39:11Z", - "updated_at": "2020-05-15T15:14:14Z", - "type": "Organization" - }, - "parent": null -} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/user-1.json new file mode 100644 index 0000000000..c0e6797da6 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/user-1.json @@ -0,0 +1,46 @@ +{ + "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", + "twitter_username": null, + "public_repos": 187, + "public_gists": 7, + "followers": 161, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2020-05-29T18:24:44Z", + "private_gists": 19, + "total_private_repos": 12, + "owned_private_repos": 0, + "disk_usage": 33700, + "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/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json similarity index 57% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json index 1aecd9f36e..6439dcfdc1 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json @@ -1,8 +1,8 @@ { - "id": "da11720f-169a-4998-9136-030e0cfa65a9", - "name": "orgs_hub4j-test-org_teams_dummy-team_discussions", + "id": "e99eb2d0-5c5d-42f7-a883-546db75493e4", + "name": "organizations_7544739_team_3451996_discussions", "request": { - "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions", + "url": "/organizations/7544739/team/3451996/discussions", "method": "POST", "headers": { "Accept": { @@ -11,33 +11,33 @@ }, "bodyPatterns": [ { - "equalToJson": "{\"title\":\"Dummy\",\"body\":\"This is a dummy discussion\"}", + "equalToJson": "{\"title\":\"Some Discussion\",\"body\":\"This is a public discussion\"}", "ignoreArrayOrder": true, - "ignoreExtraElements": true + "ignoreExtraElements": false } ] }, "response": { "status": 201, - "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team_discussions-3.json", + "bodyFileName": "organizations_7544739_team_3451996_discussions-4.json", "headers": { - "Date": "Thu, 04 Jun 2020 16:17:21 GMT", + "Date": "Fri, 05 Jun 2020 23:08:28 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "201 Created", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4990", - "X-RateLimit-Reset": "1591291038", + "X-RateLimit-Remaining": "4751", + "X-RateLimit-Reset": "1591398936", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "\"5516ba109ab62bbb8765be2478b4c049\"", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "ETag": "\"e54b9b7ddc5c67ae5103fadab8080b1e\"", + "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": "write:discussion", - "Location": "https://api.github.com/organizations/7544739/team/3451996/discussions/7", + "Location": "https://api.github.com/organizations/7544739/team/3451996/discussions/57", "X-GitHub-Media-Type": "unknown, github.v3", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Frame-Options": "deny", @@ -45,10 +45,10 @@ "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": "FAF1:20614:1CB137:22B3F8:5ED91E91" + "X-GitHub-Request-Id": "CFF1:24BF:5492EF:64DB5E:5EDAD06C" } }, - "uuid": "da11720f-169a-4998-9136-030e0cfa65a9", + "uuid": "e99eb2d0-5c5d-42f7-a883-546db75493e4", "persistent": true, - "insertionIndex": 3 + "insertionIndex": 4 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-5.json new file mode 100644 index 0000000000..d08146d514 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-5.json @@ -0,0 +1,54 @@ +{ + "id": "838ad222-65d5-47c7-bb86-cd47ba2de6f2", + "name": "organizations_7544739_team_3451996_discussions", + "request": { + "url": "/organizations/7544739/team/3451996/discussions", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"private\":false,\"title\":\"Some Discussion\",\"body\":\"This is another public discussion\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "organizations_7544739_team_3451996_discussions-5.json", + "headers": { + "Date": "Fri, 05 Jun 2020 23:08:29 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4750", + "X-RateLimit-Reset": "1591398936", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "\"bc86e15d1de977f57689648ef418547a\"", + "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": "write:discussion", + "Location": "https://api.github.com/organizations/7544739/team/3451996/discussions/58", + "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": "CFF1:24BF:549306:64DB6F:5EDAD06C" + } + }, + "uuid": "838ad222-65d5-47c7-bb86-cd47ba2de6f2", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-6.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-6.json new file mode 100644 index 0000000000..8361e78b06 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-6.json @@ -0,0 +1,54 @@ +{ + "id": "d6c070f6-fd08-4b88-a254-d6d35986cb74", + "name": "organizations_7544739_team_3451996_discussions", + "request": { + "url": "/organizations/7544739/team/3451996/discussions", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"private\":true,\"title\":\"Some Discussion\",\"body\":\"This is a private (secret) discussion\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "organizations_7544739_team_3451996_discussions-6.json", + "headers": { + "Date": "Fri, 05 Jun 2020 23:08:29 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4749", + "X-RateLimit-Reset": "1591398936", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "\"c4ca8b7d421176c6e80f3c6d00ab6f0b\"", + "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": "write:discussion", + "Location": "https://api.github.com/organizations/7544739/team/3451996/discussions/59", + "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": "CFF1:24BF:54931E:64DB8A:5EDAD06D" + } + }, + "uuid": "d6c070f6-fd08-4b88-a254-d6d35986cb74", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-7.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-7.json new file mode 100644 index 0000000000..b725efbe4b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-7.json @@ -0,0 +1,47 @@ +{ + "id": "5f6075fe-cdc4-4fb6-a2cb-ee22cb4e85b8", + "name": "organizations_7544739_team_3451996_discussions", + "request": { + "url": "/organizations/7544739/team/3451996/discussions", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Some Discussion\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 422, + "body": "{\"message\":\"Invalid request.\\n\\n\\\"body\\\" wasn't supplied.\",\"documentation_url\":\"https://developer.github.com/v3/teams/discussions/#create-a-discussion\"}", + "headers": { + "Date": "Fri, 05 Jun 2020 23:08:29 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "422 Unprocessable Entity", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4748", + "X-RateLimit-Reset": "1591398936", + "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": "write:discussion", + "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'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "X-GitHub-Request-Id": "CFF1:24BF:54932E:64DB9C:5EDAD06D" + } + }, + "uuid": "5f6075fe-cdc4-4fb6-a2cb-ee22cb4e85b8", + "persistent": true, + "insertionIndex": 7 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-2.json similarity index 68% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org-1.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-2.json index a72d6d5031..1df153dd3f 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org-1.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-2.json @@ -1,5 +1,5 @@ { - "id": "8528123a-2f6a-43f9-9c90-9b2b40ce5300", + "id": "98208c3a-6b4c-4b98-adb1-b063f7b2c7bf", "name": "orgs_hub4j-test-org", "request": { "url": "/orgs/hub4j-test-org", @@ -12,24 +12,24 @@ }, "response": { "status": 200, - "bodyFileName": "orgs_hub4j-test-org-1.json", + "bodyFileName": "orgs_hub4j-test-org-2.json", "headers": { - "Date": "Thu, 04 Jun 2020 16:17:23 GMT", + "Date": "Fri, 05 Jun 2020 23:08:28 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4987", - "X-RateLimit-Reset": "1591291039", + "X-RateLimit-Remaining": "4753", + "X-RateLimit-Reset": "1591398936", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "W/\"1a6a487ed52f9d847d59925e769484a5\"", + "ETag": "W/\"0557d9126fa25140eab7bdf16c451149\"", "Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "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", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", @@ -38,10 +38,10 @@ "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": "FAF6:C609:26603A:2E8204:5ED91E92" + "X-GitHub-Request-Id": "CFF1:24BF:5492E0:64DB3F:5EDAD06B" } }, - "uuid": "8528123a-2f6a-43f9-9c90-9b2b40ce5300", + "uuid": "98208c3a-6b4c-4b98-adb1-b063f7b2c7bf", "persistent": true, - "insertionIndex": 1 + "insertionIndex": 2 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json similarity index 68% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json index 2d9d75a7df..5877f4b020 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json @@ -1,5 +1,5 @@ { - "id": "0e1a2398-b107-43a3-b289-145d9a383da9", + "id": "ab3d6c7f-c986-4aa1-abf6-14e27bd88ea5", "name": "orgs_hub4j-test-org_teams_dummy-team", "request": { "url": "/orgs/hub4j-test-org/teams/dummy-team", @@ -12,24 +12,24 @@ }, "response": { "status": 200, - "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-2.json", + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-3.json", "headers": { - "Date": "Thu, 04 Jun 2020 05:21:53 GMT", + "Date": "Fri, 05 Jun 2020 23:08:28 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4968", - "X-RateLimit-Reset": "1591249749", + "X-RateLimit-Remaining": "4752", + "X-RateLimit-Reset": "1591398936", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "W/\"eaf40cdc7114f49ddddf745b65131b00\"", + "ETag": "W/\"adf552e4a615c271e66b7d2bb00e61c4\"", "Last-Modified": "Tue, 02 Jun 2020 19:31:50 GMT", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "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", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", @@ -38,10 +38,10 @@ "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": "D969:2285A:ADDDC7:CE8740:5ED884F1" + "X-GitHub-Request-Id": "CFF1:24BF:5492E7:64DB52:5EDAD06C" } }, - "uuid": "0e1a2398-b107-43a3-b289-145d9a383da9", + "uuid": "ab3d6c7f-c986-4aa1-abf6-14e27bd88ea5", "persistent": true, - "insertionIndex": 2 + "insertionIndex": 3 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json deleted file mode 100644 index 8ecdcd173d..0000000000 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "id": "00d7317e-48cb-4f70-9efb-148d34750fdb", - "name": "orgs_hub4j-test-org_teams_dummy-team_discussions", - "request": { - "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions", - "method": "POST", - "headers": { - "Accept": { - "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" - } - }, - "bodyPatterns": [ - { - "equalToJson": "{\"title\":\"Dummy\",\"body\":\"This is a dummy discussion\"}", - "ignoreArrayOrder": true, - "ignoreExtraElements": true - } - ] - }, - "response": { - "status": 200, - "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team_discussions-1.json", - "headers": { - "Date": "Thu, 04 Jun 2020 05:21:54 GMT", - "Content-Type": "application/json; charset=utf-8", - "Server": "GitHub.com", - "Status": "200 OK", - "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4967", - "X-RateLimit-Reset": "1591249749", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", - "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'", - "Vary": "Accept-Encoding, Accept, X-Requested-With", - "X-GitHub-Request-Id": "D969:2285A:ADDDF8:CE87CD:5ED884F1" - } - }, - "uuid": "00d7317e-48cb-4f70-9efb-148d34750fdb", - "persistent": true, - "insertionIndex": 3 -} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/user-1.json new file mode 100644 index 0000000000..d60cfe4554 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/user-1.json @@ -0,0 +1,47 @@ +{ + "id": "5f43c9c9-2d3d-45cf-9226-a8503c3815ec", + "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": "Fri, 05 Jun 2020 23:08:27 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4755", + "X-RateLimit-Reset": "1591398935", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"7e41c6c634de27b9ab8f4e95a42d16db\"", + "Last-Modified": "Fri, 29 May 2020 18:24:44 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", + "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": "CFF1:24BF:5492CD:64DB35:5EDAD06B" + } + }, + "uuid": "5f43c9c9-2d3d-45cf-9226-a8503c3815ec", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions-4.json new file mode 100644 index 0000000000..a7c9386292 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions-4.json @@ -0,0 +1,38 @@ +{ + "author": { + "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 + }, + "body": "This is a test discussion", + "body_html": "

This is a test discussion

", + "body_version": "db8c6cacef3d11b326f87a5f9f7a2df0", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/56/comments", + "created_at": "2020-06-05T23:08:24Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/56", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3ODQ3", + "number": 56, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion", + "updated_at": "2020-06-05T23:08:24Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/56" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_56-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_56-5.json new file mode 100644 index 0000000000..a7c9386292 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_56-5.json @@ -0,0 +1,38 @@ +{ + "author": { + "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 + }, + "body": "This is a test discussion", + "body_html": "

This is a test discussion

", + "body_version": "db8c6cacef3d11b326f87a5f9f7a2df0", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/56/comments", + "created_at": "2020-06-05T23:08:24Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/56", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3ODQ3", + "number": 56, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion", + "updated_at": "2020-06-05T23:08:24Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/56" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_56-6.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_56-6.json new file mode 100644 index 0000000000..dc6d0bc93f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_56-6.json @@ -0,0 +1,38 @@ +{ + "author": { + "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 + }, + "body": "This is a test discussion changed", + "body_html": "

This is a test discussion changed

", + "body_version": "40d6d08e84d525b5f268b25f5c9b14d1", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/56/comments", + "created_at": "2020-06-05T23:08:24Z", + "last_edited_at": "2020-06-05T23:08:25Z", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/56", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3ODQ3", + "number": 56, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion", + "updated_at": "2020-06-05T23:08:25Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/56" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_56-7.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_56-7.json new file mode 100644 index 0000000000..b319790997 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_56-7.json @@ -0,0 +1,38 @@ +{ + "author": { + "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 + }, + "body": "This is a test discussion changed", + "body_html": "

This is a test discussion changed

", + "body_version": "40d6d08e84d525b5f268b25f5c9b14d1", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/56/comments", + "created_at": "2020-06-05T23:08:24Z", + "last_edited_at": "2020-06-05T23:08:25Z", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/56", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3ODQ3", + "number": 56, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Title changed", + "updated_at": "2020-06-05T23:08:25Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/56" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_56-9.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_56-9.json new file mode 100644 index 0000000000..b319790997 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_56-9.json @@ -0,0 +1,38 @@ +{ + "author": { + "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 + }, + "body": "This is a test discussion changed", + "body_html": "

This is a test discussion changed

", + "body_version": "40d6d08e84d525b5f268b25f5c9b14d1", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/56/comments", + "created_at": "2020-06-05T23:08:24Z", + "last_edited_at": "2020-06-05T23:08:25Z", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/56", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3ODQ3", + "number": 56, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Title changed", + "updated_at": "2020-06-05T23:08:25Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/56" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org-2.json similarity index 100% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org-1.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org-2.json diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-6.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-3.json similarity index 100% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-6.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-3.json diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-8.json similarity index 100% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-8.json diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json deleted file mode 100644 index f8c84e5be6..0000000000 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "author": { - "login": "cmoulliard", - "id": 463790, - "node_id": "MDQ6VXNlcjQ2Mzc5MA==", - "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/cmoulliard", - "html_url": "https://github.com/cmoulliard", - "followers_url": "https://api.github.com/users/cmoulliard/followers", - "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", - "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", - "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", - "organizations_url": "https://api.github.com/users/cmoulliard/orgs", - "repos_url": "https://api.github.com/users/cmoulliard/repos", - "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", - "received_events_url": "https://api.github.com/users/cmoulliard/received_events", - "type": "User", - "site_admin": false - }, - "body": "This is a dummy discussion", - "body_html": "

This is a dummy discussion

", - "body_version": "d8112c0f6ca6b581773869e497b2bf2e", - "comments_count": 0, - "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6/comments", - "created_at": "2020-06-04T16:17:19Z", - "last_edited_at": null, - "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/6", - "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3NDI5", - "number": 6, - "pinned": false, - "private": false, - "team_url": "https://api.github.com/organizations/7544739/team/3451996", - "title": "Dummy", - "updated_at": "2020-06-04T16:17:19Z", - "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6" -} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json deleted file mode 100644 index d01d5a1fc5..0000000000 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "author": { - "login": "cmoulliard", - "id": 463790, - "node_id": "MDQ6VXNlcjQ2Mzc5MA==", - "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/cmoulliard", - "html_url": "https://github.com/cmoulliard", - "followers_url": "https://api.github.com/users/cmoulliard/followers", - "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", - "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", - "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", - "organizations_url": "https://api.github.com/users/cmoulliard/orgs", - "repos_url": "https://api.github.com/users/cmoulliard/repos", - "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", - "received_events_url": "https://api.github.com/users/cmoulliard/received_events", - "type": "User", - "site_admin": false - }, - "body": "This is a dummy discussion changed", - "body_html": "

This is a dummy discussion changed

", - "body_version": "7e0aad8a790deafb5b416a0c3fe220b4", - "comments_count": 0, - "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6/comments", - "created_at": "2020-06-04T16:17:19Z", - "last_edited_at": "2020-06-04T16:17:19Z", - "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/6", - "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3NDI5", - "number": 6, - "pinned": false, - "private": false, - "team_url": "https://api.github.com/organizations/7544739/team/3451996", - "title": "Dummy", - "updated_at": "2020-06-04T16:17:19Z", - "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6" -} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json deleted file mode 100644 index ccc00b78f9..0000000000 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "author": { - "login": "cmoulliard", - "id": 463790, - "node_id": "MDQ6VXNlcjQ2Mzc5MA==", - "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/cmoulliard", - "html_url": "https://github.com/cmoulliard", - "followers_url": "https://api.github.com/users/cmoulliard/followers", - "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", - "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", - "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", - "organizations_url": "https://api.github.com/users/cmoulliard/orgs", - "repos_url": "https://api.github.com/users/cmoulliard/repos", - "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", - "received_events_url": "https://api.github.com/users/cmoulliard/received_events", - "type": "User", - "site_admin": false - }, - "body": "This is a dummy discussion changed", - "body_html": "

This is a dummy discussion changed

", - "body_version": "7e0aad8a790deafb5b416a0c3fe220b4", - "comments_count": 0, - "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6/comments", - "created_at": "2020-06-04T16:17:19Z", - "last_edited_at": "2020-06-04T16:17:19Z", - "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/6", - "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3NDI5", - "number": 6, - "pinned": false, - "private": false, - "team_url": "https://api.github.com/organizations/7544739/team/3451996", - "title": "Dummy title changed", - "updated_at": "2020-06-04T16:17:20Z", - "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6" -} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json deleted file mode 100644 index ccc00b78f9..0000000000 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "author": { - "login": "cmoulliard", - "id": 463790, - "node_id": "MDQ6VXNlcjQ2Mzc5MA==", - "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/cmoulliard", - "html_url": "https://github.com/cmoulliard", - "followers_url": "https://api.github.com/users/cmoulliard/followers", - "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", - "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", - "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", - "organizations_url": "https://api.github.com/users/cmoulliard/orgs", - "repos_url": "https://api.github.com/users/cmoulliard/repos", - "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", - "received_events_url": "https://api.github.com/users/cmoulliard/received_events", - "type": "User", - "site_admin": false - }, - "body": "This is a dummy discussion changed", - "body_html": "

This is a dummy discussion changed

", - "body_version": "7e0aad8a790deafb5b416a0c3fe220b4", - "comments_count": 0, - "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6/comments", - "created_at": "2020-06-04T16:17:19Z", - "last_edited_at": "2020-06-04T16:17:19Z", - "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/6", - "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3NDI5", - "number": 6, - "pinned": false, - "private": false, - "team_url": "https://api.github.com/organizations/7544739/team/3451996", - "title": "Dummy title changed", - "updated_at": "2020-06-04T16:17:20Z", - "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6" -} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/user-1.json new file mode 100644 index 0000000000..c0e6797da6 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/user-1.json @@ -0,0 +1,46 @@ +{ + "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", + "twitter_username": null, + "public_repos": 187, + "public_gists": 7, + "followers": 161, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2020-05-29T18:24:44Z", + "private_gists": 19, + "total_private_repos": 12, + "owned_private_repos": 0, + "disk_usage": 33700, + "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/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json similarity index 57% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json index 7b77783b9c..e999f35d94 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json @@ -1,8 +1,8 @@ { - "id": "3d1ae726-74eb-4126-b357-8f4a46cb8393", - "name": "orgs_hub4j-test-org_teams_dummy-team_discussions", + "id": "e79f0ed5-72dc-4708-a682-f5ed836916f7", + "name": "organizations_7544739_team_3451996_discussions", "request": { - "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions", + "url": "/organizations/7544739/team/3451996/discussions", "method": "POST", "headers": { "Accept": { @@ -11,33 +11,33 @@ }, "bodyPatterns": [ { - "equalToJson": "{\"title\":\"Dummy\",\"body\":\"This is a dummy discussion\"}", + "equalToJson": "{\"title\":\"Some Discussion\",\"body\":\"This is a test discussion\"}", "ignoreArrayOrder": true, - "ignoreExtraElements": true + "ignoreExtraElements": false } ] }, "response": { "status": 201, - "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team_discussions-3.json", + "bodyFileName": "organizations_7544739_team_3451996_discussions-4.json", "headers": { - "Date": "Thu, 04 Jun 2020 16:17:19 GMT", + "Date": "Fri, 05 Jun 2020 23:08:24 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "201 Created", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4997", - "X-RateLimit-Reset": "1591291038", + "X-RateLimit-Remaining": "4765", + "X-RateLimit-Reset": "1591398936", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "\"474ad2795527698f2308bfe04055a67e\"", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "ETag": "\"5ac9c6b83b3a7e3f162a47846a4964a3\"", + "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": "write:discussion", - "Location": "https://api.github.com/organizations/7544739/team/3451996/discussions/6", + "Location": "https://api.github.com/organizations/7544739/team/3451996/discussions/56", "X-GitHub-Media-Type": "unknown, github.v3", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Frame-Options": "deny", @@ -45,10 +45,10 @@ "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": "FAEC:41F9D:1D0786:233411:5ED91E8F" + "X-GitHub-Request-Id": "CFE9:75EF:A6D267:C63324:5EDAD068" } }, - "uuid": "3d1ae726-74eb-4126-b357-8f4a46cb8393", + "uuid": "e79f0ed5-72dc-4708-a682-f5ed836916f7", "persistent": true, - "insertionIndex": 3 + "insertionIndex": 4 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/teams_3451996_discussions-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_56-5.json similarity index 54% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/teams_3451996_discussions-5.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_56-5.json index 8f130cda59..1cde89b860 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/teams_3451996_discussions-5.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_56-5.json @@ -1,8 +1,8 @@ { - "id": "406e7b31-8211-4903-97aa-08e346658ac3", - "name": "teams_3451996_discussions", + "id": "53d0c47f-53a0-47dd-b2cc-13d775574fa6", + "name": "organizations_7544739_team_3451996_discussions_56", "request": { - "url": "/teams/3451996/discussions", + "url": "/organizations/7544739/team/3451996/discussions/56", "method": "GET", "headers": { "Accept": { @@ -12,38 +12,38 @@ }, "response": { "status": 200, - "bodyFileName": "teams_3451996_discussions-5.json", + "bodyFileName": "organizations_7544739_team_3451996_discussions_56-5.json", "headers": { - "Date": "Thu, 04 Jun 2020 16:17:22 GMT", + "Date": "Fri, 05 Jun 2020 23:08:25 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4988", - "X-RateLimit-Reset": "1591291038", + "X-RateLimit-Remaining": "4764", + "X-RateLimit-Reset": "1591398936", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "W/\"afa845a7dd9e8740ffaeabc16184beed\"", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "ETag": "W/\"5ac9c6b83b3a7e3f162a47846a4964a3\"", + "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": "read:discussion, write:discussion", "X-GitHub-Media-Type": "unknown, github.v3", - "Deprecation": "Sat, 01 Feb 2020 00:00:00 GMT", - "Sunset": "Mon, 01 Feb 2021 00:00:00 GMT", "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": "FAF1:20614:1CB239:22B533:5ED91E92", - "Link": "; rel=\"deprecation\"; type=\"text/html\", ; rel=\"alternate\"" + "X-GitHub-Request-Id": "CFE9:75EF:A6D283:C63345:5EDAD068" } }, - "uuid": "406e7b31-8211-4903-97aa-08e346658ac3", + "uuid": "53d0c47f-53a0-47dd-b2cc-13d775574fa6", "persistent": true, + "scenarioName": "scenario-2-organizations-7544739-team-3451996-discussions-56", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-2-organizations-7544739-team-3451996-discussions-56-2", "insertionIndex": 5 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_56-6.json similarity index 56% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_56-6.json index aff4636451..945f35f767 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_56-6.json @@ -1,8 +1,8 @@ { - "id": "c5c18eef-a963-40bb-9d14-4d8a1b2b94cb", - "name": "orgs_hub4j-test-org_teams_dummy-team_discussions_6", + "id": "bbb97fbf-b03e-4c58-a7f9-2c3e1dceb705", + "name": "organizations_7544739_team_3451996_discussions_56", "request": { - "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions/6", + "url": "/organizations/7544739/team/3451996/discussions/56", "method": "PATCH", "headers": { "Accept": { @@ -11,31 +11,31 @@ }, "bodyPatterns": [ { - "equalToJson": "{\"title\":\"Dummy title changed\"}", + "equalToJson": "{\"title\":\"Some Discussion\",\"body\":\"This is a test discussion changed\"}", "ignoreArrayOrder": true, - "ignoreExtraElements": true + "ignoreExtraElements": false } ] }, "response": { "status": 200, - "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team_discussions_6-5.json", + "bodyFileName": "organizations_7544739_team_3451996_discussions_56-6.json", "headers": { - "Date": "Thu, 04 Jun 2020 16:17:20 GMT", + "Date": "Fri, 05 Jun 2020 23:08:25 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4995", - "X-RateLimit-Reset": "1591291039", + "X-RateLimit-Remaining": "4763", + "X-RateLimit-Reset": "1591398936", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "W/\"21f9a8bf1c804ea7bcc4c757dd4e94c8\"", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "ETag": "W/\"133b00edb2314d912112fabf14ad7ace\"", + "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": "write:discussion", "X-GitHub-Media-Type": "unknown, github.v3", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", @@ -44,10 +44,10 @@ "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": "FAEC:41F9D:1D0860:23351E:5ED91E8F" + "X-GitHub-Request-Id": "CFE9:75EF:A6D2A2:C63368:5EDAD069" } }, - "uuid": "c5c18eef-a963-40bb-9d14-4d8a1b2b94cb", + "uuid": "bbb97fbf-b03e-4c58-a7f9-2c3e1dceb705", "persistent": true, - "insertionIndex": 5 + "insertionIndex": 6 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_56-7.json similarity index 56% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_56-7.json index be17f8377e..3ec45649ba 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_56-7.json @@ -1,8 +1,8 @@ { - "id": "7f9371c0-638b-488b-918a-11a55e3afd70", - "name": "orgs_hub4j-test-org_teams_dummy-team_discussions_6", + "id": "70813a75-593d-4dfd-bd15-eb23c23e3eb6", + "name": "organizations_7544739_team_3451996_discussions_56", "request": { - "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions/6", + "url": "/organizations/7544739/team/3451996/discussions/56", "method": "PATCH", "headers": { "Accept": { @@ -11,31 +11,31 @@ }, "bodyPatterns": [ { - "equalToJson": "{\"body\":\"This is a dummy discussion changed\"}", + "equalToJson": "{\"title\":\"Title changed\",\"body\":\"This is a test discussion changed\"}", "ignoreArrayOrder": true, - "ignoreExtraElements": true + "ignoreExtraElements": false } ] }, "response": { "status": 200, - "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team_discussions_6-4.json", + "bodyFileName": "organizations_7544739_team_3451996_discussions_56-7.json", "headers": { - "Date": "Thu, 04 Jun 2020 16:17:19 GMT", + "Date": "Fri, 05 Jun 2020 23:08:25 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4996", - "X-RateLimit-Reset": "1591291038", + "X-RateLimit-Remaining": "4762", + "X-RateLimit-Reset": "1591398936", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "W/\"bd5a552e2939078a1b746a2bd9889283\"", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "ETag": "W/\"76715078d14f86f37cd6d9550be203e4\"", + "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": "write:discussion", "X-GitHub-Media-Type": "unknown, github.v3", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", @@ -44,10 +44,10 @@ "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": "FAEC:41F9D:1D07DB:23347F:5ED91E8F" + "X-GitHub-Request-Id": "CFE9:75EF:A6D2C9:C6338F:5EDAD069" } }, - "uuid": "7f9371c0-638b-488b-918a-11a55e3afd70", + "uuid": "70813a75-593d-4dfd-bd15-eb23c23e3eb6", "persistent": true, - "insertionIndex": 4 + "insertionIndex": 7 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_56-9.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_56-9.json new file mode 100644 index 0000000000..9855f77a3c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_56-9.json @@ -0,0 +1,48 @@ +{ + "id": "1fedfecb-dd1c-4dec-9279-9827adec8327", + "name": "organizations_7544739_team_3451996_discussions_56", + "request": { + "url": "/organizations/7544739/team/3451996/discussions/56", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "organizations_7544739_team_3451996_discussions_56-9.json", + "headers": { + "Date": "Fri, 05 Jun 2020 23:08:26 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4760", + "X-RateLimit-Reset": "1591398936", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"76715078d14f86f37cd6d9550be203e4\"", + "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": "read:discussion, write:discussion", + "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": "CFE9:75EF:A6D30D:C633E9:5EDAD06A" + } + }, + "uuid": "1fedfecb-dd1c-4dec-9279-9827adec8327", + "persistent": true, + "scenarioName": "scenario-2-organizations-7544739-team-3451996-discussions-56", + "requiredScenarioState": "scenario-2-organizations-7544739-team-3451996-discussions-56-2", + "insertionIndex": 9 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org-2.json similarity index 68% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org-1.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org-2.json index 4a416c6ff3..b7a7190eba 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org-1.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org-2.json @@ -1,5 +1,5 @@ { - "id": "05732ae7-d8d8-4b1a-a3dd-e3038d14eeb5", + "id": "42ffae1e-4e0f-45f5-8bba-27d98db628d5", "name": "orgs_hub4j-test-org", "request": { "url": "/orgs/hub4j-test-org", @@ -12,24 +12,24 @@ }, "response": { "status": 200, - "bodyFileName": "orgs_hub4j-test-org-1.json", + "bodyFileName": "orgs_hub4j-test-org-2.json", "headers": { - "Date": "Thu, 04 Jun 2020 16:17:21 GMT", + "Date": "Fri, 05 Jun 2020 23:08:24 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4992", - "X-RateLimit-Reset": "1591291039", + "X-RateLimit-Remaining": "4767", + "X-RateLimit-Reset": "1591398936", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "W/\"1a6a487ed52f9d847d59925e769484a5\"", + "ETag": "W/\"0557d9126fa25140eab7bdf16c451149\"", "Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "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", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", @@ -38,10 +38,10 @@ "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": "FAF1:20614:1CB0B3:22B36C:5ED91E90" + "X-GitHub-Request-Id": "CFE9:75EF:A6D241:C632B2:5EDAD067" } }, - "uuid": "05732ae7-d8d8-4b1a-a3dd-e3038d14eeb5", + "uuid": "42ffae1e-4e0f-45f5-8bba-27d98db628d5", "persistent": true, - "insertionIndex": 1 + "insertionIndex": 2 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json similarity index 71% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json index e76699bbed..fa02491181 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json @@ -1,5 +1,5 @@ { - "id": "ee07ede6-da15-4639-991a-5d47d2b1bb33", + "id": "e1711d09-a967-45d4-b207-1e3ecbb0242a", "name": "orgs_hub4j-test-org_teams_dummy-team", "request": { "url": "/orgs/hub4j-test-org/teams/dummy-team", @@ -12,24 +12,24 @@ }, "response": { "status": 200, - "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-2.json", + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-3.json", "headers": { - "Date": "Thu, 04 Jun 2020 16:17:23 GMT", + "Date": "Fri, 05 Jun 2020 23:08:24 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4986", - "X-RateLimit-Reset": "1591291038", + "X-RateLimit-Remaining": "4766", + "X-RateLimit-Reset": "1591398936", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "W/\"5b8a20b94c28536e4d7b9af6bd1a2f0a\"", + "ETag": "W/\"adf552e4a615c271e66b7d2bb00e61c4\"", "Last-Modified": "Tue, 02 Jun 2020 19:31:50 GMT", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "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", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", @@ -38,13 +38,13 @@ "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": "FAF6:C609:2660AA:2E8275:5ED91E93" + "X-GitHub-Request-Id": "CFE9:75EF:A6D251:C6330D:5EDAD068" } }, - "uuid": "ee07ede6-da15-4639-991a-5d47d2b1bb33", + "uuid": "e1711d09-a967-45d4-b207-1e3ecbb0242a", "persistent": true, "scenarioName": "scenario-1-orgs-hub4j-test-org-teams-dummy-team", "requiredScenarioState": "Started", "newScenarioState": "scenario-1-orgs-hub4j-test-org-teams-dummy-team-2", - "insertionIndex": 2 + "insertionIndex": 3 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-8.json similarity index 70% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-4.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-8.json index 35ecd18fe0..b8aecc83cb 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-4.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-8.json @@ -1,5 +1,5 @@ { - "id": "b29d3637-79cb-435c-a350-e6db09c8a127", + "id": "78d21051-03ee-4a7e-8ffb-9139cbb08984", "name": "orgs_hub4j-test-org_teams_dummy-team", "request": { "url": "/orgs/hub4j-test-org/teams/dummy-team", @@ -12,24 +12,24 @@ }, "response": { "status": 200, - "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-4.json", + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-8.json", "headers": { - "Date": "Thu, 04 Jun 2020 16:17:22 GMT", + "Date": "Fri, 05 Jun 2020 23:08:26 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4989", - "X-RateLimit-Reset": "1591291038", + "X-RateLimit-Remaining": "4761", + "X-RateLimit-Reset": "1591398936", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "W/\"5b8a20b94c28536e4d7b9af6bd1a2f0a\"", + "ETag": "W/\"adf552e4a615c271e66b7d2bb00e61c4\"", "Last-Modified": "Tue, 02 Jun 2020 19:31:50 GMT", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "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", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", @@ -38,12 +38,12 @@ "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": "FAF1:20614:1CB186:22B45A:5ED91E91" + "X-GitHub-Request-Id": "CFE9:75EF:A6D2ED:C633BA:5EDAD069" } }, - "uuid": "b29d3637-79cb-435c-a350-e6db09c8a127", + "uuid": "78d21051-03ee-4a7e-8ffb-9139cbb08984", "persistent": true, "scenarioName": "scenario-1-orgs-hub4j-test-org-teams-dummy-team", "requiredScenarioState": "scenario-1-orgs-hub4j-test-org-teams-dummy-team-2", - "insertionIndex": 4 + "insertionIndex": 8 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/user-1.json new file mode 100644 index 0000000000..2f6912ddef --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/user-1.json @@ -0,0 +1,47 @@ +{ + "id": "7b9863d9-278c-47f2-8957-45bf277b500e", + "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": "Fri, 05 Jun 2020 23:08:23 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4769", + "X-RateLimit-Reset": "1591398936", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"7e41c6c634de27b9ab8f4e95a42d16db\"", + "Last-Modified": "Fri, 29 May 2020 18:24:44 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", + "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": "CFE9:75EF:A6D1FA:C632A7:5EDAD067" + } + }, + "uuid": "7b9863d9-278c-47f2-8957-45bf277b500e", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/organizations_7544739_team_3451996_discussions-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/organizations_7544739_team_3451996_discussions-4.json new file mode 100644 index 0000000000..cce81ae786 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/organizations_7544739_team_3451996_discussions-4.json @@ -0,0 +1,38 @@ +{ + "author": { + "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 + }, + "body": "This is a test discussion", + "body_html": "

This is a test discussion

", + "body_version": "db8c6cacef3d11b326f87a5f9f7a2df0", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/61/comments", + "created_at": "2020-06-05T23:08:34Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/61", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3ODUy", + "number": 61, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion A", + "updated_at": "2020-06-05T23:08:34Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/61" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/organizations_7544739_team_3451996_discussions-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/organizations_7544739_team_3451996_discussions-5.json new file mode 100644 index 0000000000..95179030af --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/organizations_7544739_team_3451996_discussions-5.json @@ -0,0 +1,38 @@ +{ + "author": { + "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 + }, + "body": "This is a test discussion", + "body_html": "

This is a test discussion

", + "body_version": "db8c6cacef3d11b326f87a5f9f7a2df0", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/62/comments", + "created_at": "2020-06-05T23:08:35Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/62", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3ODUz", + "number": 62, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion B", + "updated_at": "2020-06-05T23:08:35Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/62" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/organizations_7544739_team_3451996_discussions-6.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/organizations_7544739_team_3451996_discussions-6.json new file mode 100644 index 0000000000..84cc311dcb --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/organizations_7544739_team_3451996_discussions-6.json @@ -0,0 +1,38 @@ +{ + "author": { + "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 + }, + "body": "This is a test discussion", + "body_html": "

This is a test discussion

", + "body_version": "db8c6cacef3d11b326f87a5f9f7a2df0", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/63/comments", + "created_at": "2020-06-05T23:08:35Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/63", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3ODU0", + "number": 63, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion C", + "updated_at": "2020-06-05T23:08:35Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/63" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/organizations_7544739_team_3451996_discussions-7.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/organizations_7544739_team_3451996_discussions-7.json new file mode 100644 index 0000000000..68b40abfbd --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/organizations_7544739_team_3451996_discussions-7.json @@ -0,0 +1,116 @@ +[ + { + "author": { + "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 + }, + "body": "This is a test discussion", + "body_html": "

This is a test discussion

", + "body_version": "db8c6cacef3d11b326f87a5f9f7a2df0", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/63/comments", + "created_at": "2020-06-05T23:08:35Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/63", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3ODU0", + "number": 63, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion C", + "updated_at": "2020-06-05T23:08:35Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/63" + }, + { + "author": { + "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 + }, + "body": "This is a test discussion", + "body_html": "

This is a test discussion

", + "body_version": "db8c6cacef3d11b326f87a5f9f7a2df0", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/62/comments", + "created_at": "2020-06-05T23:08:35Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/62", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3ODUz", + "number": 62, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion B", + "updated_at": "2020-06-05T23:08:35Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/62" + }, + { + "author": { + "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 + }, + "body": "This is a test discussion", + "body_html": "

This is a test discussion

", + "body_version": "db8c6cacef3d11b326f87a5f9f7a2df0", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/61/comments", + "created_at": "2020-06-05T23:08:34Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/61", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3ODUy", + "number": 61, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion A", + "updated_at": "2020-06-05T23:08:34Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/61" + } +] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org-2.json similarity index 100% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org-1.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org-2.json diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-3.json similarity index 100% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-4.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-3.json diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json deleted file mode 100644 index 8448c5c953..0000000000 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "author": { - "login": "cmoulliard", - "id": 463790, - "node_id": "MDQ6VXNlcjQ2Mzc5MA==", - "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/cmoulliard", - "html_url": "https://github.com/cmoulliard", - "followers_url": "https://api.github.com/users/cmoulliard/followers", - "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", - "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", - "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", - "organizations_url": "https://api.github.com/users/cmoulliard/orgs", - "repos_url": "https://api.github.com/users/cmoulliard/repos", - "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", - "received_events_url": "https://api.github.com/users/cmoulliard/received_events", - "type": "User", - "site_admin": false - }, - "body": "This is a dummy discussion", - "body_html": "

This is a dummy discussion

", - "body_version": "d8112c0f6ca6b581773869e497b2bf2e", - "comments_count": 0, - "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/7/comments", - "created_at": "2020-06-04T16:17:21Z", - "last_edited_at": null, - "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/7", - "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3NDMw", - "number": 7, - "pinned": false, - "private": false, - "team_url": "https://api.github.com/organizations/7544739/team/3451996", - "title": "Dummy", - "updated_at": "2020-06-04T16:17:21Z", - "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/7" -} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/teams_3451996_discussions-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/teams_3451996_discussions-5.json deleted file mode 100644 index b84b5b778a..0000000000 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/teams_3451996_discussions-5.json +++ /dev/null @@ -1,268 +0,0 @@ -[ - { - "author": { - "login": "cmoulliard", - "id": 463790, - "node_id": "MDQ6VXNlcjQ2Mzc5MA==", - "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/cmoulliard", - "html_url": "https://github.com/cmoulliard", - "followers_url": "https://api.github.com/users/cmoulliard/followers", - "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", - "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", - "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", - "organizations_url": "https://api.github.com/users/cmoulliard/orgs", - "repos_url": "https://api.github.com/users/cmoulliard/repos", - "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", - "received_events_url": "https://api.github.com/users/cmoulliard/received_events", - "type": "User", - "site_admin": false - }, - "body": "This is a dummy discussion", - "body_html": "

This is a dummy discussion

", - "body_version": "d8112c0f6ca6b581773869e497b2bf2e", - "comments_count": 0, - "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/7/comments", - "created_at": "2020-06-04T16:17:21Z", - "last_edited_at": null, - "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/7", - "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3NDMw", - "number": 7, - "pinned": false, - "private": false, - "team_url": "https://api.github.com/organizations/7544739/team/3451996", - "title": "Dummy", - "updated_at": "2020-06-04T16:17:21Z", - "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/7" - }, - { - "author": { - "login": "cmoulliard", - "id": 463790, - "node_id": "MDQ6VXNlcjQ2Mzc5MA==", - "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/cmoulliard", - "html_url": "https://github.com/cmoulliard", - "followers_url": "https://api.github.com/users/cmoulliard/followers", - "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", - "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", - "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", - "organizations_url": "https://api.github.com/users/cmoulliard/orgs", - "repos_url": "https://api.github.com/users/cmoulliard/repos", - "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", - "received_events_url": "https://api.github.com/users/cmoulliard/received_events", - "type": "User", - "site_admin": false - }, - "body": "This is a dummy discussion changed", - "body_html": "

This is a dummy discussion changed

", - "body_version": "7e0aad8a790deafb5b416a0c3fe220b4", - "comments_count": 0, - "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6/comments", - "created_at": "2020-06-04T16:17:19Z", - "last_edited_at": "2020-06-04T16:17:19Z", - "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/6", - "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3NDI5", - "number": 6, - "pinned": false, - "private": false, - "team_url": "https://api.github.com/organizations/7544739/team/3451996", - "title": "Dummy title changed", - "updated_at": "2020-06-04T16:17:20Z", - "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/6" - }, - { - "author": { - "login": "cmoulliard", - "id": 463790, - "node_id": "MDQ6VXNlcjQ2Mzc5MA==", - "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/cmoulliard", - "html_url": "https://github.com/cmoulliard", - "followers_url": "https://api.github.com/users/cmoulliard/followers", - "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", - "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", - "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", - "organizations_url": "https://api.github.com/users/cmoulliard/orgs", - "repos_url": "https://api.github.com/users/cmoulliard/repos", - "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", - "received_events_url": "https://api.github.com/users/cmoulliard/received_events", - "type": "User", - "site_admin": false - }, - "body": "This is a dummy discussion", - "body_html": "

This is a dummy discussion

", - "body_version": "d8112c0f6ca6b581773869e497b2bf2e", - "comments_count": 0, - "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/5/comments", - "created_at": "2020-06-04T06:16:03Z", - "last_edited_at": null, - "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/5", - "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3MjQ2", - "number": 5, - "pinned": false, - "private": false, - "team_url": "https://api.github.com/organizations/7544739/team/3451996", - "title": "Dummy", - "updated_at": "2020-06-04T06:16:03Z", - "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/5" - }, - { - "author": { - "login": "cmoulliard", - "id": 463790, - "node_id": "MDQ6VXNlcjQ2Mzc5MA==", - "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/cmoulliard", - "html_url": "https://github.com/cmoulliard", - "followers_url": "https://api.github.com/users/cmoulliard/followers", - "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", - "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", - "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", - "organizations_url": "https://api.github.com/users/cmoulliard/orgs", - "repos_url": "https://api.github.com/users/cmoulliard/repos", - "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", - "received_events_url": "https://api.github.com/users/cmoulliard/received_events", - "type": "User", - "site_admin": false - }, - "body": "This is a dummy discussion", - "body_html": "

This is a dummy discussion

", - "body_version": "d8112c0f6ca6b581773869e497b2bf2e", - "comments_count": 0, - "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/4/comments", - "created_at": "2020-06-04T05:45:32Z", - "last_edited_at": null, - "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/4", - "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3MjQ1", - "number": 4, - "pinned": false, - "private": false, - "team_url": "https://api.github.com/organizations/7544739/team/3451996", - "title": "Dummy", - "updated_at": "2020-06-04T05:45:32Z", - "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/4" - }, - { - "author": { - "login": "cmoulliard", - "id": 463790, - "node_id": "MDQ6VXNlcjQ2Mzc5MA==", - "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/cmoulliard", - "html_url": "https://github.com/cmoulliard", - "followers_url": "https://api.github.com/users/cmoulliard/followers", - "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", - "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", - "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", - "organizations_url": "https://api.github.com/users/cmoulliard/orgs", - "repos_url": "https://api.github.com/users/cmoulliard/repos", - "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", - "received_events_url": "https://api.github.com/users/cmoulliard/received_events", - "type": "User", - "site_admin": false - }, - "body": "This is a dummy discussion", - "body_html": "

This is a dummy discussion

", - "body_version": "d8112c0f6ca6b581773869e497b2bf2e", - "comments_count": 0, - "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/3/comments", - "created_at": "2020-06-04T05:45:13Z", - "last_edited_at": null, - "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/3", - "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3MjQ0", - "number": 3, - "pinned": false, - "private": false, - "team_url": "https://api.github.com/organizations/7544739/team/3451996", - "title": "Dummy", - "updated_at": "2020-06-04T05:45:13Z", - "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/3" - }, - { - "author": { - "login": "cmoulliard", - "id": 463790, - "node_id": "MDQ6VXNlcjQ2Mzc5MA==", - "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/cmoulliard", - "html_url": "https://github.com/cmoulliard", - "followers_url": "https://api.github.com/users/cmoulliard/followers", - "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", - "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", - "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", - "organizations_url": "https://api.github.com/users/cmoulliard/orgs", - "repos_url": "https://api.github.com/users/cmoulliard/repos", - "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", - "received_events_url": "https://api.github.com/users/cmoulliard/received_events", - "type": "User", - "site_admin": false - }, - "body": "This is a dummy discussion", - "body_html": "

This is a dummy discussion

", - "body_version": "d8112c0f6ca6b581773869e497b2bf2e", - "comments_count": 0, - "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/2/comments", - "created_at": "2020-06-04T05:29:38Z", - "last_edited_at": null, - "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/2", - "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3MjQw", - "number": 2, - "pinned": false, - "private": false, - "team_url": "https://api.github.com/organizations/7544739/team/3451996", - "title": "Dummy", - "updated_at": "2020-06-04T05:29:38Z", - "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/2" - }, - { - "author": { - "login": "cmoulliard", - "id": 463790, - "node_id": "MDQ6VXNlcjQ2Mzc5MA==", - "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/cmoulliard", - "html_url": "https://github.com/cmoulliard", - "followers_url": "https://api.github.com/users/cmoulliard/followers", - "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", - "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", - "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", - "organizations_url": "https://api.github.com/users/cmoulliard/orgs", - "repos_url": "https://api.github.com/users/cmoulliard/repos", - "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", - "received_events_url": "https://api.github.com/users/cmoulliard/received_events", - "type": "User", - "site_admin": false - }, - "body": "This is a dummy discussion", - "body_html": "

This is a dummy discussion

", - "body_version": "d8112c0f6ca6b581773869e497b2bf2e", - "comments_count": 0, - "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/1/comments", - "created_at": "2020-06-04T05:29:06Z", - "last_edited_at": null, - "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/1", - "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3MjM5", - "number": 1, - "pinned": false, - "private": false, - "team_url": "https://api.github.com/organizations/7544739/team/3451996", - "title": "Dummy", - "updated_at": "2020-06-04T05:29:06Z", - "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/1" - } -] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/user-1.json new file mode 100644 index 0000000000..c0e6797da6 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/user-1.json @@ -0,0 +1,46 @@ +{ + "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", + "twitter_username": null, + "public_repos": 187, + "public_gists": 7, + "followers": 161, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2020-05-29T18:24:44Z", + "private_gists": 19, + "total_private_repos": 12, + "owned_private_repos": 0, + "disk_usage": 33700, + "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/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json new file mode 100644 index 0000000000..9c09e94f50 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json @@ -0,0 +1,54 @@ +{ + "id": "a9fb558a-d4d8-4bdc-90c6-0c69cf0cccab", + "name": "organizations_7544739_team_3451996_discussions", + "request": { + "url": "/organizations/7544739/team/3451996/discussions", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Some Discussion A\",\"body\":\"This is a test discussion\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "organizations_7544739_team_3451996_discussions-4.json", + "headers": { + "Date": "Fri, 05 Jun 2020 23:08:34 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4726", + "X-RateLimit-Reset": "1591398936", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "\"fda6ea6059960017264945de79550718\"", + "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": "write:discussion", + "Location": "https://api.github.com/organizations/7544739/team/3451996/discussions/61", + "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": "CFFB:979C:1DBF93:23C47C:5EDAD072" + } + }, + "uuid": "a9fb558a-d4d8-4bdc-90c6-0c69cf0cccab", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-5.json new file mode 100644 index 0000000000..397b7989ee --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-5.json @@ -0,0 +1,54 @@ +{ + "id": "8122b2d7-fb10-4a80-9c90-603a0331c40c", + "name": "organizations_7544739_team_3451996_discussions", + "request": { + "url": "/organizations/7544739/team/3451996/discussions", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Some Discussion B\",\"body\":\"This is a test discussion\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "organizations_7544739_team_3451996_discussions-5.json", + "headers": { + "Date": "Fri, 05 Jun 2020 23:08:35 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4725", + "X-RateLimit-Reset": "1591398936", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "\"4acb1681262e9f89b5516ad5d804aee4\"", + "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": "write:discussion", + "Location": "https://api.github.com/organizations/7544739/team/3451996/discussions/62", + "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": "CFFB:979C:1DBF96:23C482:5EDAD072" + } + }, + "uuid": "8122b2d7-fb10-4a80-9c90-603a0331c40c", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-6.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-6.json new file mode 100644 index 0000000000..f8512252e6 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-6.json @@ -0,0 +1,54 @@ +{ + "id": "bb49da5d-06ed-4e5a-8df8-45b8c68f723e", + "name": "organizations_7544739_team_3451996_discussions", + "request": { + "url": "/organizations/7544739/team/3451996/discussions", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Some Discussion C\",\"body\":\"This is a test discussion\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "organizations_7544739_team_3451996_discussions-6.json", + "headers": { + "Date": "Fri, 05 Jun 2020 23:08:35 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4724", + "X-RateLimit-Reset": "1591398936", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "\"c8879f78bca38d17e39a60ce77710200\"", + "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": "write:discussion", + "Location": "https://api.github.com/organizations/7544739/team/3451996/discussions/63", + "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": "CFFB:979C:1DBF99:23C484:5EDAD073" + } + }, + "uuid": "bb49da5d-06ed-4e5a-8df8-45b8c68f723e", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-7.json similarity index 61% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-7.json index 7dfd1a1eeb..28d0ecf16f 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-7.json @@ -1,8 +1,8 @@ { - "id": "f89ff323-7894-4a03-8564-f4494188d54a", - "name": "orgs_hub4j-test-org_teams_dummy-team_discussions_6", + "id": "2b24a93c-7d7e-481e-a3fd-681ff45d09e2", + "name": "organizations_7544739_team_3451996_discussions", "request": { - "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions/6", + "url": "/organizations/7544739/team/3451996/discussions", "method": "GET", "headers": { "Accept": { @@ -12,23 +12,23 @@ }, "response": { "status": 200, - "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team_discussions_6-7.json", + "bodyFileName": "organizations_7544739_team_3451996_discussions-7.json", "headers": { - "Date": "Thu, 04 Jun 2020 16:17:20 GMT", + "Date": "Fri, 05 Jun 2020 23:08:35 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4993", - "X-RateLimit-Reset": "1591291038", + "X-RateLimit-Remaining": "4723", + "X-RateLimit-Reset": "1591398935", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "W/\"21f9a8bf1c804ea7bcc4c757dd4e94c8\"", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "ETag": "W/\"06cde48be7ded909e2643d7c62bc1b40\"", + "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": "read:discussion, write:discussion", "X-GitHub-Media-Type": "unknown, github.v3", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", @@ -37,10 +37,10 @@ "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": "FAEC:41F9D:1D0903:2335ED:5ED91E90" + "X-GitHub-Request-Id": "CFFB:979C:1DBF9D:23C489:5EDAD073" } }, - "uuid": "f89ff323-7894-4a03-8564-f4494188d54a", + "uuid": "2b24a93c-7d7e-481e-a3fd-681ff45d09e2", "persistent": true, "insertionIndex": 7 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org-2.json similarity index 68% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org-1.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org-2.json index 52fb4a7805..14999a54b0 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org-1.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org-2.json @@ -1,5 +1,5 @@ { - "id": "c7e2c0af-4ef4-48bc-9718-df70a72f3bfd", + "id": "0deb7fe4-0390-4fff-a7b3-64ec28d47535", "name": "orgs_hub4j-test-org", "request": { "url": "/orgs/hub4j-test-org", @@ -12,24 +12,24 @@ }, "response": { "status": 200, - "bodyFileName": "orgs_hub4j-test-org-1.json", + "bodyFileName": "orgs_hub4j-test-org-2.json", "headers": { - "Date": "Thu, 04 Jun 2020 16:17:18 GMT", + "Date": "Fri, 05 Jun 2020 23:08:34 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4999", - "X-RateLimit-Reset": "1591291038", + "X-RateLimit-Remaining": "4728", + "X-RateLimit-Reset": "1591398936", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "W/\"1a6a487ed52f9d847d59925e769484a5\"", + "ETag": "W/\"0557d9126fa25140eab7bdf16c451149\"", "Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "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", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", @@ -38,10 +38,10 @@ "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": "FAEC:41F9D:1D0705:233380:5ED91E8E" + "X-GitHub-Request-Id": "CFFB:979C:1DBF8B:23C473:5EDAD072" } }, - "uuid": "c7e2c0af-4ef4-48bc-9718-df70a72f3bfd", + "uuid": "0deb7fe4-0390-4fff-a7b3-64ec28d47535", "persistent": true, - "insertionIndex": 1 + "insertionIndex": 2 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json deleted file mode 100644 index 751b779bee..0000000000 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "id": "817fa46d-cb4e-4ae8-9087-7cd92b0aa5af", - "name": "orgs_hub4j-test-org_teams_dummy-team", - "request": { - "url": "/orgs/hub4j-test-org/teams/dummy-team", - "method": "GET", - "headers": { - "Accept": { - "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" - } - } - }, - "response": { - "status": 200, - "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-2.json", - "headers": { - "Date": "Thu, 04 Jun 2020 16:17:21 GMT", - "Content-Type": "application/json; charset=utf-8", - "Server": "GitHub.com", - "Status": "200 OK", - "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4991", - "X-RateLimit-Reset": "1591291038", - "Cache-Control": "private, max-age=60, s-maxage=60", - "Vary": [ - "Accept, Authorization, Cookie, X-GitHub-OTP", - "Accept-Encoding, Accept, X-Requested-With", - "Accept-Encoding" - ], - "ETag": "W/\"5b8a20b94c28536e4d7b9af6bd1a2f0a\"", - "Last-Modified": "Tue, 02 Jun 2020 19:31:50 GMT", - "X-OAuth-Scopes": "admin:org, 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", - "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": "FAF1:20614:1CB0EF:22B3A1:5ED91E91" - } - }, - "uuid": "817fa46d-cb4e-4ae8-9087-7cd92b0aa5af", - "persistent": true, - "scenarioName": "scenario-1-orgs-hub4j-test-org-teams-dummy-team", - "requiredScenarioState": "Started", - "newScenarioState": "scenario-1-orgs-hub4j-test-org-teams-dummy-team-2", - "insertionIndex": 2 -} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json similarity index 64% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-5.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json index afaaf8332c..86a877374c 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-5.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json @@ -1,5 +1,5 @@ { - "id": "345d180e-4240-4ee1-98e5-efde0cfc2112", + "id": "772cba72-3cc0-4e06-8be0-7ad41530bca1", "name": "orgs_hub4j-test-org_teams_dummy-team", "request": { "url": "/orgs/hub4j-test-org/teams/dummy-team", @@ -12,24 +12,24 @@ }, "response": { "status": 200, - "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-5.json", + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-3.json", "headers": { - "Date": "Thu, 04 Jun 2020 16:17:24 GMT", + "Date": "Fri, 05 Jun 2020 23:08:34 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4983", - "X-RateLimit-Reset": "1591291038", + "X-RateLimit-Remaining": "4727", + "X-RateLimit-Reset": "1591398936", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "W/\"5b8a20b94c28536e4d7b9af6bd1a2f0a\"", + "ETag": "W/\"adf552e4a615c271e66b7d2bb00e61c4\"", "Last-Modified": "Tue, 02 Jun 2020 19:31:50 GMT", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "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", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", @@ -38,12 +38,10 @@ "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": "FAF6:C609:266222:2E8441:5ED91E94" + "X-GitHub-Request-Id": "CFFB:979C:1DBF8F:23C479:5EDAD072" } }, - "uuid": "345d180e-4240-4ee1-98e5-efde0cfc2112", + "uuid": "772cba72-3cc0-4e06-8be0-7ad41530bca1", "persistent": true, - "scenarioName": "scenario-1-orgs-hub4j-test-org-teams-dummy-team", - "requiredScenarioState": "scenario-1-orgs-hub4j-test-org-teams-dummy-team-2", - "insertionIndex": 5 + "insertionIndex": 3 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/user-1.json new file mode 100644 index 0000000000..20cdd4a824 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/user-1.json @@ -0,0 +1,47 @@ +{ + "id": "9404c76c-b91e-4e46-b493-b7f09feb7588", + "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": "Fri, 05 Jun 2020 23:08:34 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4730", + "X-RateLimit-Reset": "1591398936", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"7e41c6c634de27b9ab8f4e95a42d16db\"", + "Last-Modified": "Fri, 29 May 2020 18:24:44 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", + "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": "CFFB:979C:1DBF88:23C471:5EDAD071" + } + }, + "uuid": "9404c76c-b91e-4e46-b493-b7f09feb7588", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/organizations_7544739_team_3451996_discussions-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/organizations_7544739_team_3451996_discussions-4.json new file mode 100644 index 0000000000..910fcd7aaf --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/organizations_7544739_team_3451996_discussions-4.json @@ -0,0 +1,38 @@ +{ + "author": { + "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 + }, + "body": "This is a test discussion", + "body_html": "

This is a test discussion

", + "body_version": "db8c6cacef3d11b326f87a5f9f7a2df0", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/60/comments", + "created_at": "2020-06-05T23:08:32Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/60", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3ODUx", + "number": 60, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion", + "updated_at": "2020-06-05T23:08:32Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/60" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org-2.json similarity index 77% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-1.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org-2.json index f5d028a8d5..7121c693d7 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-1.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org-2.json @@ -10,7 +10,13 @@ "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", - "description": null, + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, "is_verified": false, "has_organization_projects": true, "has_repository_projects": true, @@ -20,7 +26,7 @@ "following": 0, "html_url": "https://github.com/hub4j-test-org", "created_at": "2014-05-10T19:39:11Z", - "updated_at": "2020-05-15T15:14:14Z", + "updated_at": "2020-06-04T05:56:10Z", "type": "Organization", "total_private_repos": 0, "owned_private_repos": 0, diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-3.json similarity index 100% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-3.json diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-6.json similarity index 100% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-5.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-6.json diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json deleted file mode 100644 index d5e170a366..0000000000 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "author": { - "login": "cmoulliard", - "id": 463790, - "node_id": "MDQ6VXNlcjQ2Mzc5MA==", - "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/cmoulliard", - "html_url": "https://github.com/cmoulliard", - "followers_url": "https://api.github.com/users/cmoulliard/followers", - "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", - "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", - "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", - "organizations_url": "https://api.github.com/users/cmoulliard/orgs", - "repos_url": "https://api.github.com/users/cmoulliard/repos", - "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", - "received_events_url": "https://api.github.com/users/cmoulliard/received_events", - "type": "User", - "site_admin": false - }, - "body": "This is a dummy discussion", - "body_html": "

This is a dummy discussion

", - "body_version": "d8112c0f6ca6b581773869e497b2bf2e", - "comments_count": 0, - "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/8/comments", - "created_at": "2020-06-04T16:17:23Z", - "last_edited_at": null, - "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/8", - "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE3NDMx", - "number": 8, - "pinned": false, - "private": false, - "team_url": "https://api.github.com/organizations/7544739/team/3451996", - "title": "Dummy", - "updated_at": "2020-06-04T16:17:23Z", - "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/8" -} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/user-1.json new file mode 100644 index 0000000000..c0e6797da6 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/user-1.json @@ -0,0 +1,46 @@ +{ + "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", + "twitter_username": null, + "public_repos": 187, + "public_gists": 7, + "followers": 161, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2020-05-29T18:24:44Z", + "private_gists": 19, + "total_private_repos": 12, + "owned_private_repos": 0, + "disk_usage": 33700, + "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/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json similarity index 57% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json index d3102b7f8b..c13761cbe9 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions-3.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json @@ -1,8 +1,8 @@ { - "id": "da16aef1-de97-46bd-84ee-af9ca1c8bfa7", - "name": "orgs_hub4j-test-org_teams_dummy-team_discussions", + "id": "7f7b202f-1bee-458a-9fd5-1da36a9c7b85", + "name": "organizations_7544739_team_3451996_discussions", "request": { - "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions", + "url": "/organizations/7544739/team/3451996/discussions", "method": "POST", "headers": { "Accept": { @@ -11,33 +11,33 @@ }, "bodyPatterns": [ { - "equalToJson": "{\"title\":\"Dummy\",\"body\":\"This is a dummy discussion\"}", + "equalToJson": "{\"title\":\"Some Discussion\",\"body\":\"This is a test discussion\"}", "ignoreArrayOrder": true, - "ignoreExtraElements": true + "ignoreExtraElements": false } ] }, "response": { "status": 201, - "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team_discussions-3.json", + "bodyFileName": "organizations_7544739_team_3451996_discussions-4.json", "headers": { - "Date": "Thu, 04 Jun 2020 16:17:23 GMT", + "Date": "Fri, 05 Jun 2020 23:08:32 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "201 Created", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4985", - "X-RateLimit-Reset": "1591291038", + "X-RateLimit-Remaining": "4737", + "X-RateLimit-Reset": "1591398936", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "\"c2e89c5a2d8854d38d7792b71564c2c1\"", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "ETag": "\"7d2dd64d5497312194db5251878b211a\"", + "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": "write:discussion", - "Location": "https://api.github.com/organizations/7544739/team/3451996/discussions/8", + "Location": "https://api.github.com/organizations/7544739/team/3451996/discussions/60", "X-GitHub-Media-Type": "unknown, github.v3", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Frame-Options": "deny", @@ -45,10 +45,10 @@ "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": "FAF6:C609:266105:2E82DB:5ED91E93" + "X-GitHub-Request-Id": "CFF6:682B:A5960A:C522DA:5EDAD070" } }, - "uuid": "da16aef1-de97-46bd-84ee-af9ca1c8bfa7", + "uuid": "7f7b202f-1bee-458a-9fd5-1da36a9c7b85", "persistent": true, - "insertionIndex": 3 + "insertionIndex": 4 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_8-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions_60-5.json similarity index 60% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_8-4.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions_60-5.json index 4e65f8b7f0..aeb30002ff 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_8-4.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions_60-5.json @@ -1,8 +1,8 @@ { - "id": "097b4abb-4b15-4b1a-9867-ee6281df6499", - "name": "orgs_hub4j-test-org_teams_dummy-team_discussions_8", + "id": "749f35ad-55e1-43b6-8748-1238ca7c01cb", + "name": "organizations_7544739_team_3451996_discussions_60", "request": { - "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions/8", + "url": "/organizations/7544739/team/3451996/discussions/60", "method": "DELETE", "headers": { "Accept": { @@ -13,13 +13,13 @@ "response": { "status": 204, "headers": { - "Date": "Thu, 04 Jun 2020 16:17:24 GMT", + "Date": "Fri, 05 Jun 2020 23:08:32 GMT", "Server": "GitHub.com", "Status": "204 No Content", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4984", - "X-RateLimit-Reset": "1591291038", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "X-RateLimit-Remaining": "4736", + "X-RateLimit-Reset": "1591398936", + "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": "write:discussion", "X-GitHub-Media-Type": "unknown, github.v3", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", @@ -32,10 +32,10 @@ "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "X-GitHub-Request-Id": "FAF6:C609:2661A5:2E83A5:5ED91E93" + "X-GitHub-Request-Id": "CFF6:682B:A59634:C522FA:5EDAD070" } }, - "uuid": "097b4abb-4b15-4b1a-9867-ee6281df6499", + "uuid": "749f35ad-55e1-43b6-8748-1238ca7c01cb", "persistent": true, - "insertionIndex": 4 + "insertionIndex": 5 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_8-6.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions_60-7.json similarity index 63% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_8-6.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions_60-7.json index ea2d07e9b9..f93169f15e 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team_discussions_8-6.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions_60-7.json @@ -1,8 +1,8 @@ { - "id": "309b6527-6214-4d16-9322-1f45917e1251", - "name": "orgs_hub4j-test-org_teams_dummy-team_discussions_8", + "id": "39105355-3f9f-4d78-b2ae-393a8b1ff2bc", + "name": "organizations_7544739_team_3451996_discussions_60", "request": { - "url": "/orgs/hub4j-test-org/teams/dummy-team/discussions/8", + "url": "/organizations/7544739/team/3451996/discussions/60", "method": "GET", "headers": { "Accept": { @@ -14,14 +14,14 @@ "status": 404, "body": "{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/teams/discussions/#get-a-single-discussion\"}", "headers": { - "Date": "Thu, 04 Jun 2020 16:17:24 GMT", + "Date": "Fri, 05 Jun 2020 23:08:33 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "404 Not Found", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4982", - "X-RateLimit-Reset": "1591291038", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "X-RateLimit-Remaining": "4734", + "X-RateLimit-Reset": "1591398936", + "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", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", @@ -31,10 +31,10 @@ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", "Content-Security-Policy": "default-src 'none'", "Vary": "Accept-Encoding, Accept, X-Requested-With", - "X-GitHub-Request-Id": "FAF6:C609:2662EB:2E852E:5ED91E94" + "X-GitHub-Request-Id": "CFF6:682B:A59666:C52342:5EDAD071" } }, - "uuid": "309b6527-6214-4d16-9322-1f45917e1251", + "uuid": "39105355-3f9f-4d78-b2ae-393a8b1ff2bc", "persistent": true, - "insertionIndex": 6 + "insertionIndex": 7 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org-2.json similarity index 64% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org-2.json index 274cd11375..1a23869b38 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-1.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org-2.json @@ -1,5 +1,5 @@ { - "id": "c9af335c-1f76-4548-bee5-06d9d165a0c8", + "id": "ee7942e4-237c-44df-b65f-0b7219e970eb", "name": "orgs_hub4j-test-org", "request": { "url": "/orgs/hub4j-test-org", @@ -12,24 +12,24 @@ }, "response": { "status": 200, - "bodyFileName": "orgs_hub4j-test-org-1.json", + "bodyFileName": "orgs_hub4j-test-org-2.json", "headers": { - "Date": "Thu, 04 Jun 2020 05:21:53 GMT", + "Date": "Fri, 05 Jun 2020 23:08:31 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4969", - "X-RateLimit-Reset": "1591249749", + "X-RateLimit-Remaining": "4739", + "X-RateLimit-Reset": "1591398936", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "W/\"85d9357381beb9e67471f6657732a1e3\"", - "Last-Modified": "Fri, 15 May 2020 15:14:14 GMT", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "ETag": "W/\"0557d9126fa25140eab7bdf16c451149\"", + "Last-Modified": "Thu, 04 Jun 2020 05:56:10 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", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", @@ -38,10 +38,10 @@ "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": "D969:2285A:ADDD4E:CE8715:5ED884F1" + "X-GitHub-Request-Id": "CFF6:682B:A595E7:C522A7:5EDAD06F" } }, - "uuid": "c9af335c-1f76-4548-bee5-06d9d165a0c8", + "uuid": "ee7942e4-237c-44df-b65f-0b7219e970eb", "persistent": true, - "insertionIndex": 1 + "insertionIndex": 2 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json similarity index 71% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json index 43465dcda4..87c099c313 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json @@ -1,5 +1,5 @@ { - "id": "0d1be07c-f1d0-4edb-9b3d-2ed1af106287", + "id": "8766e21f-974b-4048-bbb6-eb5faa935737", "name": "orgs_hub4j-test-org_teams_dummy-team", "request": { "url": "/orgs/hub4j-test-org/teams/dummy-team", @@ -12,24 +12,24 @@ }, "response": { "status": 200, - "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-2.json", + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-3.json", "headers": { - "Date": "Thu, 04 Jun 2020 16:17:19 GMT", + "Date": "Fri, 05 Jun 2020 23:08:32 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4998", - "X-RateLimit-Reset": "1591291039", + "X-RateLimit-Remaining": "4738", + "X-RateLimit-Reset": "1591398936", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "W/\"5b8a20b94c28536e4d7b9af6bd1a2f0a\"", + "ETag": "W/\"adf552e4a615c271e66b7d2bb00e61c4\"", "Last-Modified": "Tue, 02 Jun 2020 19:31:50 GMT", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "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", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", @@ -38,13 +38,13 @@ "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": "FAEC:41F9D:1D0749:2333C0:5ED91E8E" + "X-GitHub-Request-Id": "CFF6:682B:A595F8:C522C5:5EDAD06F" } }, - "uuid": "0d1be07c-f1d0-4edb-9b3d-2ed1af106287", + "uuid": "8766e21f-974b-4048-bbb6-eb5faa935737", "persistent": true, "scenarioName": "scenario-1-orgs-hub4j-test-org-teams-dummy-team", "requiredScenarioState": "Started", "newScenarioState": "scenario-1-orgs-hub4j-test-org-teams-dummy-team-2", - "insertionIndex": 2 + "insertionIndex": 3 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-6.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-6.json similarity index 74% rename from src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-6.json rename to src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-6.json index bc4ce74936..9a2d730aae 100644 --- a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-6.json +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-6.json @@ -1,5 +1,5 @@ { - "id": "1be6b364-bae0-4cc9-9507-66ea542c0c78", + "id": "0fd0e9bb-47b9-4526-b489-afc1afe25f42", "name": "orgs_hub4j-test-org_teams_dummy-team", "request": { "url": "/orgs/hub4j-test-org/teams/dummy-team", @@ -14,22 +14,22 @@ "status": 200, "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-6.json", "headers": { - "Date": "Thu, 04 Jun 2020 16:17:20 GMT", + "Date": "Fri, 05 Jun 2020 23:08:33 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4994", - "X-RateLimit-Reset": "1591291038", + "X-RateLimit-Remaining": "4735", + "X-RateLimit-Reset": "1591398936", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding, Accept, X-Requested-With", "Accept-Encoding" ], - "ETag": "W/\"5b8a20b94c28536e4d7b9af6bd1a2f0a\"", + "ETag": "W/\"adf552e4a615c271e66b7d2bb00e61c4\"", "Last-Modified": "Tue, 02 Jun 2020 19:31:50 GMT", - "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "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", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", @@ -38,10 +38,10 @@ "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": "FAEC:41F9D:1D08CB:2335A5:5ED91E90" + "X-GitHub-Request-Id": "CFF6:682B:A59655:C52324:5EDAD070" } }, - "uuid": "1be6b364-bae0-4cc9-9507-66ea542c0c78", + "uuid": "0fd0e9bb-47b9-4526-b489-afc1afe25f42", "persistent": true, "scenarioName": "scenario-1-orgs-hub4j-test-org-teams-dummy-team", "requiredScenarioState": "scenario-1-orgs-hub4j-test-org-teams-dummy-team-2", diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/user-1.json new file mode 100644 index 0000000000..1e39334417 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/user-1.json @@ -0,0 +1,47 @@ +{ + "id": "eb10af45-4001-4548-b1ed-1ea752b8d64f", + "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": "Fri, 05 Jun 2020 23:08:31 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4741", + "X-RateLimit-Reset": "1591398936", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"7e41c6c634de27b9ab8f4e95a42d16db\"", + "Last-Modified": "Fri, 29 May 2020 18:24:44 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", + "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": "CFF6:682B:A595C7:C52293:5EDAD06F" + } + }, + "uuid": "eb10af45-4001-4548-b1ed-1ea752b8d64f", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file From 1ad701fe5d6fe06ed071d017033b40eb5fb82815 Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Mon, 8 Jun 2020 09:56:53 -0700 Subject: [PATCH 31/34] Add convenience override of getId() --- .../java/org/kohsuke/github/GHDiscussion.java | 12 ++++++++++++ .../java/org/kohsuke/github/GHDiscussionTest.java | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHDiscussion.java b/src/main/java/org/kohsuke/github/GHDiscussion.java index 084bafd245..4476ffe2b3 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussion.java +++ b/src/main/java/org/kohsuke/github/GHDiscussion.java @@ -73,6 +73,18 @@ public long getNumber() { return number; } + /** + * The id number of this discussion. GitHub discussions have "number" instead of "id". This is provided for + * convenience. + * + * @return the id number for this discussion + * @see #getNumber() + */ + @Override + public long getId() { + return getNumber(); + } + /** * Whether the discussion is private to the team. * diff --git a/src/test/java/org/kohsuke/github/GHDiscussionTest.java b/src/test/java/org/kohsuke/github/GHDiscussionTest.java index de1d4b4a6f..7e1f9ca3c6 100644 --- a/src/test/java/org/kohsuke/github/GHDiscussionTest.java +++ b/src/test/java/org/kohsuke/github/GHDiscussionTest.java @@ -38,7 +38,7 @@ public void cleanupDiscussions() throws Exception { public void testCreatedDiscussion() throws IOException { GHDiscussion discussion = team.createDiscussion("Some Discussion").body("This is a public discussion").done(); assertThat(discussion, notNullValue()); - assertThat(discussion.getTeam(), notNullValue()); + assertThat(discussion.getTeam(), equalTo(team)); assertThat(discussion.getTitle(), equalTo("Some Discussion")); assertThat(discussion.getBody(), equalTo("This is a public discussion")); assertThat(discussion.isPrivate(), is(false)); @@ -48,6 +48,7 @@ public void testCreatedDiscussion() throws IOException { .private_(false) .done(); assertThat(discussion, notNullValue()); + assertThat(discussion.getTeam(), equalTo(team)); assertThat(discussion.getTitle(), equalTo("Some Discussion")); assertThat(discussion.getBody(), equalTo("This is another public discussion")); assertThat(discussion.isPrivate(), is(false)); @@ -57,6 +58,7 @@ public void testCreatedDiscussion() throws IOException { .private_(true) .done(); assertThat(discussion, notNullValue()); + assertThat(discussion.getTeam(), equalTo(team)); assertThat(discussion.getTitle(), equalTo("Some Discussion")); assertThat(discussion.getBody(), equalTo("This is a private (secret) discussion")); assertThat(discussion.isPrivate(), is(true)); @@ -76,7 +78,16 @@ public void testGetAndEditDiscussion() throws IOException { GHDiscussion created = team.createDiscussion("Some Discussion").body("This is a test discussion").done(); GHDiscussion discussion = team.getDiscussion(created.getNumber()); - assertThat(discussion.getTeam(), notNullValue()); + + // Test convenience getId() override + assertThat(discussion.getNumber(), equalTo(created.getId())); + assertThat(discussion.getTeam(), equalTo(team)); + assertThat(discussion.getTitle(), equalTo("Some Discussion")); + assertThat(discussion.getBody(), equalTo("This is a test discussion")); + assertThat(discussion.isPrivate(), is(false)); + + // Test equality + assertThat(discussion, equalTo(created)); discussion = discussion.set().body("This is a test discussion changed"); assertThat(discussion.getTeam(), notNullValue()); From 927d2799dc61f03e0d17aceae4504d25fac64727 Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Mon, 8 Jun 2020 10:12:15 -0700 Subject: [PATCH 32/34] Move url construction to single method --- .../java/org/kohsuke/github/GHDiscussion.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHDiscussion.java b/src/main/java/org/kohsuke/github/GHDiscussion.java index 4476ffe2b3..98f50db1f4 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussion.java +++ b/src/main/java/org/kohsuke/github/GHDiscussion.java @@ -2,11 +2,13 @@ import com.fasterxml.jackson.annotation.JacksonInject; import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.net.URL; import java.util.Objects; +import javax.annotation.CheckForNull; import javax.annotation.Nonnull; /** @@ -111,14 +113,14 @@ static GHDiscussion.Creator create(GHTeam team) throws IOException { static GHDiscussion read(GHTeam team, long discussionNumber) throws IOException { return team.root.createRequest() - .setRawUrlPath(team.getUrl().toString() + "/discussions/" + discussionNumber) + .setRawUrlPath(getRawUrlPath(team, discussionNumber)) .fetch(GHDiscussion.class) .wrapUp(team); } static PagedIterable readAll(GHTeam team) throws IOException { return team.root.createRequest() - .setRawUrlPath(team.getUrl().toString() + "/discussions") + .setRawUrlPath(getRawUrlPath(team, null)) .toIterable(GHDiscussion[].class, item -> item.wrapUp(team)); } @@ -153,10 +155,12 @@ public GHDiscussion.Setter set() { * the io exception */ public void delete() throws IOException { - team.root.createRequest() - .method("DELETE") - .setRawUrlPath(team.getUrl().toString() + "/discussions/" + number) - .send(); + team.root.createRequest().method("DELETE").setRawUrlPath(getRawUrlPath(team, number)).send(); + } + + @NotNull + private static String getRawUrlPath(@Nonnull GHTeam team, @CheckForNull Long discussionNumber) { + return team.getUrl().toString() + "/discussions" + (discussionNumber == null ? "" : "/" + discussionNumber); } /** @@ -192,7 +196,7 @@ public static class Creator extends GHDiscussionBuilder { private Creator(@Nonnull GHTeam team) { super(GHDiscussion.Creator.class, team, null); - requester.method("POST").withUrlPath(team.getUrl().toString() + "/discussions"); + requester.method("POST").setRawUrlPath(getRawUrlPath(team, null)); } @Nonnull From ed70fad8910acb63a38c79428f7e1830f05ff348 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Mon, 8 Jun 2020 20:23:10 +0200 Subject: [PATCH 33/34] Fix: Add missing @throws javadoc --- src/main/java/org/kohsuke/github/GHDiscussionBuilder.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java index 0a7686c4c0..b0d4a8e5d8 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java +++ b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java @@ -46,6 +46,8 @@ protected GHDiscussionBuilder(@Nonnull Class intermediateReturnType, * * @param value * title of discussion + * @throws IOException + * the io exception * @return either a continuing builder or an updated {@link GHDiscussion} */ @Nonnull @@ -58,7 +60,8 @@ public S title(String value) throws IOException { * * @param value * body of discussion - * + * @throws IOException + * the io exception * @return either a continuing builder or an updated {@link GHDiscussion} */ @Nonnull From 949bdaac220f599458ff084fac517d1352b50ec2 Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Mon, 8 Jun 2020 20:53:50 +0200 Subject: [PATCH 34/34] Fix: Improve testing coverage and add update operation --- .../org/kohsuke/github/GHDiscussionTest.java | 15 ++++++ ...ns_7544739_team_3451996_discussions-3.json | 38 +++++++++++++ ...7544739_team_3451996_discussions_65-4.json | 38 +++++++++++++ ...7544739_team_3451996_discussions_65-5.json | 38 +++++++++++++ .../__files/orgs_hub4j-test-org-1.json | 47 ++++++++++++++++ ...rgs_hub4j-test-org_teams_dummy-team-2.json | 49 +++++++++++++++++ ...ns_7544739_team_3451996_discussions-3.json | 54 +++++++++++++++++++ ...7544739_team_3451996_discussions_65-4.json | 53 ++++++++++++++++++ ...7544739_team_3451996_discussions_65-5.json | 53 ++++++++++++++++++ ...7544739_team_3451996_discussions_65-6.json | 47 ++++++++++++++++ .../mappings/orgs_hub4j-test-org-1.json | 47 ++++++++++++++++ ...rgs_hub4j-test-org_teams_dummy-team-2.json | 47 ++++++++++++++++ 12 files changed, 526 insertions(+) create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/organizations_7544739_team_3451996_discussions-3.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/organizations_7544739_team_3451996_discussions_65-4.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/organizations_7544739_team_3451996_discussions_65-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/orgs_hub4j-test-org-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-3.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/organizations_7544739_team_3451996_discussions_65-4.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/organizations_7544739_team_3451996_discussions_65-5.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/organizations_7544739_team_3451996_discussions_65-6.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/orgs_hub4j-test-org-1.json create mode 100644 src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json diff --git a/src/test/java/org/kohsuke/github/GHDiscussionTest.java b/src/test/java/org/kohsuke/github/GHDiscussionTest.java index 7e1f9ca3c6..a2a7c9f409 100644 --- a/src/test/java/org/kohsuke/github/GHDiscussionTest.java +++ b/src/test/java/org/kohsuke/github/GHDiscussionTest.java @@ -73,6 +73,21 @@ public void testCreatedDiscussion() throws IOException { } } + @Test + public void testUpdatedDiscussion() throws IOException { + GHDiscussion discussion = team.createDiscussion("Some Discussion").body("This is a public discussion").done(); + assertThat(discussion, notNullValue()); + assertThat(discussion.getTeam(), equalTo(team)); + assertThat(discussion.getTitle(), equalTo("Some Discussion")); + assertThat(discussion.getBody(), equalTo("This is a public discussion")); + assertThat(discussion.isPrivate(), is(false)); + + discussion.set().body("This is a public discussion changed"); + discussion.update(); + assertThat(discussion, notNullValue()); + assertThat(discussion.getBody(), equalTo("This is a public discussion changed")); + } + @Test public void testGetAndEditDiscussion() throws IOException { GHDiscussion created = team.createDiscussion("Some Discussion").body("This is a test discussion").done(); diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/organizations_7544739_team_3451996_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/organizations_7544739_team_3451996_discussions-3.json new file mode 100644 index 0000000000..d1c383c1d6 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/organizations_7544739_team_3451996_discussions-3.json @@ -0,0 +1,38 @@ +{ + "author": { + "login": "cmoulliard", + "id": 463790, + "node_id": "MDQ6VXNlcjQ2Mzc5MA==", + "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/cmoulliard", + "html_url": "https://github.com/cmoulliard", + "followers_url": "https://api.github.com/users/cmoulliard/followers", + "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", + "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", + "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", + "organizations_url": "https://api.github.com/users/cmoulliard/orgs", + "repos_url": "https://api.github.com/users/cmoulliard/repos", + "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", + "received_events_url": "https://api.github.com/users/cmoulliard/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a public discussion", + "body_html": "

This is a public discussion

", + "body_version": "d1ab9311f2fe800dcd6f9499163d5369", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/65/comments", + "created_at": "2020-06-08T18:49:50Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/65", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE4MzQ0", + "number": 65, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion", + "updated_at": "2020-06-08T18:49:50Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/65" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/organizations_7544739_team_3451996_discussions_65-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/organizations_7544739_team_3451996_discussions_65-4.json new file mode 100644 index 0000000000..5a89abb597 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/organizations_7544739_team_3451996_discussions_65-4.json @@ -0,0 +1,38 @@ +{ + "author": { + "login": "cmoulliard", + "id": 463790, + "node_id": "MDQ6VXNlcjQ2Mzc5MA==", + "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/cmoulliard", + "html_url": "https://github.com/cmoulliard", + "followers_url": "https://api.github.com/users/cmoulliard/followers", + "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", + "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", + "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", + "organizations_url": "https://api.github.com/users/cmoulliard/orgs", + "repos_url": "https://api.github.com/users/cmoulliard/repos", + "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", + "received_events_url": "https://api.github.com/users/cmoulliard/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a public discussion changed", + "body_html": "

This is a public discussion changed

", + "body_version": "bb899236a006b28024638af11754fd14", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/65/comments", + "created_at": "2020-06-08T18:49:50Z", + "last_edited_at": "2020-06-08T18:49:50Z", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/65", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE4MzQ0", + "number": 65, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion", + "updated_at": "2020-06-08T18:49:50Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/65" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/organizations_7544739_team_3451996_discussions_65-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/organizations_7544739_team_3451996_discussions_65-5.json new file mode 100644 index 0000000000..251b14eb10 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/organizations_7544739_team_3451996_discussions_65-5.json @@ -0,0 +1,38 @@ +{ + "author": { + "login": "cmoulliard", + "id": 463790, + "node_id": "MDQ6VXNlcjQ2Mzc5MA==", + "avatar_url": "https://avatars2.githubusercontent.com/u/463790?u=72ac82fbd1c321d0a749a85dae2373dc8f2012a4&v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/cmoulliard", + "html_url": "https://github.com/cmoulliard", + "followers_url": "https://api.github.com/users/cmoulliard/followers", + "following_url": "https://api.github.com/users/cmoulliard/following{/other_user}", + "gists_url": "https://api.github.com/users/cmoulliard/gists{/gist_id}", + "starred_url": "https://api.github.com/users/cmoulliard/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/cmoulliard/subscriptions", + "organizations_url": "https://api.github.com/users/cmoulliard/orgs", + "repos_url": "https://api.github.com/users/cmoulliard/repos", + "events_url": "https://api.github.com/users/cmoulliard/events{/privacy}", + "received_events_url": "https://api.github.com/users/cmoulliard/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a public discussion", + "body_html": "

This is a public discussion

", + "body_version": "d1ab9311f2fe800dcd6f9499163d5369", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/65/comments", + "created_at": "2020-06-08T18:49:50Z", + "last_edited_at": "2020-06-08T18:49:51Z", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/65", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE4MzQ0", + "number": 65, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some discussion changed", + "updated_at": "2020-06-08T18:49:51Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/65" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/orgs_hub4j-test-org-1.json new file mode 100644 index 0000000000..7121c693d7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/orgs_hub4j-test-org-1.json @@ -0,0 +1,47 @@ +{ + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 15, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 148, + "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": 10000, + "filled_seats": 18, + "seats": 3 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json new file mode 100644 index 0000000000..050225e208 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-2.json @@ -0,0 +1,49 @@ +{ + "name": "dummy-team", + "id": 3451996, + "node_id": "MDQ6VGVhbTM0NTE5OTY=", + "slug": "dummy-team", + "description": "Updated by API TestModified", + "privacy": "closed", + "url": "https://api.github.com/organizations/7544739/team/3451996", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team", + "members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", + "repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", + "permission": "pull", + "created_at": "2019-10-03T21:46:12Z", + "updated_at": "2020-06-02T19:31:50Z", + "members_count": 1, + "repos_count": 1, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/hub4j-test-org", + "repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", + "events_url": "https://api.github.com/orgs/hub4j-test-org/events", + "hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", + "issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", + "members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": "Hub4j Test Org Description (this could be null or blank too)", + "name": "Hub4j Test Org Name (this could be null or blank too)", + "company": null, + "blog": "https://hub4j.url.io/could/be/null", + "location": "Hub4j Test Org Location (this could be null or blank too)", + "email": "hub4jtestorgemail@could.be.null.com", + "twitter_username": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 15, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/hub4j-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2020-06-04T05:56:10Z", + "type": "Organization" + }, + "parent": null +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-3.json new file mode 100644 index 0000000000..78b85992d8 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-3.json @@ -0,0 +1,54 @@ +{ + "id": "afd7e836-3913-4b33-aa5f-fd1541e5d053", + "name": "organizations_7544739_team_3451996_discussions", + "request": { + "url": "/organizations/7544739/team/3451996/discussions", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Some Discussion\",\"body\":\"This is a public discussion\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "organizations_7544739_team_3451996_discussions-3.json", + "headers": { + "Date": "Mon, 08 Jun 2020 18:49:50 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1591643894", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "\"81f6bb51ec544525c5acf0c1c6ae3da6\"", + "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "write:discussion", + "Location": "https://api.github.com/organizations/7544739/team/3451996/discussions/65", + "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": "FD2C:32669:81214A0:9A9385C:5EDE884E" + } + }, + "uuid": "afd7e836-3913-4b33-aa5f-fd1541e5d053", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/organizations_7544739_team_3451996_discussions_65-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/organizations_7544739_team_3451996_discussions_65-4.json new file mode 100644 index 0000000000..1eeaf5ac3f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/organizations_7544739_team_3451996_discussions_65-4.json @@ -0,0 +1,53 @@ +{ + "id": "c73761df-972e-491a-91e8-dad842574e78", + "name": "organizations_7544739_team_3451996_discussions_65", + "request": { + "url": "/organizations/7544739/team/3451996/discussions/65", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Some Discussion\",\"body\":\"This is a public discussion changed\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "organizations_7544739_team_3451996_discussions_65-4.json", + "headers": { + "Date": "Mon, 08 Jun 2020 18:49:50 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1591643893", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"cf9264c9a7c75c4c703ed524e1eb158a\"", + "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "write:discussion", + "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": "FD2C:32669:8121537:9A93926:5EDE884E" + } + }, + "uuid": "c73761df-972e-491a-91e8-dad842574e78", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/organizations_7544739_team_3451996_discussions_65-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/organizations_7544739_team_3451996_discussions_65-5.json new file mode 100644 index 0000000000..b7e2b638c1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/organizations_7544739_team_3451996_discussions_65-5.json @@ -0,0 +1,53 @@ +{ + "id": "05f6d724-539e-49f1-8a52-9df4e170c044", + "name": "organizations_7544739_team_3451996_discussions_65", + "request": { + "url": "/organizations/7544739/team/3451996/discussions/65", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Some discussion changed\",\"body\":\"This is a public discussion\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "organizations_7544739_team_3451996_discussions_65-5.json", + "headers": { + "Date": "Mon, 08 Jun 2020 18:49:51 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4982", + "X-RateLimit-Reset": "1591643894", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"986e5cd291ce7f2c7dd479f371802b87\"", + "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "write:discussion", + "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": "FD2C:32669:81215E0:9A939EE:5EDE884E" + } + }, + "uuid": "05f6d724-539e-49f1-8a52-9df4e170c044", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/organizations_7544739_team_3451996_discussions_65-6.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/organizations_7544739_team_3451996_discussions_65-6.json new file mode 100644 index 0000000000..4bc1e6e81d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/organizations_7544739_team_3451996_discussions_65-6.json @@ -0,0 +1,47 @@ +{ + "id": "ece2031a-8f3b-4b6c-8a4f-5b8f16611f54", + "name": "organizations_7544739_team_3451996_discussions_65", + "request": { + "url": "/organizations/7544739/team/3451996/discussions/65", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Some discussion\",\"body\":\"This is a public discussion\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 404, + "body": "{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/teams/discussions/#edit-a-discussion\"}", + "headers": { + "Date": "Mon, 08 Jun 2020 18:50:49 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "404 Not Found", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4965", + "X-RateLimit-Reset": "1591643894", + "X-OAuth-Scopes": "admin:org, delete_repo, gist, notifications, repo, user, write:discussion", + "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'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "X-GitHub-Request-Id": "FD4A:E716:820DDE4:9BF173D:5EDE8889" + } + }, + "uuid": "ece2031a-8f3b-4b6c-8a4f-5b8f16611f54", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/orgs_hub4j-test-org-1.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/orgs_hub4j-test-org-1.json new file mode 100644 index 0000000000..75e962e910 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/orgs_hub4j-test-org-1.json @@ -0,0 +1,47 @@ +{ + "id": "1a9cd7a5-2eca-4871-b7a1-6e455f4a4590", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org-1.json", + "headers": { + "Date": "Mon, 08 Jun 2020 18:49:49 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4986", + "X-RateLimit-Reset": "1591643894", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"1a6a487ed52f9d847d59925e769484a5\"", + "Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT", + "X-OAuth-Scopes": "admin:org, 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", + "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": "FD2C:32669:81212E3:9A93660:5EDE884C" + } + }, + "uuid": "1a9cd7a5-2eca-4871-b7a1-6e455f4a4590", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json new file mode 100644 index 0000000000..ee5383695a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testUpdatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-2.json @@ -0,0 +1,47 @@ +{ + "id": "eac3064e-e33a-40e3-9562-3f0f249b8e33", + "name": "orgs_hub4j-test-org_teams_dummy-team", + "request": { + "url": "/orgs/hub4j-test-org/teams/dummy-team", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-2.json", + "headers": { + "Date": "Mon, 08 Jun 2020 18:49:50 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4985", + "X-RateLimit-Reset": "1591643894", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"5b8a20b94c28536e4d7b9af6bd1a2f0a\"", + "Last-Modified": "Tue, 02 Jun 2020 19:31:50 GMT", + "X-OAuth-Scopes": "admin:org, 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", + "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": "FD2C:32669:8121447:9A936AE:5EDE884D" + } + }, + "uuid": "eac3064e-e33a-40e3-9562-3f0f249b8e33", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file