Skip to content

Commit 3ab9381

Browse files
committed
createCheckRunErrMissingConclusion
1 parent 58f1fe0 commit 3ab9381

File tree

4 files changed

+207
-0
lines changed

4 files changed

+207
-0
lines changed

src/test/java/org/kohsuke/github/GHCheckRunBuilderTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828

2929
import java.util.Date;
3030

31+
import static org.hamcrest.Matchers.containsString;
32+
3133
@SuppressWarnings("deprecation") // preview
3234
public class GHCheckRunBuilderTest extends AbstractGitHubWireMockTest {
3335

@@ -98,4 +100,18 @@ public void createPendingCheckRun() throws Exception {
98100
assertEquals(546469053, checkRun.id);
99101
}
100102

103+
@Test
104+
public void createCheckRunErrMissingConclusion() throws Exception {
105+
try {
106+
gitHub.getRepository("jglick/github-api-test")
107+
.createCheckRun("outstanding", "4a929d464a2fae7ee899ce603250f7dab304bc4b")
108+
.withStatus(GHCheckRun.Status.COMPLETED)
109+
.create();
110+
fail("should have been rejected");
111+
} catch (HttpException x) {
112+
assertEquals(422, x.getResponseCode());
113+
assertThat(x.getMessage(), containsString("\\\"conclusion\\\" wasn't supplied"));
114+
}
115+
}
116+
101117
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
{
2+
"id": 95711947,
3+
"node_id": "MDEwOlJlcG9zaXRvcnk5NTcxMTk0Nw==",
4+
"name": "github-api-test",
5+
"full_name": "jglick/github-api-test",
6+
"private": false,
7+
"owner": {
8+
"login": "jglick",
9+
"id": 154109,
10+
"node_id": "MDQ6VXNlcjE1NDEwOQ==",
11+
"avatar_url": "https://avatars1.githubusercontent.com/u/154109?v=4",
12+
"gravatar_id": "",
13+
"url": "https://api.github.com/users/jglick",
14+
"html_url": "https://github.com/jglick",
15+
"followers_url": "https://api.github.com/users/jglick/followers",
16+
"following_url": "https://api.github.com/users/jglick/following{/other_user}",
17+
"gists_url": "https://api.github.com/users/jglick/gists{/gist_id}",
18+
"starred_url": "https://api.github.com/users/jglick/starred{/owner}{/repo}",
19+
"subscriptions_url": "https://api.github.com/users/jglick/subscriptions",
20+
"organizations_url": "https://api.github.com/users/jglick/orgs",
21+
"repos_url": "https://api.github.com/users/jglick/repos",
22+
"events_url": "https://api.github.com/users/jglick/events{/privacy}",
23+
"received_events_url": "https://api.github.com/users/jglick/received_events",
24+
"type": "User",
25+
"site_admin": false
26+
},
27+
"html_url": "https://github.com/jglick/github-api-test",
28+
"description": "A test repository for testingthe github-api project",
29+
"fork": false,
30+
"url": "https://api.github.com/repos/jglick/github-api-test",
31+
"forks_url": "https://api.github.com/repos/jglick/github-api-test/forks",
32+
"keys_url": "https://api.github.com/repos/jglick/github-api-test/keys{/key_id}",
33+
"collaborators_url": "https://api.github.com/repos/jglick/github-api-test/collaborators{/collaborator}",
34+
"teams_url": "https://api.github.com/repos/jglick/github-api-test/teams",
35+
"hooks_url": "https://api.github.com/repos/jglick/github-api-test/hooks",
36+
"issue_events_url": "https://api.github.com/repos/jglick/github-api-test/issues/events{/number}",
37+
"events_url": "https://api.github.com/repos/jglick/github-api-test/events",
38+
"assignees_url": "https://api.github.com/repos/jglick/github-api-test/assignees{/user}",
39+
"branches_url": "https://api.github.com/repos/jglick/github-api-test/branches{/branch}",
40+
"tags_url": "https://api.github.com/repos/jglick/github-api-test/tags",
41+
"blobs_url": "https://api.github.com/repos/jglick/github-api-test/git/blobs{/sha}",
42+
"git_tags_url": "https://api.github.com/repos/jglick/github-api-test/git/tags{/sha}",
43+
"git_refs_url": "https://api.github.com/repos/jglick/github-api-test/git/refs{/sha}",
44+
"trees_url": "https://api.github.com/repos/jglick/github-api-test/git/trees{/sha}",
45+
"statuses_url": "https://api.github.com/repos/jglick/github-api-test/statuses/{sha}",
46+
"languages_url": "https://api.github.com/repos/jglick/github-api-test/languages",
47+
"stargazers_url": "https://api.github.com/repos/jglick/github-api-test/stargazers",
48+
"contributors_url": "https://api.github.com/repos/jglick/github-api-test/contributors",
49+
"subscribers_url": "https://api.github.com/repos/jglick/github-api-test/subscribers",
50+
"subscription_url": "https://api.github.com/repos/jglick/github-api-test/subscription",
51+
"commits_url": "https://api.github.com/repos/jglick/github-api-test/commits{/sha}",
52+
"git_commits_url": "https://api.github.com/repos/jglick/github-api-test/git/commits{/sha}",
53+
"comments_url": "https://api.github.com/repos/jglick/github-api-test/comments{/number}",
54+
"issue_comment_url": "https://api.github.com/repos/jglick/github-api-test/issues/comments{/number}",
55+
"contents_url": "https://api.github.com/repos/jglick/github-api-test/contents/{+path}",
56+
"compare_url": "https://api.github.com/repos/jglick/github-api-test/compare/{base}...{head}",
57+
"merges_url": "https://api.github.com/repos/jglick/github-api-test/merges",
58+
"archive_url": "https://api.github.com/repos/jglick/github-api-test/{archive_format}{/ref}",
59+
"downloads_url": "https://api.github.com/repos/jglick/github-api-test/downloads",
60+
"issues_url": "https://api.github.com/repos/jglick/github-api-test/issues{/number}",
61+
"pulls_url": "https://api.github.com/repos/jglick/github-api-test/pulls{/number}",
62+
"milestones_url": "https://api.github.com/repos/jglick/github-api-test/milestones{/number}",
63+
"notifications_url": "https://api.github.com/repos/jglick/github-api-test/notifications{?since,all,participating}",
64+
"labels_url": "https://api.github.com/repos/jglick/github-api-test/labels{/name}",
65+
"releases_url": "https://api.github.com/repos/jglick/github-api-test/releases{/id}",
66+
"deployments_url": "https://api.github.com/repos/jglick/github-api-test/deployments",
67+
"created_at": "2017-06-28T21:10:35Z",
68+
"updated_at": "2020-03-25T22:26:13Z",
69+
"pushed_at": "2020-03-25T22:26:10Z",
70+
"git_url": "git://github.com/jglick/github-api-test.git",
71+
"ssh_url": "[email protected]:jglick/github-api-test.git",
72+
"clone_url": "https://github.com/jglick/github-api-test.git",
73+
"svn_url": "https://github.com/jglick/github-api-test",
74+
"homepage": "http://github-api.kohsuke.org/",
75+
"size": 0,
76+
"stargazers_count": 0,
77+
"watchers_count": 0,
78+
"language": null,
79+
"has_issues": true,
80+
"has_projects": true,
81+
"has_downloads": true,
82+
"has_wiki": true,
83+
"has_pages": false,
84+
"forks_count": 0,
85+
"mirror_url": null,
86+
"archived": false,
87+
"disabled": false,
88+
"open_issues_count": 0,
89+
"license": null,
90+
"forks": 0,
91+
"open_issues": 0,
92+
"watchers": 0,
93+
"default_branch": "master",
94+
"permissions": {
95+
"admin": false,
96+
"push": false,
97+
"pull": false
98+
},
99+
"temp_clone_token": "",
100+
"network_count": 0,
101+
"subscribers_count": 0
102+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"id": "e95bdd52-5649-401e-a978-4ca6b8adf191",
3+
"name": "repos_jglick_github-api-test",
4+
"request": {
5+
"url": "/repos/jglick/github-api-test",
6+
"method": "GET",
7+
"headers": {
8+
"Accept": {
9+
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
10+
}
11+
}
12+
},
13+
"response": {
14+
"status": 200,
15+
"bodyFileName": "repos_jglick_github-api-test-1.json",
16+
"headers": {
17+
"Server": "GitHub.com",
18+
"Date": "Mon, 30 Mar 2020 19:00:33 GMT",
19+
"Content-Type": "application/json; charset=utf-8",
20+
"Status": "200 OK",
21+
"X-RateLimit-Limit": "5000",
22+
"X-RateLimit-Remaining": "4989",
23+
"X-RateLimit-Reset": "1585596209",
24+
"Cache-Control": "private, max-age=60, s-maxage=60",
25+
"Vary": [
26+
"Accept, Authorization, Cookie, X-GitHub-OTP",
27+
"Accept-Encoding, Accept, X-Requested-With"
28+
],
29+
"ETag": "W/\"c31ebce1d9b6ef50784ae33967251c4f\"",
30+
"Last-Modified": "Wed, 25 Mar 2020 22:26:13 GMT",
31+
"X-GitHub-Media-Type": "unknown, github.v3",
32+
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
33+
"X-Frame-Options": "deny",
34+
"X-Content-Type-Options": "nosniff",
35+
"X-XSS-Protection": "1; mode=block",
36+
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
37+
"Content-Security-Policy": "default-src 'none'",
38+
"X-GitHub-Request-Id": "BE04:665C:6EB6E0:11A912E:5E8241D1"
39+
}
40+
},
41+
"uuid": "e95bdd52-5649-401e-a978-4ca6b8adf191",
42+
"persistent": true,
43+
"insertionIndex": 1
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"id": "28f2e856-c999-4429-a7b7-e67d8ec0ea96",
3+
"name": "repos_jglick_github-api-test_check-runs",
4+
"request": {
5+
"url": "/repos/jglick/github-api-test/check-runs",
6+
"method": "POST",
7+
"headers": {
8+
"Accept": {
9+
"equalTo": "application/vnd.github.antiope-preview+json"
10+
}
11+
},
12+
"bodyPatterns": [
13+
{
14+
"equalToJson": "{\"name\":\"outstanding\",\"head_sha\":\"4a929d464a2fae7ee899ce603250f7dab304bc4b\",\"status\":\"completed\"}",
15+
"ignoreArrayOrder": true,
16+
"ignoreExtraElements": true
17+
}
18+
]
19+
},
20+
"response": {
21+
"status": 422,
22+
"body": "{\"message\":\"Invalid request.\\n\\nNo subschema in \\\"anyOf\\\" matched.\\n\\\"conclusion\\\" wasn't supplied.\\ncompleted is not a member of [\\\"queued\\\", \\\"in_progress\\\"].\",\"documentation_url\":\"https://developer.github.com/v3/checks/runs/#create-a-check-run\"}",
23+
"headers": {
24+
"Server": "GitHub.com",
25+
"Date": "Mon, 30 Mar 2020 19:00:33 GMT",
26+
"Content-Type": "application/json; charset=utf-8",
27+
"Status": "422 Unprocessable Entity",
28+
"X-RateLimit-Limit": "5000",
29+
"X-RateLimit-Remaining": "4988",
30+
"X-RateLimit-Reset": "1585596209",
31+
"X-GitHub-Media-Type": "github.antiope-preview; format=json",
32+
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
33+
"X-Frame-Options": "deny",
34+
"X-Content-Type-Options": "nosniff",
35+
"X-XSS-Protection": "1; mode=block",
36+
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
37+
"Content-Security-Policy": "default-src 'none'",
38+
"Vary": "Accept-Encoding, Accept, X-Requested-With",
39+
"X-GitHub-Request-Id": "BE04:665C:6EB6F3:11A9144:5E8241D1"
40+
}
41+
},
42+
"uuid": "28f2e856-c999-4429-a7b7-e67d8ec0ea96",
43+
"persistent": true,
44+
"insertionIndex": 2
45+
}

0 commit comments

Comments
 (0)