diff --git a/src/main/java/org/kohsuke/github/GHCheckRunBuilder.java b/src/main/java/org/kohsuke/github/GHCheckRunBuilder.java index 13e09cdd5e..b1ddcaf284 100644 --- a/src/main/java/org/kohsuke/github/GHCheckRunBuilder.java +++ b/src/main/java/org/kohsuke/github/GHCheckRunBuilder.java @@ -102,6 +102,23 @@ private GHCheckRunBuilder(GHRepository repo, Requester requester) { .withUrlPath(repo.getApiTailUrl("check-runs/" + checkId))); } + /** + * With name. + * + * @param name + * the name + * @param oldName + * the old name + * @return the GH check run builder + */ + public @NonNull GHCheckRunBuilder withName(@CheckForNull String name, String oldName) { + if (oldName == null) { + throw new GHException("Can not update uncreated check run"); + } + requester.with("name", name); + return this; + } + /** * With details URL. * diff --git a/src/test/java/org/kohsuke/github/GHCheckRunBuilderTest.java b/src/test/java/org/kohsuke/github/GHCheckRunBuilderTest.java index 9f8f11571e..a2594d307d 100644 --- a/src/test/java/org/kohsuke/github/GHCheckRunBuilderTest.java +++ b/src/test/java/org/kohsuke/github/GHCheckRunBuilderTest.java @@ -24,6 +24,7 @@ package org.kohsuke.github; +import org.junit.Assert; import org.junit.Test; import org.kohsuke.github.GHCheckRun.Status; @@ -195,4 +196,60 @@ public void updateCheckRun() throws Exception { assertThat(checkRun.getOutput().getAnnotationsCount(), equalTo(1)); } + /** + * Update check run with name. + * + * @throws Exception + * the exception + */ + @Test + public void updateCheckRunWithName() throws Exception { + GHCheckRun checkRun = getInstallationGithub().getRepository("hub4j-test-org/test-checks") + .createCheckRun("foo", "89a9ae301e35e667756034fdc933b1fc94f63fc1") + .withStatus(GHCheckRun.Status.IN_PROGRESS) + .withStartedAt(new Date(999_999_000)) + .add(new GHCheckRunBuilder.Output("Some Title", "what happened…") + .add(new GHCheckRunBuilder.Annotation("stuff.txt", + 1, + GHCheckRun.AnnotationLevel.NOTICE, + "hello to you too").withTitle("Look here"))) + .create(); + GHCheckRun updated = checkRun.update() + .withStatus(GHCheckRun.Status.COMPLETED) + .withConclusion(GHCheckRun.Conclusion.SUCCESS) + .withCompletedAt(new Date(999_999_999)) + .withName("bar", checkRun.getName()) + .create(); + assertThat(new Date(999_999_000), equalTo(updated.getStartedAt())); + assertThat("bar", equalTo(updated.getName())); + assertThat(checkRun.getOutput().getAnnotationsCount(), equalTo(1)); + } + + /** + * Update the check run with name exception. + * + * @throws Exception + * the exception + */ + @Test + public void updateCheckRunWithNameException() throws Exception { + snapshotNotAllowed(); + GHCheckRun checkRun = getInstallationGithub().getRepository("hub4j-test-org/test-checks") + .createCheckRun("foo", "89a9ae301e35e667756034fdc933b1fc94f63fc1") + .withStatus(GHCheckRun.Status.IN_PROGRESS) + .withStartedAt(new Date(999_999_000)) + .add(new GHCheckRunBuilder.Output("Some Title", "what happened…") + .add(new GHCheckRunBuilder.Annotation("stuff.txt", + 1, + GHCheckRun.AnnotationLevel.NOTICE, + "hello to you too").withTitle("Look here"))) + .create(); + Assert.assertThrows(GHException.class, + () -> checkRun.update() + .withStatus(GHCheckRun.Status.COMPLETED) + .withConclusion(GHCheckRun.Conclusion.SUCCESS) + .withCompletedAt(new Date(999_999_999)) + .withName("bar", null) + .create()); + } } diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/__files/1-app.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/__files/1-app.json new file mode 100644 index 0000000000..afcf6c442e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/__files/1-app.json @@ -0,0 +1,37 @@ +{ + "id": 89368, + "slug": "ghapi-test-app-3", + "node_id": "MDM6QXBwODkzNjg=", + "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 + }, + "name": "GHApi Test app 3", + "description": "Test app for checks api testing", + "external_url": "http://localhost", + "html_url": "https://github.com/apps/ghapi-test-app-3", + "created_at": "2020-11-19T14:30:34Z", + "updated_at": "2020-11-19T14:30:34Z", + "permissions": { + "checks": "write", + "metadata": "read" + }, + "events": [], + "installations_count": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/__files/2-app_installations.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/__files/2-app_installations.json new file mode 100644 index 0000000000..f5d238e69a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/__files/2-app_installations.json @@ -0,0 +1,45 @@ +[ + { + "id": 13064215, + "account": { + "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 + }, + "repository_selection": "selected", + "access_tokens_url": "https://api.github.com/app/installations/13064215/access_tokens", + "repositories_url": "https://api.github.com/installation/repositories", + "html_url": "https://github.com/organizations/hub4j-test-org/settings/installations/13064215", + "app_id": 89368, + "app_slug": "ghapi-test-app-3", + "target_id": 7544739, + "target_type": "Organization", + "permissions": { + "checks": "write", + "metadata": "read" + }, + "events": [], + "created_at": "2020-11-19T14:33:27.000Z", + "updated_at": "2020-11-19T14:33:27.000Z", + "single_file_name": null, + "has_multiple_single_files": false, + "single_file_paths": [], + "suspended_by": null, + "suspended_at": null + } +] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/__files/4-r_h_test-checks.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/__files/4-r_h_test-checks.json new file mode 100644 index 0000000000..9180f8d63e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/__files/4-r_h_test-checks.json @@ -0,0 +1,121 @@ +{ + "id": 314259932, + "node_id": "MDEwOlJlcG9zaXRvcnkzMTQyNTk5MzI=", + "name": "test-checks", + "full_name": "hub4j-test-org/test-checks", + "private": true, + "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/test-checks", + "description": "Repo for testing the checks API", + "fork": false, + "url": "https://api.github.com/repos/hub4j-test-org/test-checks", + "forks_url": "https://api.github.com/repos/hub4j-test-org/test-checks/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/test-checks/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/test-checks/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/test-checks/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/test-checks/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/test-checks/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/test-checks/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/test-checks/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/test-checks/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/test-checks/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/test-checks/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/test-checks/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/test-checks/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/test-checks/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/test-checks/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/test-checks/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/test-checks/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/test-checks/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/test-checks/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/test-checks/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/test-checks/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/test-checks/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/test-checks/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/test-checks/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/test-checks/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/test-checks/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/test-checks/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/test-checks/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/test-checks/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/test-checks/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/test-checks/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/test-checks/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/test-checks/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/test-checks/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/test-checks/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/test-checks/deployments", + "created_at": "2020-11-19T13:41:45Z", + "updated_at": "2020-11-19T13:41:50Z", + "pushed_at": "2020-11-19T13:41:47Z", + "git_url": "git://github.com/hub4j-test-org/test-checks.git", + "ssh_url": "git@github.com:hub4j-test-org/test-checks.git", + "clone_url": "https://github.com/hub4j-test-org/test-checks.git", + "svn_url": "https://github.com/hub4j-test-org/test-checks", + "homepage": null, + "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": false, + "push": false, + "pull": false + }, + "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 + }, + "network_count": 0, + "subscribers_count": 8 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/__files/5-r_h_t_check-runs.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/__files/5-r_h_t_check-runs.json new file mode 100644 index 0000000000..7850419983 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/__files/5-r_h_t_check-runs.json @@ -0,0 +1,61 @@ +{ + "id": 1424883037, + "node_id": "MDg6Q2hlY2tSdW4xNDI0ODgzMDM3", + "head_sha": "89a9ae301e35e667756034fdc933b1fc94f63fc1", + "external_id": "", + "url": "https://api.github.com/repos/hub4j-test-org/test-checks/check-runs/1424883037", + "html_url": "https://github.com/hub4j-test-org/test-checks/runs/1424883037", + "details_url": "http://localhost", + "status": "in_progress", + "conclusion": null, + "started_at": "1970-01-12T13:46:39Z", + "completed_at": null, + "output": { + "title": "Some Title", + "summary": "what happened…", + "text": null, + "annotations_count": 1, + "annotations_url": "https://api.github.com/repos/hub4j-test-org/test-checks/check-runs/1424883037/annotations" + }, + "name": "foo", + "check_suite": { + "id": 1529145983 + }, + "app": { + "id": 89368, + "slug": "ghapi-test-app-3", + "node_id": "MDM6QXBwODkzNjg=", + "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 + }, + "name": "GHApi Test app 3", + "description": "Test app for checks api testing", + "external_url": "http://localhost", + "html_url": "https://github.com/apps/ghapi-test-app-3", + "created_at": "2020-11-19T14:30:34Z", + "updated_at": "2020-11-19T14:30:34Z", + "permissions": { + "checks": "write", + "metadata": "read" + }, + "events": [] + }, + "pull_requests": [] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/__files/6-r_h_t_check-runs_1424883037.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/__files/6-r_h_t_check-runs_1424883037.json new file mode 100644 index 0000000000..3a1791dae3 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/__files/6-r_h_t_check-runs_1424883037.json @@ -0,0 +1,61 @@ +{ + "id": 1424883037, + "node_id": "MDg6Q2hlY2tSdW4xNDI0ODgzMDM3", + "head_sha": "89a9ae301e35e667756034fdc933b1fc94f63fc1", + "external_id": "", + "url": "https://api.github.com/repos/hub4j-test-org/test-checks/check-runs/1424883037", + "html_url": "https://github.com/hub4j-test-org/test-checks/runs/1424883037", + "details_url": "http://localhost", + "status": "completed", + "conclusion": "success", + "started_at": "1970-01-12T13:46:39Z", + "completed_at": "1970-01-12T13:46:39Z", + "output": { + "title": "Some Title", + "summary": "what happened…", + "text": null, + "annotations_count": 1, + "annotations_url": "https://api.github.com/repos/hub4j-test-org/test-checks/check-runs/1424883037/annotations" + }, + "name": "bar", + "check_suite": { + "id": 1529145983 + }, + "app": { + "id": 89368, + "slug": "ghapi-test-app-3", + "node_id": "MDM6QXBwODkzNjg=", + "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 + }, + "name": "GHApi Test app 3", + "description": "Test app for checks api testing", + "external_url": "http://localhost", + "html_url": "https://github.com/apps/ghapi-test-app-3", + "created_at": "2020-11-19T14:30:34Z", + "updated_at": "2020-11-19T14:30:34Z", + "permissions": { + "checks": "write", + "metadata": "read" + }, + "events": [] + }, + "pull_requests": [] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/1-app.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/1-app.json new file mode 100644 index 0000000000..668b9c78e8 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/1-app.json @@ -0,0 +1,41 @@ +{ + "id": "3c70ad51-1ec8-4f9a-bcb8-7bfb910eddde", + "name": "app", + "request": { + "url": "/app", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.machine-man-preview+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-app.json", + "headers": { + "Date": "Thu, 19 Nov 2020 15:00:14 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "Cache-Control": "public, max-age=60, s-maxage=60", + "Vary": [ + "Accept", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"174e4dd83df85fc873704d9b9e66883391e4ed80f0c537880e3f48f790fb4e47\"", + "X-GitHub-Media-Type": "github.v3; param=machine-man-preview; format=json", + "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": "FF88:5CCD:F9FCF:12C703:5FB6887D" + } + }, + "uuid": "3c70ad51-1ec8-4f9a-bcb8-7bfb910eddde", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/2-app_installations.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/2-app_installations.json new file mode 100644 index 0000000000..b5a96b307b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/2-app_installations.json @@ -0,0 +1,41 @@ +{ + "id": "884f6b51-8fe7-4ad0-ad66-153065217ac9", + "name": "app_installations", + "request": { + "url": "/app/installations", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.machine-man-preview+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-app_installations.json", + "headers": { + "Date": "Thu, 19 Nov 2020 15:00:14 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "Cache-Control": "public, max-age=60, s-maxage=60", + "Vary": [ + "Accept", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"e9ffa0e78284d854058825e6267f828446fcd9f96430ce74e40eac816f7e6b19\"", + "X-GitHub-Media-Type": "github.v3; param=machine-man-preview; format=json", + "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": "FF88:5CCD:F9FF2:12C712:5FB6887E" + } + }, + "uuid": "884f6b51-8fe7-4ad0-ad66-153065217ac9", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/3-a_i_13064215_access_tokens.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/3-a_i_13064215_access_tokens.json new file mode 100644 index 0000000000..07c8671896 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/3-a_i_13064215_access_tokens.json @@ -0,0 +1,48 @@ +{ + "id": "f8aa5155-92d9-45b2-ab6b-0da7da04aa90", + "name": "app_installations_13064215_access_tokens", + "request": { + "url": "/app/installations/13064215/access_tokens", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.machine-man-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "body": "{\"token\":\"v1.863b98cefabd9051b3ed689c292b2b3dfcc2ebda\",\"expires_at\":\"2020-11-19T16:00:14Z\",\"permissions\":{\"checks\":\"write\",\"metadata\":\"read\"},\"repository_selection\":\"selected\"}", + "headers": { + "Date": "Thu, 19 Nov 2020 15:00:14 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "Cache-Control": "public, max-age=60, s-maxage=60", + "Vary": [ + "Accept", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "\"8aefacfda57dae4b6767ded5e7a75efe48de7d90e408faf799a553f49e5526b2\"", + "X-GitHub-Media-Type": "github.v3; param=machine-man-preview; format=json", + "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": "FF88:5CCD:F9FFB:12C72E:5FB6887E" + } + }, + "uuid": "f8aa5155-92d9-45b2-ab6b-0da7da04aa90", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/4-r_h_test-checks.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/4-r_h_test-checks.json new file mode 100644 index 0000000000..7cdbfc62d7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/4-r_h_test-checks.json @@ -0,0 +1,46 @@ +{ + "id": "332ba146-527b-45e5-bf22-a9e3215f2bb3", + "name": "repos_hub4j-test-org_test-checks", + "request": { + "url": "/repos/hub4j-test-org/test-checks", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "4-r_h_test-checks.json", + "headers": { + "Date": "Thu, 19 Nov 2020 15:00:15 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"d86b3f134228e83d20eeae57dd9fbe037bf3fb0ada3c66f3fd3f2cc459e644ef\"", + "Last-Modified": "Thu, 19 Nov 2020 13:41:50 GMT", + "X-GitHub-Media-Type": "unknown, github.v3", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4846", + "X-RateLimit-Reset": "1605800044", + "X-RateLimit-Used": "154", + "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": "FF88:5CCD:FA008:12C73D:5FB6887E" + } + }, + "uuid": "332ba146-527b-45e5-bf22-a9e3215f2bb3", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/5-r_h_t_check-runs.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/5-r_h_t_check-runs.json new file mode 100644 index 0000000000..745369d9bb --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/5-r_h_t_check-runs.json @@ -0,0 +1,53 @@ +{ + "id": "e6a1efc0-842a-4acb-bb97-41992174417f", + "name": "repos_hub4j-test-org_test-checks_check-runs", + "request": { + "url": "/repos/hub4j-test-org/test-checks/check-runs", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.antiope-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"output\":{\"title\":\"Some Title\",\"summary\":\"what happened…\",\"annotations\":[{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello to you too\",\"title\":\"Look here\"}]},\"name\":\"foo\",\"started_at\":\"1970-01-12T13:46:39Z\",\"head_sha\":\"89a9ae301e35e667756034fdc933b1fc94f63fc1\",\"status\":\"in_progress\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "5-r_h_t_check-runs.json", + "headers": { + "Date": "Thu, 19 Nov 2020 15:00:15 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "\"e515857f9f590a0d2a3f5873ed6ba191f8058e09f22b3f90c7326aa9bf5da940\"", + "Location": "https://api.github.com/repos/hub4j-test-org/test-checks/check-runs/1424883037", + "X-GitHub-Media-Type": "github.v3; param=antiope-preview; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4845", + "X-RateLimit-Reset": "1605800044", + "X-RateLimit-Used": "155", + "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": "FF88:5CCD:FA010:12C749:5FB6887F" + } + }, + "uuid": "e6a1efc0-842a-4acb-bb97-41992174417f", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/6-r_h_t_check-runs_1424883037.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/6-r_h_t_check-runs_1424883037.json new file mode 100644 index 0000000000..e4c61c75a9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithName/mappings/6-r_h_t_check-runs_1424883037.json @@ -0,0 +1,52 @@ +{ + "id": "0e994765-90de-46eb-897a-27ab3d509c28", + "name": "repos_hub4j-test-org_test-checks_check-runs_1424883037", + "request": { + "url": "/repos/hub4j-test-org/test-checks/check-runs/1424883037", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.antiope-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"name\":\"bar\",\"conclusion\":\"success\",\"completed_at\":\"1970-01-12T13:46:39Z\",\"status\":\"completed\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "6-r_h_t_check-runs_1424883037.json", + "headers": { + "Date": "Thu, 19 Nov 2020 15:00:16 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"cc3761505c9689d9473d068a806ab77bd725a5a92ec88e74a826f56f38d129d8\"", + "X-GitHub-Media-Type": "github.v3; param=antiope-preview; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4844", + "X-RateLimit-Reset": "1605800044", + "X-RateLimit-Used": "156", + "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": "FF88:5CCD:FA018:12C753:5FB6887F" + } + }, + "uuid": "0e994765-90de-46eb-897a-27ab3d509c28", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/__files/1-app.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/__files/1-app.json new file mode 100644 index 0000000000..afcf6c442e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/__files/1-app.json @@ -0,0 +1,37 @@ +{ + "id": 89368, + "slug": "ghapi-test-app-3", + "node_id": "MDM6QXBwODkzNjg=", + "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 + }, + "name": "GHApi Test app 3", + "description": "Test app for checks api testing", + "external_url": "http://localhost", + "html_url": "https://github.com/apps/ghapi-test-app-3", + "created_at": "2020-11-19T14:30:34Z", + "updated_at": "2020-11-19T14:30:34Z", + "permissions": { + "checks": "write", + "metadata": "read" + }, + "events": [], + "installations_count": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/__files/2-app_installations.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/__files/2-app_installations.json new file mode 100644 index 0000000000..f5d238e69a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/__files/2-app_installations.json @@ -0,0 +1,45 @@ +[ + { + "id": 13064215, + "account": { + "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 + }, + "repository_selection": "selected", + "access_tokens_url": "https://api.github.com/app/installations/13064215/access_tokens", + "repositories_url": "https://api.github.com/installation/repositories", + "html_url": "https://github.com/organizations/hub4j-test-org/settings/installations/13064215", + "app_id": 89368, + "app_slug": "ghapi-test-app-3", + "target_id": 7544739, + "target_type": "Organization", + "permissions": { + "checks": "write", + "metadata": "read" + }, + "events": [], + "created_at": "2020-11-19T14:33:27.000Z", + "updated_at": "2020-11-19T14:33:27.000Z", + "single_file_name": null, + "has_multiple_single_files": false, + "single_file_paths": [], + "suspended_by": null, + "suspended_at": null + } +] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/__files/4-r_h_test-checks.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/__files/4-r_h_test-checks.json new file mode 100644 index 0000000000..9180f8d63e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/__files/4-r_h_test-checks.json @@ -0,0 +1,121 @@ +{ + "id": 314259932, + "node_id": "MDEwOlJlcG9zaXRvcnkzMTQyNTk5MzI=", + "name": "test-checks", + "full_name": "hub4j-test-org/test-checks", + "private": true, + "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/test-checks", + "description": "Repo for testing the checks API", + "fork": false, + "url": "https://api.github.com/repos/hub4j-test-org/test-checks", + "forks_url": "https://api.github.com/repos/hub4j-test-org/test-checks/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/test-checks/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/test-checks/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/test-checks/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/test-checks/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/test-checks/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/test-checks/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/test-checks/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/test-checks/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/test-checks/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/test-checks/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/test-checks/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/test-checks/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/test-checks/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/test-checks/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/test-checks/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/test-checks/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/test-checks/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/test-checks/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/test-checks/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/test-checks/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/test-checks/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/test-checks/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/test-checks/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/test-checks/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/test-checks/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/test-checks/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/test-checks/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/test-checks/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/test-checks/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/test-checks/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/test-checks/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/test-checks/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/test-checks/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/test-checks/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/test-checks/deployments", + "created_at": "2020-11-19T13:41:45Z", + "updated_at": "2020-11-19T13:41:50Z", + "pushed_at": "2020-11-19T13:41:47Z", + "git_url": "git://github.com/hub4j-test-org/test-checks.git", + "ssh_url": "git@github.com:hub4j-test-org/test-checks.git", + "clone_url": "https://github.com/hub4j-test-org/test-checks.git", + "svn_url": "https://github.com/hub4j-test-org/test-checks", + "homepage": null, + "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": false, + "push": false, + "pull": false + }, + "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 + }, + "network_count": 0, + "subscribers_count": 8 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/__files/5-r_h_t_check-runs.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/__files/5-r_h_t_check-runs.json new file mode 100644 index 0000000000..7850419983 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/__files/5-r_h_t_check-runs.json @@ -0,0 +1,61 @@ +{ + "id": 1424883037, + "node_id": "MDg6Q2hlY2tSdW4xNDI0ODgzMDM3", + "head_sha": "89a9ae301e35e667756034fdc933b1fc94f63fc1", + "external_id": "", + "url": "https://api.github.com/repos/hub4j-test-org/test-checks/check-runs/1424883037", + "html_url": "https://github.com/hub4j-test-org/test-checks/runs/1424883037", + "details_url": "http://localhost", + "status": "in_progress", + "conclusion": null, + "started_at": "1970-01-12T13:46:39Z", + "completed_at": null, + "output": { + "title": "Some Title", + "summary": "what happened…", + "text": null, + "annotations_count": 1, + "annotations_url": "https://api.github.com/repos/hub4j-test-org/test-checks/check-runs/1424883037/annotations" + }, + "name": "foo", + "check_suite": { + "id": 1529145983 + }, + "app": { + "id": 89368, + "slug": "ghapi-test-app-3", + "node_id": "MDM6QXBwODkzNjg=", + "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 + }, + "name": "GHApi Test app 3", + "description": "Test app for checks api testing", + "external_url": "http://localhost", + "html_url": "https://github.com/apps/ghapi-test-app-3", + "created_at": "2020-11-19T14:30:34Z", + "updated_at": "2020-11-19T14:30:34Z", + "permissions": { + "checks": "write", + "metadata": "read" + }, + "events": [] + }, + "pull_requests": [] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/mappings/1-app.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/mappings/1-app.json new file mode 100644 index 0000000000..668b9c78e8 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/mappings/1-app.json @@ -0,0 +1,41 @@ +{ + "id": "3c70ad51-1ec8-4f9a-bcb8-7bfb910eddde", + "name": "app", + "request": { + "url": "/app", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.machine-man-preview+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-app.json", + "headers": { + "Date": "Thu, 19 Nov 2020 15:00:14 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "Cache-Control": "public, max-age=60, s-maxage=60", + "Vary": [ + "Accept", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"174e4dd83df85fc873704d9b9e66883391e4ed80f0c537880e3f48f790fb4e47\"", + "X-GitHub-Media-Type": "github.v3; param=machine-man-preview; format=json", + "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": "FF88:5CCD:F9FCF:12C703:5FB6887D" + } + }, + "uuid": "3c70ad51-1ec8-4f9a-bcb8-7bfb910eddde", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/mappings/2-app_installations.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/mappings/2-app_installations.json new file mode 100644 index 0000000000..b5a96b307b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/mappings/2-app_installations.json @@ -0,0 +1,41 @@ +{ + "id": "884f6b51-8fe7-4ad0-ad66-153065217ac9", + "name": "app_installations", + "request": { + "url": "/app/installations", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.machine-man-preview+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-app_installations.json", + "headers": { + "Date": "Thu, 19 Nov 2020 15:00:14 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "Cache-Control": "public, max-age=60, s-maxage=60", + "Vary": [ + "Accept", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"e9ffa0e78284d854058825e6267f828446fcd9f96430ce74e40eac816f7e6b19\"", + "X-GitHub-Media-Type": "github.v3; param=machine-man-preview; format=json", + "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": "FF88:5CCD:F9FF2:12C712:5FB6887E" + } + }, + "uuid": "884f6b51-8fe7-4ad0-ad66-153065217ac9", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/mappings/3-a_i_13064215_access_tokens.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/mappings/3-a_i_13064215_access_tokens.json new file mode 100644 index 0000000000..07c8671896 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/mappings/3-a_i_13064215_access_tokens.json @@ -0,0 +1,48 @@ +{ + "id": "f8aa5155-92d9-45b2-ab6b-0da7da04aa90", + "name": "app_installations_13064215_access_tokens", + "request": { + "url": "/app/installations/13064215/access_tokens", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.machine-man-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "body": "{\"token\":\"v1.863b98cefabd9051b3ed689c292b2b3dfcc2ebda\",\"expires_at\":\"2020-11-19T16:00:14Z\",\"permissions\":{\"checks\":\"write\",\"metadata\":\"read\"},\"repository_selection\":\"selected\"}", + "headers": { + "Date": "Thu, 19 Nov 2020 15:00:14 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "Cache-Control": "public, max-age=60, s-maxage=60", + "Vary": [ + "Accept", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "\"8aefacfda57dae4b6767ded5e7a75efe48de7d90e408faf799a553f49e5526b2\"", + "X-GitHub-Media-Type": "github.v3; param=machine-man-preview; format=json", + "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": "FF88:5CCD:F9FFB:12C72E:5FB6887E" + } + }, + "uuid": "f8aa5155-92d9-45b2-ab6b-0da7da04aa90", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/mappings/4-r_h_test-checks.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/mappings/4-r_h_test-checks.json new file mode 100644 index 0000000000..7cdbfc62d7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/mappings/4-r_h_test-checks.json @@ -0,0 +1,46 @@ +{ + "id": "332ba146-527b-45e5-bf22-a9e3215f2bb3", + "name": "repos_hub4j-test-org_test-checks", + "request": { + "url": "/repos/hub4j-test-org/test-checks", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "4-r_h_test-checks.json", + "headers": { + "Date": "Thu, 19 Nov 2020 15:00:15 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"d86b3f134228e83d20eeae57dd9fbe037bf3fb0ada3c66f3fd3f2cc459e644ef\"", + "Last-Modified": "Thu, 19 Nov 2020 13:41:50 GMT", + "X-GitHub-Media-Type": "unknown, github.v3", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4846", + "X-RateLimit-Reset": "1605800044", + "X-RateLimit-Used": "154", + "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": "FF88:5CCD:FA008:12C73D:5FB6887E" + } + }, + "uuid": "332ba146-527b-45e5-bf22-a9e3215f2bb3", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/mappings/5-r_h_t_check-runs.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/mappings/5-r_h_t_check-runs.json new file mode 100644 index 0000000000..745369d9bb --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/updateCheckRunWithNameException/mappings/5-r_h_t_check-runs.json @@ -0,0 +1,53 @@ +{ + "id": "e6a1efc0-842a-4acb-bb97-41992174417f", + "name": "repos_hub4j-test-org_test-checks_check-runs", + "request": { + "url": "/repos/hub4j-test-org/test-checks/check-runs", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.antiope-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"output\":{\"title\":\"Some Title\",\"summary\":\"what happened…\",\"annotations\":[{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello to you too\",\"title\":\"Look here\"}]},\"name\":\"foo\",\"started_at\":\"1970-01-12T13:46:39Z\",\"head_sha\":\"89a9ae301e35e667756034fdc933b1fc94f63fc1\",\"status\":\"in_progress\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "5-r_h_t_check-runs.json", + "headers": { + "Date": "Thu, 19 Nov 2020 15:00:15 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "\"e515857f9f590a0d2a3f5873ed6ba191f8058e09f22b3f90c7326aa9bf5da940\"", + "Location": "https://api.github.com/repos/hub4j-test-org/test-checks/check-runs/1424883037", + "X-GitHub-Media-Type": "github.v3; param=antiope-preview; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4845", + "X-RateLimit-Reset": "1605800044", + "X-RateLimit-Used": "155", + "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": "FF88:5CCD:FA010:12C749:5FB6887F" + } + }, + "uuid": "e6a1efc0-842a-4acb-bb97-41992174417f", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file