diff --git a/src/main/java/org/kohsuke/github/GHContent.java b/src/main/java/org/kohsuke/github/GHContent.java index d6d9549b01..98d94da4ab 100644 --- a/src/main/java/org/kohsuke/github/GHContent.java +++ b/src/main/java/org/kohsuke/github/GHContent.java @@ -56,6 +56,34 @@ static String getApiRoute(GHRepository repository, String path) { public GHContent() { } + /** + * Creates a builder that can be used to delete this file. + * + *
+ * Unlike the {@link #delete(String)} convenience methods, this builder supports setting the author and committer of + * the resulting commit. + * + * @return a content deleter + * @see GHContentDeleter + */ + public GHContentDeleter createDelete() { + return new GHContentDeleter(this); + } + + /** + * Creates a builder that can be used to update this file's content. + * + *
+ * Unlike the {@link #update(String, String)} convenience methods, this builder supports setting the author and + * committer of the resulting commit. + * + * @return a content updater + * @see GHContentUpdater + */ + public GHContentUpdater createUpdate() { + return new GHContentUpdater(this); + } + /** * Delete gh content update response. * diff --git a/src/main/java/org/kohsuke/github/GHContentBuilder.java b/src/main/java/org/kohsuke/github/GHContentBuilder.java index 11a77ab1b8..3ae0e8a941 100644 --- a/src/main/java/org/kohsuke/github/GHContentBuilder.java +++ b/src/main/java/org/kohsuke/github/GHContentBuilder.java @@ -1,8 +1,13 @@ package org.kohsuke.github; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + import java.io.IOException; import java.nio.charset.StandardCharsets; +import java.time.Instant; import java.util.Base64; +import java.util.Date; // TODO: Auto-generated Javadoc /** @@ -15,6 +20,19 @@ * @see GHRepository#createContent() GHRepository#createContent() */ public final class GHContentBuilder { + @JsonInclude(Include.NON_NULL) + private static final class UserInfo { + private final String date; + private final String email; + private final String name; + + private UserInfo(String name, String email, Instant date) { + this.name = name; + this.email = email; + this.date = date != null ? GitHubClient.printInstant(date) : null; + } + } + private String path; private final GHRepository repo; private final Requester req; @@ -30,6 +48,52 @@ public final class GHContentBuilder { this.req = repo.root().createRequest().method("PUT"); } + /** + * Configures the author of the commit. If not specified, the authenticated user is used as the author. + * + * @param name + * the name of the author + * @param email + * the email of the author + * @return the gh content builder + */ + public GHContentBuilder author(String name, String email) { + return author(name, email, (Instant) null); + } + + /** + * Configures the author of the commit. If not specified, the authenticated user is used as the author. + * + * @param name + * the name of the author + * @param email + * the email of the author + * @param date + * the date of the authoring + * @return the gh content builder + * @deprecated use {@link #author(String, String, Instant)} instead + */ + @Deprecated + public GHContentBuilder author(String name, String email, Date date) { + return author(name, email, GitHubClient.toInstantOrNull(date)); + } + + /** + * Configures the author of the commit. If not specified, the authenticated user is used as the author. + * + * @param name + * the name of the author + * @param email + * the email of the author + * @param date + * the timestamp for the authoring + * @return the gh content builder + */ + public GHContentBuilder author(String name, String email, Instant date) { + req.with("author", new UserInfo(name, email, date)); + return this; + } + /** * Branch gh content builder. * @@ -59,6 +123,52 @@ public GHContentUpdateResponse commit() throws IOException { return response; } + /** + * Configures the committer of the commit. If not specified, the authenticated user is used as the committer. + * + * @param name + * the name of the committer + * @param email + * the email of the committer + * @return the gh content builder + */ + public GHContentBuilder committer(String name, String email) { + return committer(name, email, (Instant) null); + } + + /** + * Configures the committer of the commit. If not specified, the authenticated user is used as the committer. + * + * @param name + * the name of the committer + * @param email + * the email of the committer + * @param date + * the date of the commit + * @return the gh content builder + * @deprecated use {@link #committer(String, String, Instant)} instead + */ + @Deprecated + public GHContentBuilder committer(String name, String email, Date date) { + return committer(name, email, GitHubClient.toInstantOrNull(date)); + } + + /** + * Configures the committer of the commit. If not specified, the authenticated user is used as the committer. + * + * @param name + * the name of the committer + * @param email + * the email of the committer + * @param date + * the timestamp of the commit + * @return the gh content builder + */ + public GHContentBuilder committer(String name, String email, Instant date) { + req.with("committer", new UserInfo(name, email, date)); + return this; + } + /** * Content gh content builder. * diff --git a/src/main/java/org/kohsuke/github/GHContentDeleter.java b/src/main/java/org/kohsuke/github/GHContentDeleter.java new file mode 100644 index 0000000000..03d4c31e28 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHContentDeleter.java @@ -0,0 +1,177 @@ +package org.kohsuke.github; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +import java.io.IOException; +import java.time.Instant; +import java.util.Date; + +/** + * Builder for deleting repository content with support for specifying author and committer information. + * + *
+ * Obtain an instance via {@link GHContent#createDelete()}. + * + * @see GHContent#createDelete() + */ +public final class GHContentDeleter { + @JsonInclude(Include.NON_NULL) + private static final class UserInfo { + private final String date; + private final String email; + private final String name; + + private UserInfo(String name, String email, Instant date) { + this.name = name; + this.email = email; + this.date = date != null ? GitHubClient.printInstant(date) : null; + } + } + + private final GHContent content; + private final Requester req; + + GHContentDeleter(GHContent content) { + this.content = content; + final GHRepository repository = content.getOwner(); + this.req = repository.root() + .createRequest() + .method("DELETE") + .inBody() + .with("path", content.getPath()) + .with("sha", content.getSha()); + } + + /** + * Configures the author of the commit. If not specified, the authenticated user is used as the author. + * + * @param name + * the name of the author + * @param email + * the email of the author + * @return this deleter + */ + public GHContentDeleter author(String name, String email) { + return author(name, email, (Instant) null); + } + + /** + * Configures the author of the commit. If not specified, the authenticated user is used as the author. + * + * @param name + * the name of the author + * @param email + * the email of the author + * @param date + * the date of the authoring + * @return this deleter + * @deprecated use {@link #author(String, String, Instant)} instead + */ + @Deprecated + public GHContentDeleter author(String name, String email, Date date) { + return author(name, email, GitHubClient.toInstantOrNull(date)); + } + + /** + * Configures the author of the commit. If not specified, the authenticated user is used as the author. + * + * @param name + * the name of the author + * @param email + * the email of the author + * @param date + * the timestamp for the authoring + * @return this deleter + */ + public GHContentDeleter author(String name, String email, Instant date) { + req.with("author", new UserInfo(name, email, date)); + return this; + } + + /** + * Sets the branch to delete the content from. + * + * @param branch + * the branch name + * @return this deleter + */ + public GHContentDeleter branch(String branch) { + req.with("branch", branch); + return this; + } + + /** + * Commits the deletion. + * + * @return the response containing the commit information + * @throws IOException + * the io exception + */ + public GHContentUpdateResponse commit() throws IOException { + final GHRepository repository = content.getOwner(); + GHContentUpdateResponse response = req.withUrlPath(GHContent.getApiRoute(repository, content.getPath())) + .fetch(GHContentUpdateResponse.class); + + response.getCommit().wrapUp(repository); + return response; + } + + /** + * Configures the committer of the commit. If not specified, the authenticated user is used as the committer. + * + * @param name + * the name of the committer + * @param email + * the email of the committer + * @return this deleter + */ + public GHContentDeleter committer(String name, String email) { + return committer(name, email, (Instant) null); + } + + /** + * Configures the committer of the commit. If not specified, the authenticated user is used as the committer. + * + * @param name + * the name of the committer + * @param email + * the email of the committer + * @param date + * the date of the commit + * @return this deleter + * @deprecated use {@link #committer(String, String, Instant)} instead + */ + @Deprecated + public GHContentDeleter committer(String name, String email, Date date) { + return committer(name, email, GitHubClient.toInstantOrNull(date)); + } + + /** + * Configures the committer of the commit. If not specified, the authenticated user is used as the committer. + * + * @param name + * the name of the committer + * @param email + * the email of the committer + * @param date + * the timestamp of the commit + * @return this deleter + */ + public GHContentDeleter committer(String name, String email, Instant date) { + req.with("committer", new UserInfo(name, email, date)); + return this; + } + + /** + * Sets the commit message. + * + * @param message + * the commit message + * @return this deleter + */ + public GHContentDeleter message(String message) { + req.with("message", message); + return this; + } +} diff --git a/src/main/java/org/kohsuke/github/GHContentUpdater.java b/src/main/java/org/kohsuke/github/GHContentUpdater.java new file mode 100644 index 0000000000..41111af339 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHContentUpdater.java @@ -0,0 +1,205 @@ +package org.kohsuke.github; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.time.Instant; +import java.util.Base64; +import java.util.Date; + +/** + * Builder for updating existing repository content with support for specifying author and committer information. + * + *
+ * Obtain an instance via {@link GHContent#createUpdate()}. + * + * @see GHContent#createUpdate() + */ +public final class GHContentUpdater { + @JsonInclude(Include.NON_NULL) + private static final class UserInfo { + private final String date; + private final String email; + private final String name; + + private UserInfo(String name, String email, Instant date) { + this.name = name; + this.email = email; + this.date = date != null ? GitHubClient.printInstant(date) : null; + } + } + + private final GHContent content; + private String encodedContent; + private final Requester req; + + GHContentUpdater(GHContent content) { + this.content = content; + final GHRepository repository = content.getOwner(); + this.req = repository.root() + .createRequest() + .method("PUT") + .with("path", content.getPath()) + .with("sha", content.getSha()); + } + + /** + * Configures the author of the commit. If not specified, the authenticated user is used as the author. + * + * @param name + * the name of the author + * @param email + * the email of the author + * @return this updater + */ + public GHContentUpdater author(String name, String email) { + return author(name, email, (Instant) null); + } + + /** + * Configures the author of the commit. If not specified, the authenticated user is used as the author. + * + * @param name + * the name of the author + * @param email + * the email of the author + * @param date + * the date of the authoring + * @return this updater + * @deprecated use {@link #author(String, String, Instant)} instead + */ + @Deprecated + public GHContentUpdater author(String name, String email, Date date) { + return author(name, email, GitHubClient.toInstantOrNull(date)); + } + + /** + * Configures the author of the commit. If not specified, the authenticated user is used as the author. + * + * @param name + * the name of the author + * @param email + * the email of the author + * @param date + * the timestamp for the authoring + * @return this updater + */ + public GHContentUpdater author(String name, String email, Instant date) { + req.with("author", new UserInfo(name, email, date)); + return this; + } + + /** + * Sets the branch to update the content on. + * + * @param branch + * the branch name + * @return this updater + */ + public GHContentUpdater branch(String branch) { + req.with("branch", branch); + return this; + } + + /** + * Commits the update. + * + * @return the response containing the updated content and commit information + * @throws IOException + * the io exception + */ + public GHContentUpdateResponse commit() throws IOException { + final GHRepository repository = content.getOwner(); + GHContentUpdateResponse response = req.withUrlPath(GHContent.getApiRoute(repository, content.getPath())) + .fetch(GHContentUpdateResponse.class); + + response.getContent().wrap(repository); + response.getCommit().wrapUp(repository); + + return response; + } + + /** + * Configures the committer of the commit. If not specified, the authenticated user is used as the committer. + * + * @param name + * the name of the committer + * @param email + * the email of the committer + * @return this updater + */ + public GHContentUpdater committer(String name, String email) { + return committer(name, email, (Instant) null); + } + + /** + * Configures the committer of the commit. If not specified, the authenticated user is used as the committer. + * + * @param name + * the name of the committer + * @param email + * the email of the committer + * @param date + * the date of the commit + * @return this updater + * @deprecated use {@link #committer(String, String, Instant)} instead + */ + @Deprecated + public GHContentUpdater committer(String name, String email, Date date) { + return committer(name, email, GitHubClient.toInstantOrNull(date)); + } + + /** + * Configures the committer of the commit. If not specified, the authenticated user is used as the committer. + * + * @param name + * the name of the committer + * @param email + * the email of the committer + * @param date + * the timestamp of the commit + * @return this updater + */ + public GHContentUpdater committer(String name, String email, Instant date) { + req.with("committer", new UserInfo(name, email, date)); + return this; + } + + /** + * Sets the new file content as a string. + * + * @param newContent + * the new content + * @return this updater + */ + public GHContentUpdater content(String newContent) { + return content(newContent.getBytes(StandardCharsets.UTF_8)); + } + + /** + * Sets the new file content as raw bytes. + * + * @param newContent + * the new content bytes + * @return this updater + */ + public GHContentUpdater content(byte[] newContent) { + this.encodedContent = Base64.getEncoder().encodeToString(newContent); + req.with("content", encodedContent); + return this; + } + + /** + * Sets the commit message. + * + * @param message + * the commit message + * @return this updater + */ + public GHContentUpdater message(String message) { + req.with("message", message); + return this; + } +} diff --git a/src/main/resources/META-INF/native-image/org.kohsuke/github-api/reflect-config.json b/src/main/resources/META-INF/native-image/org.kohsuke/github-api/reflect-config.json index 30be262b74..828f94e8df 100644 --- a/src/main/resources/META-INF/native-image/org.kohsuke/github-api/reflect-config.json +++ b/src/main/resources/META-INF/native-image/org.kohsuke/github-api/reflect-config.json @@ -1844,6 +1844,51 @@ "allPublicClasses": true, "allDeclaredClasses": true }, + { + "name": "org.kohsuke.github.GHContentBuilder$UserInfo", + "allPublicFields": true, + "allDeclaredFields": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredConstructors": true, + "queryAllPublicMethods": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredMethods": true, + "allPublicClasses": true, + "allDeclaredClasses": true + }, + { + "name": "org.kohsuke.github.GHContentDeleter", + "allPublicFields": true, + "allDeclaredFields": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredConstructors": true, + "queryAllPublicMethods": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredMethods": true, + "allPublicClasses": true, + "allDeclaredClasses": true + }, + { + "name": "org.kohsuke.github.GHContentDeleter$UserInfo", + "allPublicFields": true, + "allDeclaredFields": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredConstructors": true, + "queryAllPublicMethods": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredMethods": true, + "allPublicClasses": true, + "allDeclaredClasses": true + }, { "name": "org.kohsuke.github.GHContentSearchBuilder", "allPublicFields": true, @@ -1889,6 +1934,36 @@ "allPublicClasses": true, "allDeclaredClasses": true }, + { + "name": "org.kohsuke.github.GHContentUpdater", + "allPublicFields": true, + "allDeclaredFields": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredConstructors": true, + "queryAllPublicMethods": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredMethods": true, + "allPublicClasses": true, + "allDeclaredClasses": true + }, + { + "name": "org.kohsuke.github.GHContentUpdater$UserInfo", + "allPublicFields": true, + "allDeclaredFields": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredConstructors": true, + "queryAllPublicMethods": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredMethods": true, + "allPublicClasses": true, + "allDeclaredClasses": true + }, { "name": "org.kohsuke.github.GHContentUpdateResponse", "allPublicFields": true, diff --git a/src/main/resources/META-INF/native-image/org.kohsuke/github-api/serialization-config.json b/src/main/resources/META-INF/native-image/org.kohsuke/github-api/serialization-config.json index 412aa47e18..7d1c3455b1 100644 --- a/src/main/resources/META-INF/native-image/org.kohsuke/github-api/serialization-config.json +++ b/src/main/resources/META-INF/native-image/org.kohsuke/github-api/serialization-config.json @@ -371,6 +371,15 @@ { "name": "org.kohsuke.github.GHContentBuilder" }, + { + "name": "org.kohsuke.github.GHContentBuilder$UserInfo" + }, + { + "name": "org.kohsuke.github.GHContentDeleter" + }, + { + "name": "org.kohsuke.github.GHContentDeleter$UserInfo" + }, { "name": "org.kohsuke.github.GHContentSearchBuilder" }, @@ -380,6 +389,12 @@ { "name": "org.kohsuke.github.GHContentSearchBuilder$Sort" }, + { + "name": "org.kohsuke.github.GHContentUpdater" + }, + { + "name": "org.kohsuke.github.GHContentUpdater$UserInfo" + }, { "name": "org.kohsuke.github.GHContentUpdateResponse" }, diff --git a/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java b/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java index 7c60131669..aedc43b6c5 100644 --- a/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java +++ b/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java @@ -9,6 +9,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; +import java.util.Date; import java.util.List; import static org.hamcrest.Matchers.*; @@ -145,6 +146,60 @@ public void testCRUDContent() throws Exception { } } + /** + * Test creating content with custom author and committer via GHContentBuilder. + * + * @throws Exception + * the exception + */ + @SuppressWarnings("deprecation") + @Test + public void testCreateWithAuthorCommitter() throws Exception { + GHRepository ghRepository = getTempRepository(); + GHContentUpdateResponse response = ghRepository.createContent() + .message("Creating with custom author and committer") + .path("author-committer-test.md") + .content("test content\n") + .author("John Doe", "john@example.com") + .author("John Doe", "john@example.com", new Date(1234567890000L)) + .committer("Service Account", "service@example.com") + .committer("Service Account", "service@example.com", new Date(1234567890000L)) + .commit(); + + assertThat(response.getContent(), notNullValue()); + assertThat(response.getCommit(), notNullValue()); + assertThat(response.getCommit().getAuthor().getName(), equalTo("John Doe")); + assertThat(response.getCommit().getAuthor().getEmail(), equalTo("john@example.com")); + assertThat(response.getCommit().getCommitter().getName(), equalTo("Service Account")); + assertThat(response.getCommit().getCommitter().getEmail(), equalTo("service@example.com")); + } + + /** + * Test deleting content with custom author and committer via GHContentDeleter. + * + * @throws Exception + * the exception + */ + @SuppressWarnings("deprecation") + @Test + public void testDeleteWithAuthorCommitter() throws Exception { + GHContent content = repo.getFileContent("ghcontent-ro/a-file-with-content"); + GHContentUpdateResponse response = content.createDelete() + .message("Deleting with custom author and committer") + .branch("main") + .author("John Doe", "john@example.com") + .author("John Doe", "john@example.com", new Date(1234567890000L)) + .committer("Service Account", "service@example.com") + .committer("Service Account", "service@example.com", new Date(1234567890000L)) + .commit(); + + assertThat(response.getCommit(), notNullValue()); + assertThat(response.getCommit().getAuthor().getName(), equalTo("John Doe")); + assertThat(response.getCommit().getAuthor().getEmail(), equalTo("john@example.com")); + assertThat(response.getCommit().getCommitter().getName(), equalTo("Service Account")); + assertThat(response.getCommit().getCommitter().getEmail(), equalTo("service@example.com")); + } + /** * Test get directory content. * @@ -320,6 +375,34 @@ public void testMIMESmall() throws IOException { ghContentBuilder.commit(); } + /** + * Test updating content with custom author and committer via GHContentUpdater. + * + * @throws Exception + * the exception + */ + @SuppressWarnings("deprecation") + @Test + public void testUpdateWithAuthorCommitter() throws Exception { + GHContent content = repo.getFileContent("ghcontent-ro/a-file-with-content"); + GHContentUpdateResponse response = content.createUpdate() + .content("updated content\n") + .message("Updating with custom author and committer") + .branch("main") + .author("John Doe", "john@example.com") + .author("John Doe", "john@example.com", new Date(1234567890000L)) + .committer("Service Account", "service@example.com") + .committer("Service Account", "service@example.com", new Date(1234567890000L)) + .commit(); + + assertThat(response.getContent(), notNullValue()); + assertThat(response.getCommit(), notNullValue()); + assertThat(response.getCommit().getAuthor().getName(), equalTo("John Doe")); + assertThat(response.getCommit().getAuthor().getEmail(), equalTo("john@example.com")); + assertThat(response.getCommit().getCommitter().getName(), equalTo("Service Account")); + assertThat(response.getCommit().getCommitter().getEmail(), equalTo("service@example.com")); + } + /** * Check basic commit info. * diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/__files/1-user.json new file mode 100644 index 0000000000..98e8c76ba2 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/__files/1-user.json @@ -0,0 +1,45 @@ +{ + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": "https://twitter.com/bitwiseman", + "public_repos": 178, + "public_gists": 7, + "followers": 144, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2019-12-18T01:26:55Z", + "private_gists": 7, + "total_private_repos": 10, + "owned_private_repos": 0, + "disk_usage": 33697, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/__files/2-r_h_ghcontentintegrationtest.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/__files/2-r_h_ghcontentintegrationtest.json new file mode 100644 index 0000000000..68e3d4f428 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/__files/2-r_h_ghcontentintegrationtest.json @@ -0,0 +1,313 @@ +{ + "id": 40763577, + "node_id": "MDEwOlJlcG9zaXRvcnk0MDc2MzU3Nw==", + "name": "GHContentIntegrationTest", + "full_name": "hub4j-test-org/GHContentIntegrationTest", + "private": false, + "owner": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest", + "description": "Repository used for integration test of github-api", + "fork": true, + "url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest", + "forks_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/deployments", + "created_at": "2015-08-15T14:14:57Z", + "updated_at": "2019-11-26T01:09:49Z", + "pushed_at": "2019-11-26T01:09:48Z", + "git_url": "git://github.com/hub4j-test-org/GHContentIntegrationTest.git", + "ssh_url": "git@github.com:hub4j-test-org/GHContentIntegrationTest.git", + "clone_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest.git", + "svn_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest", + "homepage": null, + "size": 52, + "stargazers_count": 1, + "watchers_count": 1, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 41, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 41, + "open_issues": 0, + "watchers": 1, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "temp_clone_token": "", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "parent": { + "id": 19653852, + "node_id": "MDEwOlJlcG9zaXRvcnkxOTY1Mzg1Mg==", + "name": "GHContentIntegrationTest", + "full_name": "kohsuke2/GHContentIntegrationTest", + "private": false, + "owner": { + "login": "kohsuke2", + "id": 1329242, + "node_id": "MDQ6VXNlcjEzMjkyNDI=", + "avatar_url": "https://avatars2.githubusercontent.com/u/1329242?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke2", + "html_url": "https://github.com/kohsuke2", + "followers_url": "https://api.github.com/users/kohsuke2/followers", + "following_url": "https://api.github.com/users/kohsuke2/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke2/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke2/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke2/orgs", + "repos_url": "https://api.github.com/users/kohsuke2/repos", + "events_url": "https://api.github.com/users/kohsuke2/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke2/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/kohsuke2/GHContentIntegrationTest", + "description": "Repository used for integration test of github-api", + "fork": true, + "url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest", + "forks_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/forks", + "keys_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/teams", + "hooks_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/hooks", + "issue_events_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/issues/events{/number}", + "events_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/events", + "assignees_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/assignees{/user}", + "branches_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/branches{/branch}", + "tags_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/tags", + "blobs_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/languages", + "stargazers_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/stargazers", + "contributors_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/contributors", + "subscribers_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/subscribers", + "subscription_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/subscription", + "commits_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/contents/{+path}", + "compare_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/merges", + "archive_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/downloads", + "issues_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/issues{/number}", + "pulls_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/labels{/name}", + "releases_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/releases{/id}", + "deployments_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/deployments", + "created_at": "2014-05-10T22:50:30Z", + "updated_at": "2018-11-07T15:36:19Z", + "pushed_at": "2018-11-07T15:36:18Z", + "git_url": "git://github.com/kohsuke2/GHContentIntegrationTest.git", + "ssh_url": "git@github.com:kohsuke2/GHContentIntegrationTest.git", + "clone_url": "https://github.com/kohsuke2/GHContentIntegrationTest.git", + "svn_url": "https://github.com/kohsuke2/GHContentIntegrationTest", + "homepage": null, + "size": 111, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 1, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 1, + "open_issues": 0, + "watchers": 0, + "default_branch": "main" + }, + "source": { + "id": 14779458, + "node_id": "MDEwOlJlcG9zaXRvcnkxNDc3OTQ1OA==", + "name": "github-api-test-1", + "full_name": "farmdawgnation/github-api-test-1", + "private": false, + "owner": { + "login": "farmdawgnation", + "id": 620189, + "node_id": "MDQ6VXNlcjYyMDE4OQ==", + "avatar_url": "https://avatars2.githubusercontent.com/u/620189?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/farmdawgnation", + "html_url": "https://github.com/farmdawgnation", + "followers_url": "https://api.github.com/users/farmdawgnation/followers", + "following_url": "https://api.github.com/users/farmdawgnation/following{/other_user}", + "gists_url": "https://api.github.com/users/farmdawgnation/gists{/gist_id}", + "starred_url": "https://api.github.com/users/farmdawgnation/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/farmdawgnation/subscriptions", + "organizations_url": "https://api.github.com/users/farmdawgnation/orgs", + "repos_url": "https://api.github.com/users/farmdawgnation/repos", + "events_url": "https://api.github.com/users/farmdawgnation/events{/privacy}", + "received_events_url": "https://api.github.com/users/farmdawgnation/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/farmdawgnation/github-api-test-1", + "description": "Repository used for integration test of github-api", + "fork": false, + "url": "https://api.github.com/repos/farmdawgnation/github-api-test-1", + "forks_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/forks", + "keys_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/teams", + "hooks_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/hooks", + "issue_events_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/issues/events{/number}", + "events_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/events", + "assignees_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/assignees{/user}", + "branches_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/branches{/branch}", + "tags_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/tags", + "blobs_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/statuses/{sha}", + "languages_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/languages", + "stargazers_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/stargazers", + "contributors_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/contributors", + "subscribers_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/subscribers", + "subscription_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/subscription", + "commits_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/contents/{+path}", + "compare_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/merges", + "archive_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/downloads", + "issues_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/issues{/number}", + "pulls_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/pulls{/number}", + "milestones_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/milestones{/number}", + "notifications_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/labels{/name}", + "releases_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/releases{/id}", + "deployments_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/deployments", + "created_at": "2013-11-28T14:46:38Z", + "updated_at": "2016-02-05T13:33:23Z", + "pushed_at": "2013-11-28T14:55:36Z", + "git_url": "git://github.com/farmdawgnation/github-api-test-1.git", + "ssh_url": "git@github.com:farmdawgnation/github-api-test-1.git", + "clone_url": "https://github.com/farmdawgnation/github-api-test-1.git", + "svn_url": "https://github.com/farmdawgnation/github-api-test-1", + "homepage": null, + "size": 89, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 60, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 60, + "open_issues": 0, + "watchers": 0, + "default_branch": "main" + }, + "network_count": 60, + "subscribers_count": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/__files/3-r_h_temp-testCreateWithAuthorCommitter.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/__files/3-r_h_temp-testCreateWithAuthorCommitter.json new file mode 100644 index 0000000000..afa1408145 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/__files/3-r_h_temp-testCreateWithAuthorCommitter.json @@ -0,0 +1,71 @@ +{ + "id": 999000001, + "node_id": "MDEwOlJlcG9zaXRvcnk5OTkwMDAwMDE=", + "name": "temp-testCreateWithAuthorCommitter", + "full_name": "hub4j-test-org/temp-testCreateWithAuthorCommitter", + "private": false, + "owner": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j-test-org/temp-testCreateWithAuthorCommitter", + "description": "A test repository for testing the github-api project: temp-testCreateWithAuthorCommitter", + "fork": false, + "url": "https://api.github.com/repos/hub4j-test-org/temp-testCreateWithAuthorCommitter", + "contents_url": "https://api.github.com/repos/hub4j-test-org/temp-testCreateWithAuthorCommitter/contents/{+path}", + "created_at": "2024-01-01T00:00:00Z", + "updated_at": "2024-01-01T00:00:00Z", + "pushed_at": "2024-01-01T00:00:00Z", + "git_url": "git://github.com/hub4j-test-org/temp-testCreateWithAuthorCommitter.git", + "ssh_url": "git@github.com:hub4j-test-org/temp-testCreateWithAuthorCommitter.git", + "clone_url": "https://github.com/hub4j-test-org/temp-testCreateWithAuthorCommitter.git", + "svn_url": "https://github.com/hub4j-test-org/temp-testCreateWithAuthorCommitter", + "homepage": "http://github-api.kohsuke.org/", + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "type": "Organization", + "site_admin": false + }, + "network_count": 0, + "subscribers_count": 1 +} diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/__files/4-r_h_t_contents_author-committer-testmd.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/__files/4-r_h_t_contents_author-committer-testmd.json new file mode 100644 index 0000000000..d062b7b019 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/__files/4-r_h_t_contents_author-committer-testmd.json @@ -0,0 +1,52 @@ +{ + "content": { + "name": "author-committer-test.md", + "path": "author-committer-test.md", + "sha": "aabbccdd11223344556677889900aabbccddeeff", + "size": 13, + "url": "https://api.github.com/repos/hub4j-test-org/temp-testCreateWithAuthorCommitter/contents/author-committer-test.md?ref=main", + "html_url": "https://github.com/hub4j-test-org/temp-testCreateWithAuthorCommitter/blob/main/author-committer-test.md", + "git_url": "https://api.github.com/repos/hub4j-test-org/temp-testCreateWithAuthorCommitter/git/blobs/aabbccdd11223344556677889900aabbccddeeff", + "download_url": "https://raw.githubusercontent.com/hub4j-test-org/temp-testCreateWithAuthorCommitter/main/author-committer-test.md", + "type": "file", + "_links": { + "self": "https://api.github.com/repos/hub4j-test-org/temp-testCreateWithAuthorCommitter/contents/author-committer-test.md?ref=main", + "git": "https://api.github.com/repos/hub4j-test-org/temp-testCreateWithAuthorCommitter/git/blobs/aabbccdd11223344556677889900aabbccddeeff", + "html": "https://github.com/hub4j-test-org/temp-testCreateWithAuthorCommitter/blob/main/author-committer-test.md" + } + }, + "commit": { + "sha": "1122334455667788990011223344556677889900", + "node_id": "MDY6Q29tbWl0OTk5MDAwMDAxOjExMjIzMzQ0NTU2Njc3ODg5OTAwMTEyMjMzNDQ1NTY2Nzc4ODk5MDA=", + "url": "https://api.github.com/repos/hub4j-test-org/temp-testCreateWithAuthorCommitter/git/commits/1122334455667788990011223344556677889900", + "html_url": "https://github.com/hub4j-test-org/temp-testCreateWithAuthorCommitter/commit/1122334455667788990011223344556677889900", + "author": { + "name": "John Doe", + "email": "john@example.com", + "date": "2024-01-01T00:00:00Z" + }, + "committer": { + "name": "Service Account", + "email": "service@example.com", + "date": "2024-01-01T00:00:00Z" + }, + "tree": { + "sha": "aabb00112233445566778899aabb00112233ccdd", + "url": "https://api.github.com/repos/hub4j-test-org/temp-testCreateWithAuthorCommitter/git/trees/aabb00112233445566778899aabb00112233ccdd" + }, + "message": "Creating with custom author and committer", + "parents": [ + { + "sha": "0000111122223333444455556666777788889999", + "url": "https://api.github.com/repos/hub4j-test-org/temp-testCreateWithAuthorCommitter/git/commits/0000111122223333444455556666777788889999", + "html_url": "https://github.com/hub4j-test-org/temp-testCreateWithAuthorCommitter/commit/0000111122223333444455556666777788889999" + } + ], + "verification": { + "verified": false, + "reason": "unsigned", + "signature": null, + "payload": null + } + } +} diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/mappings/1-user.json new file mode 100644 index 0000000000..867e80d5f8 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/mappings/1-user.json @@ -0,0 +1,48 @@ +{ + "id": "b9d02cd3-311a-4d49-8de8-aa4220400616", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Sat, 21 Dec 2019 03:41:23 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4985", + "X-RateLimit-Reset": "1576903221", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"be4370b3c906450f450e411f567ee839\"", + "Last-Modified": "Wed, 18 Dec 2019 01:26:55 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "C977:4ACE:948C05:B32660:5DFD9463" + } + }, + "uuid": "b9d02cd3-311a-4d49-8de8-aa4220400616", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/mappings/2-r_h_ghcontentintegrationtest.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/mappings/2-r_h_ghcontentintegrationtest.json new file mode 100644 index 0000000000..a96af5128d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/mappings/2-r_h_ghcontentintegrationtest.json @@ -0,0 +1,48 @@ +{ + "id": "f60bd9fd-10cc-4488-b2ce-b618cac83ae2", + "name": "repos_hub4j-test-org_ghcontentintegrationtest", + "request": { + "url": "/repos/hub4j-test-org/GHContentIntegrationTest", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-r_h_ghcontentintegrationtest.json", + "headers": { + "Date": "Sat, 21 Dec 2019 03:41:25 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4981", + "X-RateLimit-Reset": "1576903221", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"1e430d4199aa33f3d4673fee6fee2709\"", + "Last-Modified": "Tue, 26 Nov 2019 01:09:49 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "C977:4ACE:948C3A:B32669:5DFD9463" + } + }, + "uuid": "f60bd9fd-10cc-4488-b2ce-b618cac83ae2", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/mappings/3-r_h_temp-testCreateWithAuthorCommitter.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/mappings/3-r_h_temp-testCreateWithAuthorCommitter.json new file mode 100644 index 0000000000..3786f6f96f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/mappings/3-r_h_temp-testCreateWithAuthorCommitter.json @@ -0,0 +1,24 @@ +{ + "id": "a1b2c3d4-e5f6-7890-abcd-100000000001", + "name": "repos_hub4j-test-org_temp-testCreateWithAuthorCommitter", + "request": { + "url": "/repos/hub4j-test-org/temp-testCreateWithAuthorCommitter", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-r_h_temp-testCreateWithAuthorCommitter.json", + "headers": { + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK" + } + }, + "uuid": "a1b2c3d4-e5f6-7890-abcd-100000000001", + "persistent": true, + "insertionIndex": 3 +} diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/mappings/4-r_h_t_contents_author-committer-testmd.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/mappings/4-r_h_t_contents_author-committer-testmd.json new file mode 100644 index 0000000000..742e897d17 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testCreateWithAuthorCommitter/mappings/4-r_h_t_contents_author-committer-testmd.json @@ -0,0 +1,31 @@ +{ + "id": "a1b2c3d4-e5f6-7890-abcd-100000000002", + "name": "repos_hub4j-test-org_temp-testCreateWithAuthorCommitter_contents_author-committer-testmd", + "request": { + "url": "/repos/hub4j-test-org/temp-testCreateWithAuthorCommitter/contents/author-committer-test.md", + "method": "PUT", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"path\":\"author-committer-test.md\",\"message\":\"Creating with custom author and committer\",\"content\":\"dGVzdCBjb250ZW50Cg==\",\"author\":{\"name\":\"John Doe\",\"email\":\"john@example.com\",\"date\":\"2009-02-13T23:31:30Z\"},\"committer\":{\"name\":\"Service Account\",\"email\":\"service@example.com\",\"date\":\"2009-02-13T23:31:30Z\"}}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "4-r_h_t_contents_author-committer-testmd.json", + "headers": { + "Content-Type": "application/json; charset=utf-8", + "Status": "201 Created" + } + }, + "uuid": "a1b2c3d4-e5f6-7890-abcd-100000000002", + "persistent": true, + "insertionIndex": 4 +} diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/__files/1-user.json new file mode 100644 index 0000000000..98e8c76ba2 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/__files/1-user.json @@ -0,0 +1,45 @@ +{ + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": "https://twitter.com/bitwiseman", + "public_repos": 178, + "public_gists": 7, + "followers": 144, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2019-12-18T01:26:55Z", + "private_gists": 7, + "total_private_repos": 10, + "owned_private_repos": 0, + "disk_usage": 33697, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/__files/2-r_h_ghcontentintegrationtest.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/__files/2-r_h_ghcontentintegrationtest.json new file mode 100644 index 0000000000..68e3d4f428 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/__files/2-r_h_ghcontentintegrationtest.json @@ -0,0 +1,313 @@ +{ + "id": 40763577, + "node_id": "MDEwOlJlcG9zaXRvcnk0MDc2MzU3Nw==", + "name": "GHContentIntegrationTest", + "full_name": "hub4j-test-org/GHContentIntegrationTest", + "private": false, + "owner": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest", + "description": "Repository used for integration test of github-api", + "fork": true, + "url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest", + "forks_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/deployments", + "created_at": "2015-08-15T14:14:57Z", + "updated_at": "2019-11-26T01:09:49Z", + "pushed_at": "2019-11-26T01:09:48Z", + "git_url": "git://github.com/hub4j-test-org/GHContentIntegrationTest.git", + "ssh_url": "git@github.com:hub4j-test-org/GHContentIntegrationTest.git", + "clone_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest.git", + "svn_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest", + "homepage": null, + "size": 52, + "stargazers_count": 1, + "watchers_count": 1, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 41, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 41, + "open_issues": 0, + "watchers": 1, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "temp_clone_token": "", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "parent": { + "id": 19653852, + "node_id": "MDEwOlJlcG9zaXRvcnkxOTY1Mzg1Mg==", + "name": "GHContentIntegrationTest", + "full_name": "kohsuke2/GHContentIntegrationTest", + "private": false, + "owner": { + "login": "kohsuke2", + "id": 1329242, + "node_id": "MDQ6VXNlcjEzMjkyNDI=", + "avatar_url": "https://avatars2.githubusercontent.com/u/1329242?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke2", + "html_url": "https://github.com/kohsuke2", + "followers_url": "https://api.github.com/users/kohsuke2/followers", + "following_url": "https://api.github.com/users/kohsuke2/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke2/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke2/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke2/orgs", + "repos_url": "https://api.github.com/users/kohsuke2/repos", + "events_url": "https://api.github.com/users/kohsuke2/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke2/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/kohsuke2/GHContentIntegrationTest", + "description": "Repository used for integration test of github-api", + "fork": true, + "url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest", + "forks_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/forks", + "keys_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/teams", + "hooks_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/hooks", + "issue_events_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/issues/events{/number}", + "events_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/events", + "assignees_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/assignees{/user}", + "branches_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/branches{/branch}", + "tags_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/tags", + "blobs_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/languages", + "stargazers_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/stargazers", + "contributors_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/contributors", + "subscribers_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/subscribers", + "subscription_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/subscription", + "commits_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/contents/{+path}", + "compare_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/merges", + "archive_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/downloads", + "issues_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/issues{/number}", + "pulls_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/labels{/name}", + "releases_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/releases{/id}", + "deployments_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/deployments", + "created_at": "2014-05-10T22:50:30Z", + "updated_at": "2018-11-07T15:36:19Z", + "pushed_at": "2018-11-07T15:36:18Z", + "git_url": "git://github.com/kohsuke2/GHContentIntegrationTest.git", + "ssh_url": "git@github.com:kohsuke2/GHContentIntegrationTest.git", + "clone_url": "https://github.com/kohsuke2/GHContentIntegrationTest.git", + "svn_url": "https://github.com/kohsuke2/GHContentIntegrationTest", + "homepage": null, + "size": 111, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 1, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 1, + "open_issues": 0, + "watchers": 0, + "default_branch": "main" + }, + "source": { + "id": 14779458, + "node_id": "MDEwOlJlcG9zaXRvcnkxNDc3OTQ1OA==", + "name": "github-api-test-1", + "full_name": "farmdawgnation/github-api-test-1", + "private": false, + "owner": { + "login": "farmdawgnation", + "id": 620189, + "node_id": "MDQ6VXNlcjYyMDE4OQ==", + "avatar_url": "https://avatars2.githubusercontent.com/u/620189?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/farmdawgnation", + "html_url": "https://github.com/farmdawgnation", + "followers_url": "https://api.github.com/users/farmdawgnation/followers", + "following_url": "https://api.github.com/users/farmdawgnation/following{/other_user}", + "gists_url": "https://api.github.com/users/farmdawgnation/gists{/gist_id}", + "starred_url": "https://api.github.com/users/farmdawgnation/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/farmdawgnation/subscriptions", + "organizations_url": "https://api.github.com/users/farmdawgnation/orgs", + "repos_url": "https://api.github.com/users/farmdawgnation/repos", + "events_url": "https://api.github.com/users/farmdawgnation/events{/privacy}", + "received_events_url": "https://api.github.com/users/farmdawgnation/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/farmdawgnation/github-api-test-1", + "description": "Repository used for integration test of github-api", + "fork": false, + "url": "https://api.github.com/repos/farmdawgnation/github-api-test-1", + "forks_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/forks", + "keys_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/teams", + "hooks_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/hooks", + "issue_events_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/issues/events{/number}", + "events_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/events", + "assignees_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/assignees{/user}", + "branches_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/branches{/branch}", + "tags_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/tags", + "blobs_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/statuses/{sha}", + "languages_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/languages", + "stargazers_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/stargazers", + "contributors_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/contributors", + "subscribers_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/subscribers", + "subscription_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/subscription", + "commits_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/contents/{+path}", + "compare_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/merges", + "archive_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/downloads", + "issues_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/issues{/number}", + "pulls_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/pulls{/number}", + "milestones_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/milestones{/number}", + "notifications_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/labels{/name}", + "releases_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/releases{/id}", + "deployments_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/deployments", + "created_at": "2013-11-28T14:46:38Z", + "updated_at": "2016-02-05T13:33:23Z", + "pushed_at": "2013-11-28T14:55:36Z", + "git_url": "git://github.com/farmdawgnation/github-api-test-1.git", + "ssh_url": "git@github.com:farmdawgnation/github-api-test-1.git", + "clone_url": "https://github.com/farmdawgnation/github-api-test-1.git", + "svn_url": "https://github.com/farmdawgnation/github-api-test-1", + "homepage": null, + "size": 89, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 60, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 60, + "open_issues": 0, + "watchers": 0, + "default_branch": "main" + }, + "network_count": 60, + "subscribers_count": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/__files/3-r_h_g_contents_ghcontent-ro_a-file-with-content.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/__files/3-r_h_g_contents_ghcontent-ro_a-file-with-content.json new file mode 100644 index 0000000000..b2bf0b6737 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/__files/3-r_h_g_contents_ghcontent-ro_a-file-with-content.json @@ -0,0 +1,18 @@ +{ + "name": "a-file-with-content", + "path": "ghcontent-ro/a-file-with-content", + "sha": "901fd87750a8e53fe39a219cad50d4f7c80ca272", + "size": 22, + "url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/contents/ghcontent-ro/a-file-with-content?ref=main", + "html_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest/blob/main/ghcontent-ro/a-file-with-content", + "git_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/blobs/901fd87750a8e53fe39a219cad50d4f7c80ca272", + "download_url": "https://raw.githubusercontent.com/hub4j-test-org/GHContentIntegrationTest/main/ghcontent-ro/a-file-with-content", + "type": "file", + "content": "dGhhbmtzIGZvciByZWFkaW5nIG1lCg==\n", + "encoding": "base64", + "_links": { + "self": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/contents/ghcontent-ro/a-file-with-content?ref=main", + "git": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/blobs/901fd87750a8e53fe39a219cad50d4f7c80ca272", + "html": "https://github.com/hub4j-test-org/GHContentIntegrationTest/blob/main/ghcontent-ro/a-file-with-content" + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/__files/4-r_h_g_contents_ghcontent-ro_a-file-with-content-delete.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/__files/4-r_h_g_contents_ghcontent-ro_a-file-with-content-delete.json new file mode 100644 index 0000000000..ffebfc933f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/__files/4-r_h_g_contents_ghcontent-ro_a-file-with-content-delete.json @@ -0,0 +1,37 @@ +{ + "content": null, + "commit": { + "sha": "3344556677889900112233445566778899001122", + "node_id": "MDY6Q29tbWl0NDA3NjM1Nzc6MzM0NDU1NjY3Nzg4OTkwMDExMjIzMzQ0NTU2Njc3ODg5OTAwMTEyMg==", + "url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/commits/3344556677889900112233445566778899001122", + "html_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest/commit/3344556677889900112233445566778899001122", + "author": { + "name": "John Doe", + "email": "john@example.com", + "date": "2024-01-01T00:00:00Z" + }, + "committer": { + "name": "Service Account", + "email": "service@example.com", + "date": "2024-01-01T00:00:00Z" + }, + "tree": { + "sha": "eeff00112233445566778899aabb00112233ddee", + "url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/trees/eeff00112233445566778899aabb00112233ddee" + }, + "message": "Deleting with custom author and committer", + "parents": [ + { + "sha": "bbbb111122223333444455556666777788889999", + "url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/commits/bbbb111122223333444455556666777788889999", + "html_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest/commit/bbbb111122223333444455556666777788889999" + } + ], + "verification": { + "verified": false, + "reason": "unsigned", + "signature": null, + "payload": null + } + } +} diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/mappings/1-user.json new file mode 100644 index 0000000000..867e80d5f8 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/mappings/1-user.json @@ -0,0 +1,48 @@ +{ + "id": "b9d02cd3-311a-4d49-8de8-aa4220400616", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Sat, 21 Dec 2019 03:41:23 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4985", + "X-RateLimit-Reset": "1576903221", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"be4370b3c906450f450e411f567ee839\"", + "Last-Modified": "Wed, 18 Dec 2019 01:26:55 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "C977:4ACE:948C05:B32660:5DFD9463" + } + }, + "uuid": "b9d02cd3-311a-4d49-8de8-aa4220400616", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/mappings/2-r_h_ghcontentintegrationtest.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/mappings/2-r_h_ghcontentintegrationtest.json new file mode 100644 index 0000000000..a96af5128d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/mappings/2-r_h_ghcontentintegrationtest.json @@ -0,0 +1,48 @@ +{ + "id": "f60bd9fd-10cc-4488-b2ce-b618cac83ae2", + "name": "repos_hub4j-test-org_ghcontentintegrationtest", + "request": { + "url": "/repos/hub4j-test-org/GHContentIntegrationTest", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-r_h_ghcontentintegrationtest.json", + "headers": { + "Date": "Sat, 21 Dec 2019 03:41:25 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4981", + "X-RateLimit-Reset": "1576903221", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"1e430d4199aa33f3d4673fee6fee2709\"", + "Last-Modified": "Tue, 26 Nov 2019 01:09:49 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "C977:4ACE:948C3A:B32669:5DFD9463" + } + }, + "uuid": "f60bd9fd-10cc-4488-b2ce-b618cac83ae2", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/mappings/3-r_h_g_contents_ghcontent-ro_a-file-with-content.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/mappings/3-r_h_g_contents_ghcontent-ro_a-file-with-content.json new file mode 100644 index 0000000000..c661ffe5cb --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/mappings/3-r_h_g_contents_ghcontent-ro_a-file-with-content.json @@ -0,0 +1,24 @@ +{ + "id": "a1b2c3d4-e5f6-7890-abcd-300000000001", + "name": "repos_hub4j-test-org_ghcontentintegrationtest_contents_ghcontent-ro_a-file-with-content", + "request": { + "url": "/repos/hub4j-test-org/GHContentIntegrationTest/contents/ghcontent-ro/a-file-with-content", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-r_h_g_contents_ghcontent-ro_a-file-with-content.json", + "headers": { + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK" + } + }, + "uuid": "a1b2c3d4-e5f6-7890-abcd-300000000001", + "persistent": true, + "insertionIndex": 3 +} diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/mappings/4-r_h_g_contents_ghcontent-ro_a-file-with-content-delete.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/mappings/4-r_h_g_contents_ghcontent-ro_a-file-with-content-delete.json new file mode 100644 index 0000000000..fe702f39af --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testDeleteWithAuthorCommitter/mappings/4-r_h_g_contents_ghcontent-ro_a-file-with-content-delete.json @@ -0,0 +1,31 @@ +{ + "id": "a1b2c3d4-e5f6-7890-abcd-300000000002", + "name": "repos_hub4j-test-org_ghcontentintegrationtest_contents_ghcontent-ro_a-file-with-content_delete", + "request": { + "url": "/repos/hub4j-test-org/GHContentIntegrationTest/contents/ghcontent-ro/a-file-with-content", + "method": "DELETE", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"path\":\"ghcontent-ro/a-file-with-content\",\"sha\":\"901fd87750a8e53fe39a219cad50d4f7c80ca272\",\"message\":\"Deleting with custom author and committer\",\"branch\":\"main\",\"author\":{\"name\":\"John Doe\",\"email\":\"john@example.com\",\"date\":\"2009-02-13T23:31:30Z\"},\"committer\":{\"name\":\"Service Account\",\"email\":\"service@example.com\",\"date\":\"2009-02-13T23:31:30Z\"}}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "4-r_h_g_contents_ghcontent-ro_a-file-with-content-delete.json", + "headers": { + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK" + } + }, + "uuid": "a1b2c3d4-e5f6-7890-abcd-300000000002", + "persistent": true, + "insertionIndex": 4 +} diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/__files/1-user.json new file mode 100644 index 0000000000..98e8c76ba2 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/__files/1-user.json @@ -0,0 +1,45 @@ +{ + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": "https://twitter.com/bitwiseman", + "public_repos": 178, + "public_gists": 7, + "followers": 144, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2019-12-18T01:26:55Z", + "private_gists": 7, + "total_private_repos": 10, + "owned_private_repos": 0, + "disk_usage": 33697, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/__files/2-r_h_ghcontentintegrationtest.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/__files/2-r_h_ghcontentintegrationtest.json new file mode 100644 index 0000000000..68e3d4f428 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/__files/2-r_h_ghcontentintegrationtest.json @@ -0,0 +1,313 @@ +{ + "id": 40763577, + "node_id": "MDEwOlJlcG9zaXRvcnk0MDc2MzU3Nw==", + "name": "GHContentIntegrationTest", + "full_name": "hub4j-test-org/GHContentIntegrationTest", + "private": false, + "owner": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest", + "description": "Repository used for integration test of github-api", + "fork": true, + "url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest", + "forks_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/deployments", + "created_at": "2015-08-15T14:14:57Z", + "updated_at": "2019-11-26T01:09:49Z", + "pushed_at": "2019-11-26T01:09:48Z", + "git_url": "git://github.com/hub4j-test-org/GHContentIntegrationTest.git", + "ssh_url": "git@github.com:hub4j-test-org/GHContentIntegrationTest.git", + "clone_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest.git", + "svn_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest", + "homepage": null, + "size": 52, + "stargazers_count": 1, + "watchers_count": 1, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 41, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 41, + "open_issues": 0, + "watchers": 1, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "temp_clone_token": "", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "parent": { + "id": 19653852, + "node_id": "MDEwOlJlcG9zaXRvcnkxOTY1Mzg1Mg==", + "name": "GHContentIntegrationTest", + "full_name": "kohsuke2/GHContentIntegrationTest", + "private": false, + "owner": { + "login": "kohsuke2", + "id": 1329242, + "node_id": "MDQ6VXNlcjEzMjkyNDI=", + "avatar_url": "https://avatars2.githubusercontent.com/u/1329242?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke2", + "html_url": "https://github.com/kohsuke2", + "followers_url": "https://api.github.com/users/kohsuke2/followers", + "following_url": "https://api.github.com/users/kohsuke2/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke2/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke2/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke2/orgs", + "repos_url": "https://api.github.com/users/kohsuke2/repos", + "events_url": "https://api.github.com/users/kohsuke2/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke2/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/kohsuke2/GHContentIntegrationTest", + "description": "Repository used for integration test of github-api", + "fork": true, + "url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest", + "forks_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/forks", + "keys_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/teams", + "hooks_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/hooks", + "issue_events_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/issues/events{/number}", + "events_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/events", + "assignees_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/assignees{/user}", + "branches_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/branches{/branch}", + "tags_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/tags", + "blobs_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/languages", + "stargazers_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/stargazers", + "contributors_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/contributors", + "subscribers_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/subscribers", + "subscription_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/subscription", + "commits_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/contents/{+path}", + "compare_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/merges", + "archive_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/downloads", + "issues_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/issues{/number}", + "pulls_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/labels{/name}", + "releases_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/releases{/id}", + "deployments_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/deployments", + "created_at": "2014-05-10T22:50:30Z", + "updated_at": "2018-11-07T15:36:19Z", + "pushed_at": "2018-11-07T15:36:18Z", + "git_url": "git://github.com/kohsuke2/GHContentIntegrationTest.git", + "ssh_url": "git@github.com:kohsuke2/GHContentIntegrationTest.git", + "clone_url": "https://github.com/kohsuke2/GHContentIntegrationTest.git", + "svn_url": "https://github.com/kohsuke2/GHContentIntegrationTest", + "homepage": null, + "size": 111, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 1, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 1, + "open_issues": 0, + "watchers": 0, + "default_branch": "main" + }, + "source": { + "id": 14779458, + "node_id": "MDEwOlJlcG9zaXRvcnkxNDc3OTQ1OA==", + "name": "github-api-test-1", + "full_name": "farmdawgnation/github-api-test-1", + "private": false, + "owner": { + "login": "farmdawgnation", + "id": 620189, + "node_id": "MDQ6VXNlcjYyMDE4OQ==", + "avatar_url": "https://avatars2.githubusercontent.com/u/620189?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/farmdawgnation", + "html_url": "https://github.com/farmdawgnation", + "followers_url": "https://api.github.com/users/farmdawgnation/followers", + "following_url": "https://api.github.com/users/farmdawgnation/following{/other_user}", + "gists_url": "https://api.github.com/users/farmdawgnation/gists{/gist_id}", + "starred_url": "https://api.github.com/users/farmdawgnation/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/farmdawgnation/subscriptions", + "organizations_url": "https://api.github.com/users/farmdawgnation/orgs", + "repos_url": "https://api.github.com/users/farmdawgnation/repos", + "events_url": "https://api.github.com/users/farmdawgnation/events{/privacy}", + "received_events_url": "https://api.github.com/users/farmdawgnation/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/farmdawgnation/github-api-test-1", + "description": "Repository used for integration test of github-api", + "fork": false, + "url": "https://api.github.com/repos/farmdawgnation/github-api-test-1", + "forks_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/forks", + "keys_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/teams", + "hooks_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/hooks", + "issue_events_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/issues/events{/number}", + "events_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/events", + "assignees_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/assignees{/user}", + "branches_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/branches{/branch}", + "tags_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/tags", + "blobs_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/statuses/{sha}", + "languages_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/languages", + "stargazers_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/stargazers", + "contributors_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/contributors", + "subscribers_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/subscribers", + "subscription_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/subscription", + "commits_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/contents/{+path}", + "compare_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/merges", + "archive_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/downloads", + "issues_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/issues{/number}", + "pulls_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/pulls{/number}", + "milestones_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/milestones{/number}", + "notifications_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/labels{/name}", + "releases_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/releases{/id}", + "deployments_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/deployments", + "created_at": "2013-11-28T14:46:38Z", + "updated_at": "2016-02-05T13:33:23Z", + "pushed_at": "2013-11-28T14:55:36Z", + "git_url": "git://github.com/farmdawgnation/github-api-test-1.git", + "ssh_url": "git@github.com:farmdawgnation/github-api-test-1.git", + "clone_url": "https://github.com/farmdawgnation/github-api-test-1.git", + "svn_url": "https://github.com/farmdawgnation/github-api-test-1", + "homepage": null, + "size": 89, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 60, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 60, + "open_issues": 0, + "watchers": 0, + "default_branch": "main" + }, + "network_count": 60, + "subscribers_count": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/__files/3-r_h_g_contents_ghcontent-ro_a-file-with-content.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/__files/3-r_h_g_contents_ghcontent-ro_a-file-with-content.json new file mode 100644 index 0000000000..b2bf0b6737 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/__files/3-r_h_g_contents_ghcontent-ro_a-file-with-content.json @@ -0,0 +1,18 @@ +{ + "name": "a-file-with-content", + "path": "ghcontent-ro/a-file-with-content", + "sha": "901fd87750a8e53fe39a219cad50d4f7c80ca272", + "size": 22, + "url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/contents/ghcontent-ro/a-file-with-content?ref=main", + "html_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest/blob/main/ghcontent-ro/a-file-with-content", + "git_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/blobs/901fd87750a8e53fe39a219cad50d4f7c80ca272", + "download_url": "https://raw.githubusercontent.com/hub4j-test-org/GHContentIntegrationTest/main/ghcontent-ro/a-file-with-content", + "type": "file", + "content": "dGhhbmtzIGZvciByZWFkaW5nIG1lCg==\n", + "encoding": "base64", + "_links": { + "self": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/contents/ghcontent-ro/a-file-with-content?ref=main", + "git": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/blobs/901fd87750a8e53fe39a219cad50d4f7c80ca272", + "html": "https://github.com/hub4j-test-org/GHContentIntegrationTest/blob/main/ghcontent-ro/a-file-with-content" + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/__files/4-r_h_g_contents_ghcontent-ro_a-file-with-content-update.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/__files/4-r_h_g_contents_ghcontent-ro_a-file-with-content-update.json new file mode 100644 index 0000000000..cd35c418e7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/__files/4-r_h_g_contents_ghcontent-ro_a-file-with-content-update.json @@ -0,0 +1,52 @@ +{ + "content": { + "name": "a-file-with-content", + "path": "ghcontent-ro/a-file-with-content", + "sha": "bbccddee11223344556677889900aabbccddeeff", + "size": 16, + "url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/contents/ghcontent-ro/a-file-with-content?ref=main", + "html_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest/blob/main/ghcontent-ro/a-file-with-content", + "git_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/blobs/bbccddee11223344556677889900aabbccddeeff", + "download_url": "https://raw.githubusercontent.com/hub4j-test-org/GHContentIntegrationTest/main/ghcontent-ro/a-file-with-content", + "type": "file", + "_links": { + "self": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/contents/ghcontent-ro/a-file-with-content?ref=main", + "git": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/blobs/bbccddee11223344556677889900aabbccddeeff", + "html": "https://github.com/hub4j-test-org/GHContentIntegrationTest/blob/main/ghcontent-ro/a-file-with-content" + } + }, + "commit": { + "sha": "2233445566778899001122334455667788990011", + "node_id": "MDY6Q29tbWl0NDA3NjM1Nzc6MjIzMzQ0NTU2Njc3ODg5OTAwMTEyMjMzNDQ1NTY2Nzc4ODk5MDAxMQ==", + "url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/commits/2233445566778899001122334455667788990011", + "html_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest/commit/2233445566778899001122334455667788990011", + "author": { + "name": "John Doe", + "email": "john@example.com", + "date": "2024-01-01T00:00:00Z" + }, + "committer": { + "name": "Service Account", + "email": "service@example.com", + "date": "2024-01-01T00:00:00Z" + }, + "tree": { + "sha": "ccdd00112233445566778899aabb00112233eeff", + "url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/trees/ccdd00112233445566778899aabb00112233eeff" + }, + "message": "Updating with custom author and committer", + "parents": [ + { + "sha": "aaaa111122223333444455556666777788889999", + "url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/commits/aaaa111122223333444455556666777788889999", + "html_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest/commit/aaaa111122223333444455556666777788889999" + } + ], + "verification": { + "verified": false, + "reason": "unsigned", + "signature": null, + "payload": null + } + } +} diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/mappings/1-user.json new file mode 100644 index 0000000000..867e80d5f8 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/mappings/1-user.json @@ -0,0 +1,48 @@ +{ + "id": "b9d02cd3-311a-4d49-8de8-aa4220400616", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Sat, 21 Dec 2019 03:41:23 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4985", + "X-RateLimit-Reset": "1576903221", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"be4370b3c906450f450e411f567ee839\"", + "Last-Modified": "Wed, 18 Dec 2019 01:26:55 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "C977:4ACE:948C05:B32660:5DFD9463" + } + }, + "uuid": "b9d02cd3-311a-4d49-8de8-aa4220400616", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/mappings/2-r_h_ghcontentintegrationtest.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/mappings/2-r_h_ghcontentintegrationtest.json new file mode 100644 index 0000000000..a96af5128d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/mappings/2-r_h_ghcontentintegrationtest.json @@ -0,0 +1,48 @@ +{ + "id": "f60bd9fd-10cc-4488-b2ce-b618cac83ae2", + "name": "repos_hub4j-test-org_ghcontentintegrationtest", + "request": { + "url": "/repos/hub4j-test-org/GHContentIntegrationTest", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-r_h_ghcontentintegrationtest.json", + "headers": { + "Date": "Sat, 21 Dec 2019 03:41:25 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4981", + "X-RateLimit-Reset": "1576903221", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"1e430d4199aa33f3d4673fee6fee2709\"", + "Last-Modified": "Tue, 26 Nov 2019 01:09:49 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "C977:4ACE:948C3A:B32669:5DFD9463" + } + }, + "uuid": "f60bd9fd-10cc-4488-b2ce-b618cac83ae2", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/mappings/3-r_h_g_contents_ghcontent-ro_a-file-with-content.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/mappings/3-r_h_g_contents_ghcontent-ro_a-file-with-content.json new file mode 100644 index 0000000000..6191da8eb7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/mappings/3-r_h_g_contents_ghcontent-ro_a-file-with-content.json @@ -0,0 +1,24 @@ +{ + "id": "a1b2c3d4-e5f6-7890-abcd-200000000001", + "name": "repos_hub4j-test-org_ghcontentintegrationtest_contents_ghcontent-ro_a-file-with-content", + "request": { + "url": "/repos/hub4j-test-org/GHContentIntegrationTest/contents/ghcontent-ro/a-file-with-content", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-r_h_g_contents_ghcontent-ro_a-file-with-content.json", + "headers": { + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK" + } + }, + "uuid": "a1b2c3d4-e5f6-7890-abcd-200000000001", + "persistent": true, + "insertionIndex": 3 +} diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/mappings/4-r_h_g_contents_ghcontent-ro_a-file-with-content-update.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/mappings/4-r_h_g_contents_ghcontent-ro_a-file-with-content-update.json new file mode 100644 index 0000000000..8a7f2d57e2 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testUpdateWithAuthorCommitter/mappings/4-r_h_g_contents_ghcontent-ro_a-file-with-content-update.json @@ -0,0 +1,31 @@ +{ + "id": "a1b2c3d4-e5f6-7890-abcd-200000000002", + "name": "repos_hub4j-test-org_ghcontentintegrationtest_contents_ghcontent-ro_a-file-with-content_update", + "request": { + "url": "/repos/hub4j-test-org/GHContentIntegrationTest/contents/ghcontent-ro/a-file-with-content", + "method": "PUT", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"path\":\"ghcontent-ro/a-file-with-content\",\"sha\":\"901fd87750a8e53fe39a219cad50d4f7c80ca272\",\"message\":\"Updating with custom author and committer\",\"content\":\"dXBkYXRlZCBjb250ZW50Cg==\",\"branch\":\"main\",\"author\":{\"name\":\"John Doe\",\"email\":\"john@example.com\",\"date\":\"2009-02-13T23:31:30Z\"},\"committer\":{\"name\":\"Service Account\",\"email\":\"service@example.com\",\"date\":\"2009-02-13T23:31:30Z\"}}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "4-r_h_g_contents_ghcontent-ro_a-file-with-content-update.json", + "headers": { + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK" + } + }, + "uuid": "a1b2c3d4-e5f6-7890-abcd-200000000002", + "persistent": true, + "insertionIndex": 4 +}