diff --git a/src/main/java/org/kohsuke/github/GHGistBuilder.java b/src/main/java/org/kohsuke/github/GHGistBuilder.java index fd9bf00ce3..8df07bb99e 100644 --- a/src/main/java/org/kohsuke/github/GHGistBuilder.java +++ b/src/main/java/org/kohsuke/github/GHGistBuilder.java @@ -4,6 +4,8 @@ import java.util.Collections; import java.util.LinkedHashMap; +import javax.annotation.Nonnull; + /** * Builder pattern for creating a new Gist. * @@ -59,7 +61,7 @@ public GHGistBuilder public_(boolean v) { * the content * @return Adds a new file. */ - public GHGistBuilder file(String fileName, String content) { + public GHGistBuilder file(@Nonnull String fileName, @Nonnull String content) { files.put(fileName, Collections.singletonMap("content", content)); return this; } diff --git a/src/main/java/org/kohsuke/github/GHGistUpdater.java b/src/main/java/org/kohsuke/github/GHGistUpdater.java index 216d38f963..1faec64254 100644 --- a/src/main/java/org/kohsuke/github/GHGistUpdater.java +++ b/src/main/java/org/kohsuke/github/GHGistUpdater.java @@ -2,7 +2,11 @@ import java.io.IOException; import java.util.Collections; +import java.util.HashMap; import java.util.LinkedHashMap; +import java.util.Map; + +import javax.annotation.Nonnull; /** * Builder pattern for updating a Gist. @@ -32,16 +36,15 @@ public class GHGistUpdater { * @throws IOException * the io exception */ - public GHGistUpdater addFile(String fileName, String content) throws IOException { + public GHGistUpdater addFile(@Nonnull String fileName, @Nonnull String content) throws IOException { updateFile(fileName, content); return this; } - // // This method does not work. - // public GHGistUpdater deleteFile(String fileName) throws IOException { - // files.put(fileName, Collections.singletonMap("filename", null)); - // return this; - // } + public GHGistUpdater deleteFile(@Nonnull String fileName) throws IOException { + files.put(fileName, null); + return this; + } /** * Rename file gh gist updater. @@ -54,7 +57,7 @@ public GHGistUpdater addFile(String fileName, String content) throws IOException * @throws IOException * the io exception */ - public GHGistUpdater renameFile(String fileName, String newFileName) throws IOException { + public GHGistUpdater renameFile(@Nonnull String fileName, @Nonnull String newFileName) throws IOException { files.put(fileName, Collections.singletonMap("filename", newFileName)); return this; } @@ -70,11 +73,33 @@ public GHGistUpdater renameFile(String fileName, String newFileName) throws IOEx * @throws IOException * the io exception */ - public GHGistUpdater updateFile(String fileName, String content) throws IOException { + public GHGistUpdater updateFile(@Nonnull String fileName, @Nonnull String content) throws IOException { files.put(fileName, Collections.singletonMap("content", content)); return this; } + /** + * Update file name and content + * + * @param fileName + * the file name + * @param newFileName + * the new file name + * @param content + * the content + * @return the gh gist updater + * @throws IOException + * the io exception + */ + public GHGistUpdater updateFile(@Nonnull String fileName, @Nonnull String newFileName, @Nonnull String content) + throws IOException { + Map file = new HashMap<>(); + file.put("content", content); + file.put("filename", newFileName); + files.put(fileName, file); + return this; + } + /** * Description gh gist updater. * diff --git a/src/test/java/org/kohsuke/github/GHGistTest.java b/src/test/java/org/kohsuke/github/GHGistTest.java index cbb70d77aa..ce7a217813 100644 --- a/src/test/java/org/kohsuke/github/GHGistTest.java +++ b/src/test/java/org/kohsuke/github/GHGistTest.java @@ -2,7 +2,9 @@ import org.junit.Test; -import static org.hamcrest.Matchers.notNullValue; +import java.io.FileNotFoundException; + +import static org.hamcrest.Matchers.*; import static org.hamcrest.core.Is.is; /** @@ -17,9 +19,12 @@ public void lifecycleTest() throws Exception { .description("Test Gist") .file("abc.txt", "abc") .file("def.txt", "def") + .file("ghi.txt", "ghi") .create(); assertThat(gist.getCreatedAt(), is(notNullValue())); + assertThat(gist.getDescription(), equalTo("Test Gist")); + assertThat(gist.getFiles().size(), equalTo(3)); assertNotNull(gist.getUpdatedAt()); assertNotNull(gist.getCommentsUrl()); @@ -28,7 +33,57 @@ public void lifecycleTest() throws Exception { assertNotNull(gist.getGitPushUrl()); assertNotNull(gist.getHtmlUrl()); + String id = gist.getGistId(); + + GHGist gistUpdate = gitHub.getGist(id); + assertThat(gistUpdate.getGistId(), equalTo(gist.getGistId())); + assertThat(gistUpdate.getDescription(), equalTo(gist.getDescription())); + assertThat(gistUpdate.getFiles().size(), equalTo(3)); + + gistUpdate = gistUpdate.update().description("Gist Test").addFile("jkl.txt", "jkl").update(); + + assertThat(gistUpdate.getGistId(), equalTo(gist.getGistId())); + assertThat(gistUpdate.getDescription(), equalTo("Gist Test")); + assertThat(gistUpdate.getFiles().size(), equalTo(4)); + + gistUpdate = gistUpdate.update() + .renameFile("abc.txt", "ab.txt") + .deleteFile("def.txt") + .updateFile("ghi.txt", "gh") + .updateFile("jkl.txt", "klm.txt", "nop") + .update(); + + assertThat(gistUpdate.getGistId(), equalTo(gist.getGistId())); + assertThat(gistUpdate.getDescription(), equalTo("Gist Test")); + assertThat(gistUpdate.getFiles().size(), equalTo(3)); + + // verify delete works + assertThat(gistUpdate.getFile("def.txt"), nullValue()); + + // verify rename + assertThat(gistUpdate.getFile("ab.txt").getContent(), equalTo("abc")); + + // verify updates + assertThat(gistUpdate.getFile("ghi.txt").getContent(), equalTo("gh")); + assertThat(gistUpdate.getFile("klm.txt").getContent(), equalTo("nop")); + + try { + gist.getId(); + fail("Newly created gists do not have numeric ids."); + } catch (NumberFormatException e) { + assertThat(e, notNullValue()); + } + + assertThat(gist.getGistId(), notNullValue()); + gist.delete(); + + try { + gitHub.getGist(id); + fail("Gist should be deleted."); + } catch (FileNotFoundException e) { + assertThat(e, notNullValue()); + } } @Test @@ -63,6 +118,8 @@ public void gistFile() throws Exception { GHGist gist = gitHub.getGist("9903708"); assertTrue(gist.isPublic()); + assertThat(gist.getId(), equalTo(9903708L)); + assertThat(gist.getGistId(), equalTo("9903708")); assertEquals(1, gist.getFiles().size()); GHGistFile f = gist.getFile("keybase.md"); diff --git a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/gists-2.json b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/gists-2.json index 3ae7954793..035fefef13 100644 --- a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/gists-2.json +++ b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/gists-2.json @@ -1,18 +1,18 @@ { - "url": "https://api.github.com/gists/9faa55cd67b21a789bb44e34e5e41f72", - "forks_url": "https://api.github.com/gists/9faa55cd67b21a789bb44e34e5e41f72/forks", - "commits_url": "https://api.github.com/gists/9faa55cd67b21a789bb44e34e5e41f72/commits", - "id": "9faa55cd67b21a789bb44e34e5e41f72", - "node_id": "MDQ6R2lzdDlmYWE1NWNkNjdiMjFhNzg5YmI0NGUzNGU1ZTQxZjcy", - "git_pull_url": "https://gist.github.com/9faa55cd67b21a789bb44e34e5e41f72.git", - "git_push_url": "https://gist.github.com/9faa55cd67b21a789bb44e34e5e41f72.git", - "html_url": "https://gist.github.com/9faa55cd67b21a789bb44e34e5e41f72", + "url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd", + "forks_url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/forks", + "commits_url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/commits", + "id": "934d422d84e3fd76e1aeea159b0dbedd", + "node_id": "MDQ6R2lzdDkzNGQ0MjJkODRlM2ZkNzZlMWFlZWExNTliMGRiZWRk", + "git_pull_url": "https://gist.github.com/934d422d84e3fd76e1aeea159b0dbedd.git", + "git_push_url": "https://gist.github.com/934d422d84e3fd76e1aeea159b0dbedd.git", + "html_url": "https://gist.github.com/934d422d84e3fd76e1aeea159b0dbedd", "files": { "abc.txt": { "filename": "abc.txt", "type": "text/plain", "language": "Text", - "raw_url": "https://gist.githubusercontent.com/bitwiseman/9faa55cd67b21a789bb44e34e5e41f72/raw/f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f/abc.txt", + "raw_url": "https://gist.githubusercontent.com/bitwiseman/934d422d84e3fd76e1aeea159b0dbedd/raw/f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f/abc.txt", "size": 3, "truncated": false, "content": "abc" @@ -21,19 +21,28 @@ "filename": "def.txt", "type": "text/plain", "language": "Text", - "raw_url": "https://gist.githubusercontent.com/bitwiseman/9faa55cd67b21a789bb44e34e5e41f72/raw/0c003832e7bfa9ca8b5c2035c9bd684a5f2623bc/def.txt", + "raw_url": "https://gist.githubusercontent.com/bitwiseman/934d422d84e3fd76e1aeea159b0dbedd/raw/0c003832e7bfa9ca8b5c2035c9bd684a5f2623bc/def.txt", "size": 3, "truncated": false, "content": "def" + }, + "ghi.txt": { + "filename": "ghi.txt", + "type": "text/plain", + "language": "Text", + "raw_url": "https://gist.githubusercontent.com/bitwiseman/934d422d84e3fd76e1aeea159b0dbedd/raw/45a82e295c52473114c57c18f4f52368df2a3cfd/ghi.txt", + "size": 3, + "truncated": false, + "content": "ghi" } }, "public": false, - "created_at": "2019-09-08T06:47:42Z", - "updated_at": "2019-09-08T06:47:42Z", + "created_at": "2020-04-22T22:20:35Z", + "updated_at": "2020-04-22T22:20:35Z", "description": "Test Gist", "comments": 0, "user": null, - "comments_url": "https://api.github.com/gists/9faa55cd67b21a789bb44e34e5e41f72/comments", + "comments_url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/comments", "owner": { "login": "bitwiseman", "id": 1958953, @@ -77,14 +86,14 @@ "type": "User", "site_admin": false }, - "version": "b25886c9892025e090e71bdf1bb9b20927cb4a19", - "committed_at": "2019-09-08T06:47:42Z", + "version": "b63367d179640c0c89b3933fb5c9e473934c572e", + "committed_at": "2020-04-22T22:20:34Z", "change_status": { - "total": 2, - "additions": 2, + "total": 3, + "additions": 3, "deletions": 0 }, - "url": "https://api.github.com/gists/9faa55cd67b21a789bb44e34e5e41f72/b25886c9892025e090e71bdf1bb9b20927cb4a19" + "url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/b63367d179640c0c89b3933fb5c9e473934c572e" } ], "truncated": false diff --git a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/gists_934d422d84e3fd76e1aeea159b0dbedd-3.json b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/gists_934d422d84e3fd76e1aeea159b0dbedd-3.json new file mode 100644 index 0000000000..035fefef13 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/gists_934d422d84e3fd76e1aeea159b0dbedd-3.json @@ -0,0 +1,100 @@ +{ + "url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd", + "forks_url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/forks", + "commits_url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/commits", + "id": "934d422d84e3fd76e1aeea159b0dbedd", + "node_id": "MDQ6R2lzdDkzNGQ0MjJkODRlM2ZkNzZlMWFlZWExNTliMGRiZWRk", + "git_pull_url": "https://gist.github.com/934d422d84e3fd76e1aeea159b0dbedd.git", + "git_push_url": "https://gist.github.com/934d422d84e3fd76e1aeea159b0dbedd.git", + "html_url": "https://gist.github.com/934d422d84e3fd76e1aeea159b0dbedd", + "files": { + "abc.txt": { + "filename": "abc.txt", + "type": "text/plain", + "language": "Text", + "raw_url": "https://gist.githubusercontent.com/bitwiseman/934d422d84e3fd76e1aeea159b0dbedd/raw/f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f/abc.txt", + "size": 3, + "truncated": false, + "content": "abc" + }, + "def.txt": { + "filename": "def.txt", + "type": "text/plain", + "language": "Text", + "raw_url": "https://gist.githubusercontent.com/bitwiseman/934d422d84e3fd76e1aeea159b0dbedd/raw/0c003832e7bfa9ca8b5c2035c9bd684a5f2623bc/def.txt", + "size": 3, + "truncated": false, + "content": "def" + }, + "ghi.txt": { + "filename": "ghi.txt", + "type": "text/plain", + "language": "Text", + "raw_url": "https://gist.githubusercontent.com/bitwiseman/934d422d84e3fd76e1aeea159b0dbedd/raw/45a82e295c52473114c57c18f4f52368df2a3cfd/ghi.txt", + "size": 3, + "truncated": false, + "content": "ghi" + } + }, + "public": false, + "created_at": "2020-04-22T22:20:35Z", + "updated_at": "2020-04-22T22:20:35Z", + "description": "Test Gist", + "comments": 0, + "user": null, + "comments_url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/comments", + "owner": { + "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 + }, + "forks": [], + "history": [ + { + "user": { + "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 + }, + "version": "b63367d179640c0c89b3933fb5c9e473934c572e", + "committed_at": "2020-04-22T22:20:34Z", + "change_status": { + "total": 3, + "additions": 3, + "deletions": 0 + }, + "url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/b63367d179640c0c89b3933fb5c9e473934c572e" + } + ], + "truncated": false +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/gists_934d422d84e3fd76e1aeea159b0dbedd-4.json b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/gists_934d422d84e3fd76e1aeea159b0dbedd-4.json new file mode 100644 index 0000000000..02455e9e2a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/gists_934d422d84e3fd76e1aeea159b0dbedd-4.json @@ -0,0 +1,139 @@ +{ + "url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd", + "forks_url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/forks", + "commits_url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/commits", + "id": "934d422d84e3fd76e1aeea159b0dbedd", + "node_id": "MDQ6R2lzdDkzNGQ0MjJkODRlM2ZkNzZlMWFlZWExNTliMGRiZWRk", + "git_pull_url": "https://gist.github.com/934d422d84e3fd76e1aeea159b0dbedd.git", + "git_push_url": "https://gist.github.com/934d422d84e3fd76e1aeea159b0dbedd.git", + "html_url": "https://gist.github.com/934d422d84e3fd76e1aeea159b0dbedd", + "files": { + "abc.txt": { + "filename": "abc.txt", + "type": "text/plain", + "language": "Text", + "raw_url": "https://gist.githubusercontent.com/bitwiseman/934d422d84e3fd76e1aeea159b0dbedd/raw/f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f/abc.txt", + "size": 3, + "truncated": false, + "content": "abc" + }, + "def.txt": { + "filename": "def.txt", + "type": "text/plain", + "language": "Text", + "raw_url": "https://gist.githubusercontent.com/bitwiseman/934d422d84e3fd76e1aeea159b0dbedd/raw/0c003832e7bfa9ca8b5c2035c9bd684a5f2623bc/def.txt", + "size": 3, + "truncated": false, + "content": "def" + }, + "ghi.txt": { + "filename": "ghi.txt", + "type": "text/plain", + "language": "Text", + "raw_url": "https://gist.githubusercontent.com/bitwiseman/934d422d84e3fd76e1aeea159b0dbedd/raw/45a82e295c52473114c57c18f4f52368df2a3cfd/ghi.txt", + "size": 3, + "truncated": false, + "content": "ghi" + }, + "jkl.txt": { + "filename": "jkl.txt", + "type": "text/plain", + "language": "Text", + "raw_url": "https://gist.githubusercontent.com/bitwiseman/934d422d84e3fd76e1aeea159b0dbedd/raw/45328c36ff2e9b9b4e592c847d3f9a7fd9b3e716/jkl.txt", + "size": 3, + "truncated": false, + "content": "jkl" + } + }, + "public": false, + "created_at": "2020-04-22T22:20:35Z", + "updated_at": "2020-04-22T22:20:36Z", + "description": "Gist Test", + "comments": 0, + "user": null, + "comments_url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/comments", + "owner": { + "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 + }, + "forks": [], + "history": [ + { + "user": { + "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 + }, + "version": "b5268be23b34797cc1caf83556c614e44b0313c0", + "committed_at": "2020-04-22T22:20:36Z", + "change_status": { + "total": 1, + "additions": 1, + "deletions": 0 + }, + "url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/b5268be23b34797cc1caf83556c614e44b0313c0" + }, + { + "user": { + "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 + }, + "version": "b63367d179640c0c89b3933fb5c9e473934c572e", + "committed_at": "2020-04-22T22:20:34Z", + "change_status": { + "total": 3, + "additions": 3, + "deletions": 0 + }, + "url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/b63367d179640c0c89b3933fb5c9e473934c572e" + } + ], + "truncated": false +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/gists_934d422d84e3fd76e1aeea159b0dbedd-5.json b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/gists_934d422d84e3fd76e1aeea159b0dbedd-5.json new file mode 100644 index 0000000000..77f4d830f8 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/gists_934d422d84e3fd76e1aeea159b0dbedd-5.json @@ -0,0 +1,160 @@ +{ + "url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd", + "forks_url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/forks", + "commits_url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/commits", + "id": "934d422d84e3fd76e1aeea159b0dbedd", + "node_id": "MDQ6R2lzdDkzNGQ0MjJkODRlM2ZkNzZlMWFlZWExNTliMGRiZWRk", + "git_pull_url": "https://gist.github.com/934d422d84e3fd76e1aeea159b0dbedd.git", + "git_push_url": "https://gist.github.com/934d422d84e3fd76e1aeea159b0dbedd.git", + "html_url": "https://gist.github.com/934d422d84e3fd76e1aeea159b0dbedd", + "files": { + "ab.txt": { + "filename": "ab.txt", + "type": "text/plain", + "language": "Text", + "raw_url": "https://gist.githubusercontent.com/bitwiseman/934d422d84e3fd76e1aeea159b0dbedd/raw/f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f/ab.txt", + "size": 3, + "truncated": false, + "content": "abc" + }, + "ghi.txt": { + "filename": "ghi.txt", + "type": "text/plain", + "language": "Text", + "raw_url": "https://gist.githubusercontent.com/bitwiseman/934d422d84e3fd76e1aeea159b0dbedd/raw/c036c168e478a94fde05f915c9670df03fa4ce84/ghi.txt", + "size": 2, + "truncated": false, + "content": "gh" + }, + "klm.txt": { + "filename": "klm.txt", + "type": "text/plain", + "language": "Text", + "raw_url": "https://gist.githubusercontent.com/bitwiseman/934d422d84e3fd76e1aeea159b0dbedd/raw/8df050ad266e0e86aa01a534dd9faf202f8c3d80/klm.txt", + "size": 3, + "truncated": false, + "content": "nop" + } + }, + "public": false, + "created_at": "2020-04-22T22:20:35Z", + "updated_at": "2020-04-22T22:20:37Z", + "description": "Gist Test", + "comments": 0, + "user": null, + "comments_url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/comments", + "owner": { + "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 + }, + "forks": [], + "history": [ + { + "user": { + "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 + }, + "version": "8d132d21ce9358696b7ce6038a4723d8e90af5f5", + "committed_at": "2020-04-22T22:20:37Z", + "change_status": { + "total": 5, + "additions": 2, + "deletions": 3 + }, + "url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/8d132d21ce9358696b7ce6038a4723d8e90af5f5" + }, + { + "user": { + "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 + }, + "version": "b5268be23b34797cc1caf83556c614e44b0313c0", + "committed_at": "2020-04-22T22:20:36Z", + "change_status": { + "total": 1, + "additions": 1, + "deletions": 0 + }, + "url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/b5268be23b34797cc1caf83556c614e44b0313c0" + }, + { + "user": { + "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 + }, + "version": "b63367d179640c0c89b3933fb5c9e473934c572e", + "committed_at": "2020-04-22T22:20:34Z", + "change_status": { + "total": 3, + "additions": 3, + "deletions": 0 + }, + "url": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd/b63367d179640c0c89b3933fb5c9e473934c572e" + } + ], + "truncated": false +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/user-1.json index b9ce24cb03..1c3508aa35 100644 --- a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/user-1.json +++ b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/__files/user-1.json @@ -24,10 +24,22 @@ "email": "bitwiseman@gmail.com", "hireable": null, "bio": "https://twitter.com/bitwiseman", - "public_repos": 166, - "public_gists": 4, - "followers": 133, + "public_repos": 182, + "public_gists": 7, + "followers": 157, "following": 9, "created_at": "2012-07-11T20:38:33Z", - "updated_at": "2019-06-03T17:47:20Z" + "updated_at": "2020-04-19T04:18:55Z", + "private_gists": 11, + "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/GHGistTest/wiremock/lifecycleTest/mappings/gists-2.json b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists-2.json index 98027c3a76..f97524160c 100644 --- a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists-2.json +++ b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists-2.json @@ -1,55 +1,53 @@ { - "id": "2f93eec6-32ad-4c3d-a7bf-33a134d16dbe", + "id": "19360993-aeba-4a71-95c0-ff20a227d112", "name": "gists", "request": { "url": "/gists", "method": "POST", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, "bodyPatterns": [ { - "equalToJson": "{\"public\":false,\"description\":\"Test Gist\",\"files\":{\"abc.txt\":{\"content\":\"abc\"},\"def.txt\":{\"content\":\"def\"}}}", + "equalToJson": "{\"public\":false,\"description\":\"Test Gist\",\"files\":{\"abc.txt\":{\"content\":\"abc\"},\"def.txt\":{\"content\":\"def\"},\"ghi.txt\":{\"content\":\"ghi\"}}}", "ignoreArrayOrder": true, "ignoreExtraElements": true } - ], - "headers": { - "Accept": { - "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" - } - } + ] }, "response": { "status": 201, "bodyFileName": "gists-2.json", "headers": { - "Date": "Sun, 08 Sep 2019 06:47:43 GMT", + "Date": "Wed, 22 Apr 2020 22:20:35 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "201 Created", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4800", - "X-RateLimit-Reset": "1567926046", + "X-RateLimit-Remaining": "4974", + "X-RateLimit-Reset": "1587596099", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", - "Accept-Encoding" + "Accept-Encoding, Accept, X-Requested-With" ], - "ETag": "\"32bd93e7c792880260a7f86efe7fa182\"", - "X-OAuth-Scopes": "gist, notifications, repo", + "ETag": "\"de3bf6c09fce223d63e9170642f0ff8d\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", "X-Accepted-OAuth-Scopes": "", - "Location": "https://api.github.com/gists/9faa55cd67b21a789bb44e34e5e41f72", + "Location": "https://api.github.com/gists/934d422d84e3fd76e1aeea159b0dbedd", "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": "FD4E:40BC:96FAEF:B22CDC:5D74A40D" + "X-GitHub-Request-Id": "C54F:658E:D447D:101EE8:5EA0C331" } }, - "uuid": "2f93eec6-32ad-4c3d-a7bf-33a134d16dbe", + "uuid": "19360993-aeba-4a71-95c0-ff20a227d112", "persistent": true, "insertionIndex": 2 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_934d422d84e3fd76e1aeea159b0dbedd-3.json b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_934d422d84e3fd76e1aeea159b0dbedd-3.json new file mode 100644 index 0000000000..1838e6f445 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_934d422d84e3fd76e1aeea159b0dbedd-3.json @@ -0,0 +1,49 @@ +{ + "id": "3f027331-1f26-4dee-ad38-b7904e99ce22", + "name": "gists_934d422d84e3fd76e1aeea159b0dbedd", + "request": { + "url": "/gists/934d422d84e3fd76e1aeea159b0dbedd", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "gists_934d422d84e3fd76e1aeea159b0dbedd-3.json", + "headers": { + "Date": "Wed, 22 Apr 2020 22:20:36 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4973", + "X-RateLimit-Reset": "1587596100", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"de3bf6c09fce223d63e9170642f0ff8d\"", + "Last-Modified": "Wed, 22 Apr 2020 22:20:35 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "C54F:658E:D44FC:101FB2:5EA0C333" + } + }, + "uuid": "3f027331-1f26-4dee-ad38-b7904e99ce22", + "persistent": true, + "scenarioName": "scenario-1-gists-934d422d84e3fd76e1aeea159b0dbedd", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-1-gists-934d422d84e3fd76e1aeea159b0dbedd-2", + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_934d422d84e3fd76e1aeea159b0dbedd-4.json b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_934d422d84e3fd76e1aeea159b0dbedd-4.json new file mode 100644 index 0000000000..0bc02aba15 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_934d422d84e3fd76e1aeea159b0dbedd-4.json @@ -0,0 +1,52 @@ +{ + "id": "2cc446d7-f6b5-4b14-a953-ae3e74582a3e", + "name": "gists_934d422d84e3fd76e1aeea159b0dbedd", + "request": { + "url": "/gists/934d422d84e3fd76e1aeea159b0dbedd", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"description\":\"Gist Test\",\"files\":{\"jkl.txt\":{\"content\":\"jkl\"}}}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "gists_934d422d84e3fd76e1aeea159b0dbedd-4.json", + "headers": { + "Date": "Wed, 22 Apr 2020 22:20:37 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4972", + "X-RateLimit-Reset": "1587596100", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"398a93bc274918b5ad5472125e56c263\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "C54F:658E:D4508:101FC5:5EA0C334" + } + }, + "uuid": "2cc446d7-f6b5-4b14-a953-ae3e74582a3e", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_934d422d84e3fd76e1aeea159b0dbedd-5.json b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_934d422d84e3fd76e1aeea159b0dbedd-5.json new file mode 100644 index 0000000000..8790f15f30 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_934d422d84e3fd76e1aeea159b0dbedd-5.json @@ -0,0 +1,52 @@ +{ + "id": "9af05f47-53d8-4f4c-872f-f194600a45e4", + "name": "gists_934d422d84e3fd76e1aeea159b0dbedd", + "request": { + "url": "/gists/934d422d84e3fd76e1aeea159b0dbedd", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"files\":{\"ghi.txt\":{\"content\":\"gh\"},\"abc.txt\":{\"filename\":\"ab.txt\"},\"def.txt\":null,\"jkl.txt\":{\"filename\":\"klm.txt\",\"content\":\"nop\"}}}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "gists_934d422d84e3fd76e1aeea159b0dbedd-5.json", + "headers": { + "Date": "Wed, 22 Apr 2020 22:20:38 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4971", + "X-RateLimit-Reset": "1587596100", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"75d727213db22129d0cd375951503769\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "C54F:658E:D454B:102012:5EA0C335" + } + }, + "uuid": "9af05f47-53d8-4f4c-872f-f194600a45e4", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_934d422d84e3fd76e1aeea159b0dbedd-6.json b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_934d422d84e3fd76e1aeea159b0dbedd-6.json new file mode 100644 index 0000000000..a90ec9ea44 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_934d422d84e3fd76e1aeea159b0dbedd-6.json @@ -0,0 +1,38 @@ +{ + "id": "0b4d100f-6193-48d8-a855-29a34b0ab1ca", + "name": "gists_934d422d84e3fd76e1aeea159b0dbedd", + "request": { + "url": "/gists/934d422d84e3fd76e1aeea159b0dbedd", + "method": "DELETE", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 204, + "headers": { + "Date": "Wed, 22 Apr 2020 22:20:38 GMT", + "Server": "GitHub.com", + "Status": "204 No Content", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4970", + "X-RateLimit-Reset": "1587596100", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "X-GitHub-Request-Id": "C54F:658E:D45BB:10209B:5EA0C336" + } + }, + "uuid": "0b4d100f-6193-48d8-a855-29a34b0ab1ca", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_934d422d84e3fd76e1aeea159b0dbedd-7.json b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_934d422d84e3fd76e1aeea159b0dbedd-7.json new file mode 100644 index 0000000000..3199909aa6 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_934d422d84e3fd76e1aeea159b0dbedd-7.json @@ -0,0 +1,42 @@ +{ + "id": "13052284-da8a-418d-8a28-0985ea8c1f55", + "name": "gists_934d422d84e3fd76e1aeea159b0dbedd", + "request": { + "url": "/gists/934d422d84e3fd76e1aeea159b0dbedd", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 404, + "body": "{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/gists/#get-a-single-gist\"}", + "headers": { + "Date": "Wed, 22 Apr 2020 22:20:38 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "404 Not Found", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4969", + "X-RateLimit-Reset": "1587596099", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "X-GitHub-Request-Id": "C54F:658E:D45D5:1020B4:5EA0C336" + } + }, + "uuid": "13052284-da8a-418d-8a28-0985ea8c1f55", + "persistent": true, + "scenarioName": "scenario-1-gists-934d422d84e3fd76e1aeea159b0dbedd", + "requiredScenarioState": "scenario-1-gists-934d422d84e3fd76e1aeea159b0dbedd-2", + "insertionIndex": 7 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_9faa55cd67b21a789bb44e34e5e41f72-3.json b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_9faa55cd67b21a789bb44e34e5e41f72-3.json deleted file mode 100644 index 904d860d2e..0000000000 --- a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/gists_9faa55cd67b21a789bb44e34e5e41f72-3.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "id": "26c31487-5829-47c9-969a-2fc3b34fec9e", - "name": "gists_9faa55cd67b21a789bb44e34e5e41f72", - "request": { - "url": "/gists/9faa55cd67b21a789bb44e34e5e41f72", - "method": "DELETE", - "headers": { - "Accept": { - "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" - } - } - }, - "response": { - "status": 204, - "headers": { - "Date": "Sun, 08 Sep 2019 06:47:43 GMT", - "Content-Type": "application/octet-stream", - "Server": "GitHub.com", - "Status": "204 No Content", - "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4799", - "X-RateLimit-Reset": "1567926046", - "X-OAuth-Scopes": "gist, notifications, repo", - "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'", - "Vary": "Accept-Encoding", - "X-GitHub-Request-Id": "FD4E:40BC:96FB51:B22D68:5D74A40F" - } - }, - "uuid": "26c31487-5829-47c9-969a-2fc3b34fec9e", - "persistent": true, - "insertionIndex": 3 -} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/user-1.json index b12f897ad2..dea3cb2764 100644 --- a/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/user-1.json +++ b/src/test/resources/org/kohsuke/github/GHGistTest/wiremock/lifecycleTest/mappings/user-1.json @@ -1,5 +1,5 @@ { - "id": "3380f859-169e-41b0-9a8a-aa66277dfb8b", + "id": "cea9e6b6-56a8-493b-92fe-59111aefbf5b", "name": "user", "request": { "url": "/user", @@ -14,35 +14,33 @@ "status": 200, "bodyFileName": "user-1.json", "headers": { - "Date": "Sun, 08 Sep 2019 06:47:41 GMT", + "Date": "Wed, 22 Apr 2020 22:20:33 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4801", - "X-RateLimit-Reset": "1567926046", + "X-RateLimit-Remaining": "4976", + "X-RateLimit-Reset": "1587596100", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", - "Accept-Encoding" + "Accept-Encoding, Accept, X-Requested-With" ], - "ETag": "W/\"3ba1de3523043df743651bd23efc7def\"", - "Last-Modified": "Mon, 03 Jun 2019 17:47:20 GMT", - "X-OAuth-Scopes": "gist, notifications, repo", + "ETag": "W/\"cf686da46f8ddb072b0c9f8e72632107\"", + "Last-Modified": "Sun, 19 Apr 2020 04:18: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": "FD4E:40BC:96FAD6:B22CD5:5D74A40D" + "X-GitHub-Request-Id": "C54F:658E:D444A:101EDC:5EA0C331" } }, - "uuid": "3380f859-169e-41b0-9a8a-aa66277dfb8b", + "uuid": "cea9e6b6-56a8-493b-92fe-59111aefbf5b", "persistent": true, "insertionIndex": 1 } \ No newline at end of file