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..c7fa814356 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHDiscussion.java @@ -0,0 +1,234 @@ +package org.kohsuke.github; + +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; + +/** + * A discussion in GitHub Team. + * + * @author Charles Moulliard + * @see GitHub Team Discussions + */ +public class GHDiscussion extends GHObject { + + @JacksonInject + private GitHub root; + private GHTeam team; + private long number; + private String body, title, htmlUrl; + + @JsonProperty(value = "private") + private boolean isPrivate; + + @Override + public URL getHtmlUrl() throws IOException { + return GitHubClient.parseURL(htmlUrl); + } + + GHDiscussion wrapUp(GHTeam team) { + this.team = team; + return this; + } + + /** + * Get the team to which this discussion belongs. + * + * @return the team for this discussion + */ + @Nonnull + public GHTeam getTeam() { + return team; + } + + /** + * 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; + } + + /** + * The number of this discussion. + * + * @return the number + */ + 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. + * + * @return {@code true} if discussion is private. + */ + public boolean isPrivate() { + return isPrivate; + } + + /** + * Begins the creation of a new instance. + * + * Consumer must call {@link GHDiscussion.Creator#done()} to commit changes. + * + * @param team + * the team in which the discussion will be created. + * @return a {@link GHLabel.Creator} + * @throws IOException + * the io exception + */ + 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(getRawUrlPath(team, discussionNumber)) + .fetch(GHDiscussion.class) + .wrapUp(team); + } + + static PagedIterable readAll(GHTeam team) throws IOException { + return team.root.createRequest() + .setRawUrlPath(getRawUrlPath(team, null)) + .toIterable(GHDiscussion[].class, item -> item.wrapUp(team)); + } + + /** + * Begins a batch update + * + * Consumer must call {@link GHDiscussion.Updater#done()} to commit changes. + * + * @return a {@link GHDiscussion.Updater} + */ + @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 + * + * @throws IOException + * the io exception + */ + public void delete() throws IOException { + 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); + } + + /** + * 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").setRawUrlPath(getRawUrlPath(team, null)); + } + + /** + * Sets whether this discussion is private to this team. + * + * @param value + * privacy of this discussion + * @return either a continuing builder or an updated {@link GHDiscussion} + * @throws IOException + * if there is an I/O Exception + */ + @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 new file mode 100644 index 0000000000..4492357570 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHDiscussionBuilder.java @@ -0,0 +1,80 @@ +package org.kohsuke.github; + +import java.io.IOException; + +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; + +/** + * Base class for creating or updating 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)}. + */ +class GHDiscussionBuilder extends AbstractBuilder { + + private final GHTeam team; + + /** + * + * @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); + + this.team = team; + + if (baseInstance != null) { + requester.with("title", baseInstance.getTitle()); + requester.with("body", baseInstance.getBody()); + } + } + + /** + * Title for this discussion. + * + * @param value + * title of discussion + * @return either a continuing builder or an updated {@link GHDiscussion} + * @throws IOException + * if there is an I/O Exception + */ + @Nonnull + public S title(String value) throws IOException { + return with("title", value); + } + + /** + * Body content for this discussion. + * + * @param value + * body of discussion* + * @return either a continuing builder or an updated {@link GHDiscussion} + * @throws IOException + * if there is an I/O Exception + */ + @Nonnull + public S body(String value) throws IOException { + return with("body", value); + } + + /** + * {@inheritDoc} + */ + @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 421c18bb06..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. * @@ -130,6 +133,36 @@ 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 + */ + @Nonnull + public PagedIterable listDiscussions() throws IOException { + return GHDiscussion.readAll(this); + } + + /** + * Gets a single discussion by ID. + * + * @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 + */ + @Nonnull + public GHDiscussion getDiscussion(long discussionNumber) throws IOException { + return GHDiscussion.read(this, discussionNumber); + } + /** * Retrieves the current members. * @@ -297,6 +330,21 @@ private String api(String tail) { return "/teams/" + getId() + tail; } + /** + * Begins the creation of a new instance. + * + * Consumer must call {@link GHDiscussion.Creator#done()} to commit changes. + * + * @param title + * title of the discussion to be created + * @return a {@link GHDiscussion.Creator} + * @throws IOException + * the io exception + */ + public GHDiscussion.Creator createDiscussion(String title) throws IOException { + return GHDiscussion.create(this).title(title); + } + /** * Gets organization. * @@ -318,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 new file mode 100644 index 0000000000..a0358ba4f9 --- /dev/null +++ b/src/test/java/org/kohsuke/github/GHDiscussionTest.java @@ -0,0 +1,145 @@ +package org.kohsuke.github; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Set; + +import static org.hamcrest.Matchers.*; + +/** + * @author Charles Moulliard + */ +public class GHDiscussionTest extends AbstractGitHubWireMockTest { + private final String TEAM_SLUG = "dummy-team"; + private GHTeam team; + + @Before + public void setUp() throws Exception { + 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 { + 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 = team.createDiscussion("Some Discussion") + .body("This is another public discussion") + .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)); + + discussion = team.createDiscussion("Some Discussion") + .body("This is a private (secret) discussion") + .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)); + + 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 { + GHDiscussion created = team.createDiscussion("Some Discussion").body("This is a test discussion").done(); + + GHDiscussion discussion = team.getDiscussion(created.getNumber()); + + // 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()); + + 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()); + + assertThat(discussion2, equalTo(discussion)); + assertThat(discussion2.getTitle(), equalTo("Title changed")); + assertThat(discussion2.getBody(), equalTo("This is a test discussion changed")); + + discussion = discussion.update().body("This is a test discussion updated").title("Title updated").done(); + + assertThat(discussion.getTeam(), notNullValue()); + assertThat(discussion.getTitle(), equalTo("Title updated")); + assertThat(discussion.getBody(), equalTo("This is a test discussion updated")); + + } + + @Test + public void testListDiscussion() throws IOException { + 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 { + GHDiscussion discussion = team.createDiscussion("Some Discussion").body("This is a test discussion").done(); + + assertThat(discussion.getTitle(), equalTo("Some Discussion")); + + discussion.delete(); + try { + gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamBySlug(TEAM_SLUG).getDiscussion(discussion.getNumber()); + fail(); + } catch (FileNotFoundException e) { + 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/testCreatedDiscussion/__files/orgs_hub4j-test-org-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-2.json new file mode 100644 index 0000000000..7121c693d7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org-2.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/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-3.json new file mode 100644 index 0000000000..050225e208 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-3.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/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/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json new file mode 100644 index 0000000000..6439dcfdc1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json @@ -0,0 +1,54 @@ +{ + "id": "e99eb2d0-5c5d-42f7-a883-546db75493e4", + "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-4.json", + "headers": { + "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": "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": "\"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/57", + "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:5492EF:64DB5E:5EDAD06C" + } + }, + "uuid": "e99eb2d0-5c5d-42f7-a883-546db75493e4", + "persistent": true, + "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/testCreatedDiscussion/mappings/orgs_hub4j-test-org-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-2.json new file mode 100644 index 0000000000..1df153dd3f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org-2.json @@ -0,0 +1,47 @@ +{ + "id": "98208c3a-6b4c-4b98-adb1-b063f7b2c7bf", + "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-2.json", + "headers": { + "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": "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/\"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", + "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:5492E0:64DB3F:5EDAD06B" + } + }, + "uuid": "98208c3a-6b4c-4b98-adb1-b063f7b2c7bf", + "persistent": true, + "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-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json new file mode 100644 index 0000000000..5877f4b020 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testCreatedDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json @@ -0,0 +1,47 @@ +{ + "id": "ab3d6c7f-c986-4aa1-abf6-14e27bd88ea5", + "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-3.json", + "headers": { + "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": "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/\"adf552e4a615c271e66b7d2bb00e61c4\"", + "Last-Modified": "Tue, 02 Jun 2020 19:31:50 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", + "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:5492E7:64DB52:5EDAD06C" + } + }, + "uuid": "ab3d6c7f-c986-4aa1-abf6-14e27bd88ea5", + "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..a5f1a7f6ca --- /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/64/comments", + "created_at": "2020-06-08T18:43:30Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/64", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE4MzQx", + "number": 64, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion", + "updated_at": "2020-06-08T18:43:30Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/64" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_64-10.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_64-10.json new file mode 100644 index 0000000000..ad2233b78a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_64-10.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 updated", + "body_html": "

This is a test discussion updated

", + "body_version": "64d46f79a6f4c3806511b2029154a508", + "comments_count": 0, + "comments_url": "https://api.github.com/organizations/7544739/team/3451996/discussions/64/comments", + "created_at": "2020-06-08T18:43:30Z", + "last_edited_at": "2020-06-08T18:43:33Z", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/64", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE4MzQx", + "number": 64, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Title updated", + "updated_at": "2020-06-08T18:43:33Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/64" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_64-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_64-5.json new file mode 100644 index 0000000000..a5f1a7f6ca --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_64-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/64/comments", + "created_at": "2020-06-08T18:43:30Z", + "last_edited_at": null, + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/64", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE4MzQx", + "number": 64, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion", + "updated_at": "2020-06-08T18:43:30Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/64" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_64-6.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_64-6.json new file mode 100644 index 0000000000..40c475ba2a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_64-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/64/comments", + "created_at": "2020-06-08T18:43:30Z", + "last_edited_at": "2020-06-08T18:43:31Z", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/64", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE4MzQx", + "number": 64, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Some Discussion", + "updated_at": "2020-06-08T18:43:31Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/64" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_64-7.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_64-7.json new file mode 100644 index 0000000000..a5e63c0bf1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_64-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/64/comments", + "created_at": "2020-06-08T18:43:30Z", + "last_edited_at": "2020-06-08T18:43:31Z", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/64", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE4MzQx", + "number": 64, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Title changed", + "updated_at": "2020-06-08T18:43:32Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/64" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_64-9.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_64-9.json new file mode 100644 index 0000000000..a5e63c0bf1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/organizations_7544739_team_3451996_discussions_64-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/64/comments", + "created_at": "2020-06-08T18:43:30Z", + "last_edited_at": "2020-06-08T18:43:31Z", + "html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team/discussions/64", + "node_id": "MDE0OlRlYW1EaXNjdXNzaW9uMTE4MzQx", + "number": 64, + "pinned": false, + "private": false, + "team_url": "https://api.github.com/organizations/7544739/team/3451996", + "title": "Title changed", + "updated_at": "2020-06-08T18:43:32Z", + "url": "https://api.github.com/organizations/7544739/team/3451996/discussions/64" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org-2.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-2.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-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-3.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-3.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-8.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-8.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-8.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/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/organizations_7544739_team_3451996_discussions-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json new file mode 100644 index 0000000000..d5fd7815e0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json @@ -0,0 +1,54 @@ +{ + "id": "d0d593b5-4fec-4e00-97cb-0be87dcf3a65", + "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 test discussion\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "organizations_7544739_team_3451996_discussions-4.json", + "headers": { + "Date": "Mon, 08 Jun 2020 18:43:31 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4957", + "X-RateLimit-Reset": "1591642578", + "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": "\"fa7ed609b5bcd7cbba13e22df861b688\"", + "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/64", + "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": "E996:682F:301CBD:39F052:5EDE86D2" + } + }, + "uuid": "d0d593b5-4fec-4e00-97cb-0be87dcf3a65", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_64-10.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_64-10.json new file mode 100644 index 0000000000..c89a96862d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_64-10.json @@ -0,0 +1,53 @@ +{ + "id": "8e2e62e2-56b6-469c-8f6a-77ba40fc9494", + "name": "organizations_7544739_team_3451996_discussions_64", + "request": { + "url": "/organizations/7544739/team/3451996/discussions/64", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Title updated\",\"body\":\"This is a test discussion updated\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "organizations_7544739_team_3451996_discussions_64-10.json", + "headers": { + "Date": "Mon, 08 Jun 2020 18:43:33 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4951", + "X-RateLimit-Reset": "1591642579", + "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/\"0e132309e9aca4393134aa70e222cef9\"", + "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'", + "X-GitHub-Request-Id": "E996:682F:301CD8:39F070:5EDE86D4" + } + }, + "uuid": "8e2e62e2-56b6-469c-8f6a-77ba40fc9494", + "persistent": true, + "insertionIndex": 10 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_64-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_64-5.json new file mode 100644 index 0000000000..d3a2ff4577 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_64-5.json @@ -0,0 +1,49 @@ +{ + "id": "188c7eef-a962-41af-81be-bb487e44add2", + "name": "organizations_7544739_team_3451996_discussions_64", + "request": { + "url": "/organizations/7544739/team/3451996/discussions/64", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "organizations_7544739_team_3451996_discussions_64-5.json", + "headers": { + "Date": "Mon, 08 Jun 2020 18:43:31 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4956", + "X-RateLimit-Reset": "1591642579", + "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/\"fa7ed609b5bcd7cbba13e22df861b688\"", + "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": "E996:682F:301CC2:39F057:5EDE86D3" + } + }, + "uuid": "188c7eef-a962-41af-81be-bb487e44add2", + "persistent": true, + "scenarioName": "scenario-2-organizations-7544739-team-3451996-discussions-64", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-2-organizations-7544739-team-3451996-discussions-64-2", + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_64-6.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_64-6.json new file mode 100644 index 0000000000..bac348874c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_64-6.json @@ -0,0 +1,53 @@ +{ + "id": "faec08a3-a746-45c3-ac33-52d830e37854", + "name": "organizations_7544739_team_3451996_discussions_64", + "request": { + "url": "/organizations/7544739/team/3451996/discussions/64", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Some Discussion\",\"body\":\"This is a test discussion changed\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "organizations_7544739_team_3451996_discussions_64-6.json", + "headers": { + "Date": "Mon, 08 Jun 2020 18:43:31 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4955", + "X-RateLimit-Reset": "1591642578", + "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/\"e8f61210b01e7faca044ff4ab01e37c7\"", + "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'", + "X-GitHub-Request-Id": "E996:682F:301CC5:39F05B:5EDE86D3" + } + }, + "uuid": "faec08a3-a746-45c3-ac33-52d830e37854", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_64-7.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_64-7.json new file mode 100644 index 0000000000..ac4113f6c3 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_64-7.json @@ -0,0 +1,53 @@ +{ + "id": "429533ef-462c-4582-a484-dadcc6c6200c", + "name": "organizations_7544739_team_3451996_discussions_64", + "request": { + "url": "/organizations/7544739/team/3451996/discussions/64", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"title\":\"Title changed\",\"body\":\"This is a test discussion changed\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "organizations_7544739_team_3451996_discussions_64-7.json", + "headers": { + "Date": "Mon, 08 Jun 2020 18:43:32 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4954", + "X-RateLimit-Reset": "1591642579", + "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/\"b6481a9983d068bb81f4e85ad321ddd7\"", + "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'", + "X-GitHub-Request-Id": "E996:682F:301CCD:39F063:5EDE86D3" + } + }, + "uuid": "429533ef-462c-4582-a484-dadcc6c6200c", + "persistent": true, + "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_64-9.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_64-9.json new file mode 100644 index 0000000000..6d4334ee19 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/organizations_7544739_team_3451996_discussions_64-9.json @@ -0,0 +1,48 @@ +{ + "id": "a257d38b-10a3-4d97-a891-8f0772867cfc", + "name": "organizations_7544739_team_3451996_discussions_64", + "request": { + "url": "/organizations/7544739/team/3451996/discussions/64", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "organizations_7544739_team_3451996_discussions_64-9.json", + "headers": { + "Date": "Mon, 08 Jun 2020 18:43:32 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4952", + "X-RateLimit-Reset": "1591642578", + "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/\"b6481a9983d068bb81f4e85ad321ddd7\"", + "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": "E996:682F:301CD4:39F06C:5EDE86D4" + } + }, + "uuid": "a257d38b-10a3-4d97-a891-8f0772867cfc", + "persistent": true, + "scenarioName": "scenario-2-organizations-7544739-team-3451996-discussions-64", + "requiredScenarioState": "scenario-2-organizations-7544739-team-3451996-discussions-64-2", + "insertionIndex": 9 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org-2.json new file mode 100644 index 0000000000..fb3435f2bb --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org-2.json @@ -0,0 +1,47 @@ +{ + "id": "bfb96aef-cd13-4870-8345-c2365a5a7feb", + "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-2.json", + "headers": { + "Date": "Mon, 08 Jun 2020 18:43:30 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4959", + "X-RateLimit-Reset": "1591642579", + "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/\"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", + "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": "E996:682F:301CB4:39F042:5EDE86D1" + } + }, + "uuid": "bfb96aef-cd13-4870-8345-c2365a5a7feb", + "persistent": true, + "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-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json new file mode 100644 index 0000000000..e43d864b1b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json @@ -0,0 +1,50 @@ +{ + "id": "9e604f25-f6e6-4a1a-992f-c9aa8bb6d325", + "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-3.json", + "headers": { + "Date": "Mon, 08 Jun 2020 18:43:30 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4958", + "X-RateLimit-Reset": "1591642579", + "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/\"adf552e4a615c271e66b7d2bb00e61c4\"", + "Last-Modified": "Tue, 02 Jun 2020 19:31:50 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", + "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": "E996:682F:301CB8:39F04B:5EDE86D2" + } + }, + "uuid": "9e604f25-f6e6-4a1a-992f-c9aa8bb6d325", + "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": 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-8.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-8.json new file mode 100644 index 0000000000..2961dfc3ae --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-8.json @@ -0,0 +1,49 @@ +{ + "id": "b0e9b0f2-422d-4dad-b1a6-1664b039b1f1", + "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-8.json", + "headers": { + "Date": "Mon, 08 Jun 2020 18:43:32 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4953", + "X-RateLimit-Reset": "1591642579", + "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/\"adf552e4a615c271e66b7d2bb00e61c4\"", + "Last-Modified": "Tue, 02 Jun 2020 19:31:50 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", + "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": "E996:682F:301CD2:39F069:5EDE86D4" + } + }, + "uuid": "b0e9b0f2-422d-4dad-b1a6-1664b039b1f1", + "persistent": true, + "scenarioName": "scenario-1-orgs-hub4j-test-org-teams-dummy-team", + "requiredScenarioState": "scenario-1-orgs-hub4j-test-org-teams-dummy-team-2", + "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..c909908406 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testGetAndEditDiscussion/mappings/user-1.json @@ -0,0 +1,47 @@ +{ + "id": "54a33589-feb1-45e9-b794-967a6d3f5f30", + "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": "Mon, 08 Jun 2020 18:43:29 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4961", + "X-RateLimit-Reset": "1591642578", + "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": "E996:682F:301CAE:39F040:5EDE86D1" + } + }, + "uuid": "54a33589-feb1-45e9-b794-967a6d3f5f30", + "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/testListDiscussion/__files/orgs_hub4j-test-org-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org-2.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-2.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-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-3.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-3.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/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/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-7.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-7.json new file mode 100644 index 0000000000..28d0ecf16f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/organizations_7544739_team_3451996_discussions-7.json @@ -0,0 +1,46 @@ +{ + "id": "2b24a93c-7d7e-481e-a3fd-681ff45d09e2", + "name": "organizations_7544739_team_3451996_discussions", + "request": { + "url": "/organizations/7544739/team/3451996/discussions", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "organizations_7544739_team_3451996_discussions-7.json", + "headers": { + "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": "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/\"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", + "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:1DBF9D:23C489:5EDAD073" + } + }, + "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/testListDiscussion/mappings/orgs_hub4j-test-org-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org-2.json new file mode 100644 index 0000000000..14999a54b0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org-2.json @@ -0,0 +1,47 @@ +{ + "id": "0deb7fe4-0390-4fff-a7b3-64ec28d47535", + "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-2.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": "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/\"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", + "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:1DBF8B:23C473:5EDAD072" + } + }, + "uuid": "0deb7fe4-0390-4fff-a7b3-64ec28d47535", + "persistent": true, + "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-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json new file mode 100644 index 0000000000..86a877374c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testListDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json @@ -0,0 +1,47 @@ +{ + "id": "772cba72-3cc0-4e06-8be0-7ad41530bca1", + "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-3.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": "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/\"adf552e4a615c271e66b7d2bb00e61c4\"", + "Last-Modified": "Tue, 02 Jun 2020 19:31:50 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", + "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:1DBF8F:23C479:5EDAD072" + } + }, + "uuid": "772cba72-3cc0-4e06-8be0-7ad41530bca1", + "persistent": true, + "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/testToDeleteDiscussion/__files/orgs_hub4j-test-org-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org-2.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-2.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-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__files/orgs_hub4j-test-org_teams_dummy-team-3.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-3.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-6.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/__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/testToDeleteDiscussion/__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/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/organizations_7544739_team_3451996_discussions-4.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json new file mode 100644 index 0000000000..c13761cbe9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions-4.json @@ -0,0 +1,54 @@ +{ + "id": "7f7b202f-1bee-458a-9fd5-1da36a9c7b85", + "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 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:32 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "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": "\"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/60", + "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:A5960A:C522DA:5EDAD070" + } + }, + "uuid": "7f7b202f-1bee-458a-9fd5-1da36a9c7b85", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions_60-5.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions_60-5.json new file mode 100644 index 0000000000..aeb30002ff --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions_60-5.json @@ -0,0 +1,41 @@ +{ + "id": "749f35ad-55e1-43b6-8748-1238ca7c01cb", + "name": "organizations_7544739_team_3451996_discussions_60", + "request": { + "url": "/organizations/7544739/team/3451996/discussions/60", + "method": "DELETE", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 204, + "headers": { + "Date": "Fri, 05 Jun 2020 23:08:32 GMT", + "Server": "GitHub.com", + "Status": "204 No Content", + "X-RateLimit-Limit": "5000", + "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", + "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": "CFF6:682B:A59634:C522FA:5EDAD070" + } + }, + "uuid": "749f35ad-55e1-43b6-8748-1238ca7c01cb", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions_60-7.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions_60-7.json new file mode 100644 index 0000000000..f93169f15e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/organizations_7544739_team_3451996_discussions_60-7.json @@ -0,0 +1,40 @@ +{ + "id": "39105355-3f9f-4d78-b2ae-393a8b1ff2bc", + "name": "organizations_7544739_team_3451996_discussions_60", + "request": { + "url": "/organizations/7544739/team/3451996/discussions/60", + "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": "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": "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", + "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": "CFF6:682B:A59666:C52342:5EDAD071" + } + }, + "uuid": "39105355-3f9f-4d78-b2ae-393a8b1ff2bc", + "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-2.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org-2.json new file mode 100644 index 0000000000..1a23869b38 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org-2.json @@ -0,0 +1,47 @@ +{ + "id": "ee7942e4-237c-44df-b65f-0b7219e970eb", + "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-2.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": "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/\"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", + "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:A595E7:C522A7:5EDAD06F" + } + }, + "uuid": "ee7942e4-237c-44df-b65f-0b7219e970eb", + "persistent": true, + "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-3.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json new file mode 100644 index 0000000000..87c099c313 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json @@ -0,0 +1,50 @@ +{ + "id": "8766e21f-974b-4048-bbb6-eb5faa935737", + "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-3.json", + "headers": { + "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": "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/\"adf552e4a615c271e66b7d2bb00e61c4\"", + "Last-Modified": "Tue, 02 Jun 2020 19:31:50 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", + "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:A595F8:C522C5:5EDAD06F" + } + }, + "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": 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-6.json b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-6.json new file mode 100644 index 0000000000..9a2d730aae --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHDiscussionTest/wiremock/testToDeleteDiscussion/mappings/orgs_hub4j-test-org_teams_dummy-team-6.json @@ -0,0 +1,49 @@ +{ + "id": "0fd0e9bb-47b9-4526-b489-afc1afe25f42", + "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": "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": "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/\"adf552e4a615c271e66b7d2bb00e61c4\"", + "Last-Modified": "Tue, 02 Jun 2020 19:31:50 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", + "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:A59655:C52324:5EDAD070" + } + }, + "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", + "insertionIndex": 6 +} \ No newline at end of file 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