diff --git a/src/test/java/org/kohsuke/github/GHEventPayloadTest.java b/src/test/java/org/kohsuke/github/GHEventPayloadTest.java index db88196b17..91560170c7 100644 --- a/src/test/java/org/kohsuke/github/GHEventPayloadTest.java +++ b/src/test/java/org/kohsuke/github/GHEventPayloadTest.java @@ -1001,9 +1001,9 @@ public void InstallationCreatedEvent() throws Exception { assertThat(event.getInstallation().getAccount().getLogin(), is("CronFire")); assertThat(event.getRepositories().isEmpty(), is(false)); - assertThat(event.getRepositories().get(0).getId(), is(1296269)); + assertThat(event.getRepositories().get(0).getId(), is(1296269L)); assertThat(event.getRawRepositories().isEmpty(), is(false)); - assertThat(event.getRawRepositories().get(0).getId(), is(1296269)); + assertThat(event.getRawRepositories().get(0).getId(), is(1296269L)); assertThat(event.getSender().getLogin(), is("Haarolean")); } @@ -1026,8 +1026,12 @@ public void InstallationDeletedEvent() throws Exception { assertThat(event.getInstallation().getAccount().getLogin(), is("octocat")); assertThrows(IllegalStateException.class, () -> event.getRepositories().isEmpty()); - assertThat(event.getRepositories().isEmpty(), is(false)); - assertThat(event.getRepositories().get(0).getId(), is(1296269)); + assertThat(event.getRawRepositories().isEmpty(), is(false)); + assertThat(event.getRawRepositories().get(0).getId(), is(1296269L)); + assertThat(event.getRawRepositories().get(0).getNodeId(), is("MDEwOlJlcG9zaXRvcnkxMjk2MjY5")); + assertThat(event.getRawRepositories().get(0).getName(), is("Hello-World")); + assertThat(event.getRawRepositories().get(0).getFullName(), is("octocat/Hello-World")); + assertThat(event.getRawRepositories().get(0).isPrivate(), is(false)); assertThat(event.getSender().getLogin(), is("octocat")); } diff --git a/src/test/resources/org/kohsuke/github/GHEventPayloadTest/wiremock/InstallationCreatedEvent/__files/repos_octocat_hello-world-1.json b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/wiremock/InstallationCreatedEvent/__files/1-r_o_hello-world.json similarity index 100% rename from src/test/resources/org/kohsuke/github/GHEventPayloadTest/wiremock/InstallationCreatedEvent/__files/repos_octocat_hello-world-1.json rename to src/test/resources/org/kohsuke/github/GHEventPayloadTest/wiremock/InstallationCreatedEvent/__files/1-r_o_hello-world.json diff --git a/src/test/resources/org/kohsuke/github/GHEventPayloadTest/wiremock/InstallationCreatedEvent/__files/2-repositories_1296269.json b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/wiremock/InstallationCreatedEvent/__files/2-repositories_1296269.json new file mode 100644 index 0000000000..8b2db1e11c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/wiremock/InstallationCreatedEvent/__files/2-repositories_1296269.json @@ -0,0 +1,103 @@ +{ + "id": 1296269, + "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", + "name": "Hello-World", + "full_name": "octocat/Hello-World", + "private": false, + "owner": { + "login": "octocat", + "id": 583231, + "node_id": "MDQ6VXNlcjU4MzIzMQ==", + "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/octocat/Hello-World", + "description": "My first repository on GitHub!", + "fork": false, + "url": "https://api.github.com/repos/octocat/Hello-World", + "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks", + "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams", + "hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks", + "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}", + "events_url": "https://api.github.com/repos/octocat/Hello-World/events", + "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}", + "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}", + "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags", + "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}", + "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages", + "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers", + "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors", + "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers", + "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription", + "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}", + "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges", + "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads", + "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}", + "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}", + "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}", + "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}", + "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}", + "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments", + "created_at": "2011-01-26T19:01:12Z", + "updated_at": "2024-03-13T21:25:44Z", + "pushed_at": "2024-03-09T06:28:31Z", + "git_url": "git://github.com/octocat/Hello-World.git", + "ssh_url": "git@github.com:octocat/Hello-World.git", + "clone_url": "https://github.com/octocat/Hello-World.git", + "svn_url": "https://github.com/octocat/Hello-World", + "homepage": "", + "size": 1, + "stargazers_count": 2486, + "watchers_count": 2486, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 2168, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1291, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 2168, + "open_issues": 1291, + "watchers": 2486, + "default_branch": "master", + "temp_clone_token": null, + "network_count": 2168, + "subscribers_count": 1731 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHEventPayloadTest/wiremock/InstallationCreatedEvent/mappings/repos_octocat_hello-world-1.json b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/wiremock/InstallationCreatedEvent/mappings/1-r_o_hello-world.json similarity index 97% rename from src/test/resources/org/kohsuke/github/GHEventPayloadTest/wiremock/InstallationCreatedEvent/mappings/repos_octocat_hello-world-1.json rename to src/test/resources/org/kohsuke/github/GHEventPayloadTest/wiremock/InstallationCreatedEvent/mappings/1-r_o_hello-world.json index 942435fa56..885e76133f 100644 --- a/src/test/resources/org/kohsuke/github/GHEventPayloadTest/wiremock/InstallationCreatedEvent/mappings/repos_octocat_hello-world-1.json +++ b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/wiremock/InstallationCreatedEvent/mappings/1-r_o_hello-world.json @@ -12,7 +12,7 @@ }, "response": { "status": 200, - "bodyFileName": "repos_octocat_hello-world-1.json", + "bodyFileName": "1-r_o_hello-world.json", "headers": { "Server": "GitHub.com", "Date": "Thu, 03 Feb 2022 14:07:49 GMT", diff --git a/src/test/resources/org/kohsuke/github/GHEventPayloadTest/wiremock/InstallationCreatedEvent/mappings/2-repositories_1296269.json b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/wiremock/InstallationCreatedEvent/mappings/2-repositories_1296269.json new file mode 100644 index 0000000000..bc21ed64a4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHEventPayloadTest/wiremock/InstallationCreatedEvent/mappings/2-repositories_1296269.json @@ -0,0 +1,46 @@ +{ + "id": "71720657-76be-4371-932d-edc25c1e1972", + "name": "repositories_1296269", + "request": { + "url": "/repositories/1296269", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-repositories_1296269.json", + "headers": { + "Server": "GitHub.com", + "Date": "Thu, 14 Mar 2024 00:05:07 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "public, max-age=60, s-maxage=60", + "Vary": "Accept, Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"463b3a1acb093fa3ed0bb1f11b4182aa6b7f54a6f613cb6293b24c6150c757f9\"", + "Last-Modified": "Wed, 13 Mar 2024 21:25:44 GMT", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-RateLimit-Limit": "60", + "X-RateLimit-Remaining": "59", + "X-RateLimit-Reset": "1710378307", + "X-RateLimit-Resource": "core", + "X-RateLimit-Used": "1", + "Accept-Ranges": "bytes", + "X-GitHub-Request-Id": "D434:1950C9:DD1F3:134998:65F23F32" + } + }, + "uuid": "71720657-76be-4371-932d-edc25c1e1972", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file