Skip to content

Commit 06c3a27

Browse files
authored
Merge pull request #1809 from gsmet/pr-no-reviews
Make sure we return an empty list when no reviews
2 parents 22d4154 + 9bd83fb commit 06c3a27

File tree

44 files changed

+1032
-2077
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1032
-2077
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,18 @@ public void closePullRequest() throws Exception {
231231
public void pullRequestReviews() throws Exception {
232232
String name = "testPullRequestReviews";
233233
GHPullRequest p = getRepository().createPullRequest(name, "test/stable", "main", "## test");
234+
235+
List<GHPullRequestReview> reviews = p.listReviews().toList();
236+
assertThat(reviews.size(), is(0));
237+
234238
GHPullRequestReview draftReview = p.createReview()
235239
.body("Some draft review")
236240
.comment("Some niggle", "README.md", 1)
237241
.create();
238242
assertThat(draftReview.getState(), is(GHPullRequestReviewState.PENDING));
239243
assertThat(draftReview.getBody(), is("Some draft review"));
240244
assertThat(draftReview.getCommitId(), notNullValue());
241-
List<GHPullRequestReview> reviews = p.listReviews().toList();
245+
reviews = p.listReviews().toList();
242246
assertThat(reviews.size(), is(1));
243247
GHPullRequestReview review = reviews.get(0);
244248
assertThat(review.getState(), is(GHPullRequestReviewState.PENDING));
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"login": "hub4j-test-org",
3+
"id": 7544739,
4+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
5+
"url": "https://api.github.com/orgs/hub4j-test-org",
6+
"repos_url": "https://api.github.com/orgs/hub4j-test-org/repos",
7+
"events_url": "https://api.github.com/orgs/hub4j-test-org/events",
8+
"hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks",
9+
"issues_url": "https://api.github.com/orgs/hub4j-test-org/issues",
10+
"members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}",
11+
"public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}",
12+
"avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4",
13+
"description": "Hub4j Test Org Description (this could be null or blank too)",
14+
"name": "Hub4j Test Org Name (this could be null or blank too)",
15+
"company": null,
16+
"blog": "https://hub4j.url.io/could/be/null",
17+
"location": "Hub4j Test Org Location (this could be null or blank too)",
18+
"email": "[email protected]",
19+
"twitter_username": null,
20+
"is_verified": false,
21+
"has_organization_projects": true,
22+
"has_repository_projects": true,
23+
"public_repos": 26,
24+
"public_gists": 0,
25+
"followers": 2,
26+
"following": 0,
27+
"html_url": "https://github.com/hub4j-test-org",
28+
"created_at": "2014-05-10T19:39:11Z",
29+
"updated_at": "2020-06-04T05:56:10Z",
30+
"archived_at": null,
31+
"type": "Organization",
32+
"total_private_repos": 6,
33+
"owned_private_repos": 6,
34+
"private_gists": 0,
35+
"disk_usage": 12014,
36+
"collaborators": 1,
37+
"billing_email": "[email protected]",
38+
"default_repository_permission": "none",
39+
"members_can_create_repositories": false,
40+
"two_factor_requirement_enabled": false,
41+
"members_allowed_repository_creation_type": "none",
42+
"members_can_create_public_repositories": false,
43+
"members_can_create_private_repositories": false,
44+
"members_can_create_internal_repositories": false,
45+
"members_can_create_pages": true,
46+
"members_can_fork_private_repositories": false,
47+
"web_commit_signoff_required": false,
48+
"members_can_create_public_pages": true,
49+
"members_can_create_private_pages": true,
50+
"plan": {
51+
"name": "free",
52+
"space": 976562499,
53+
"private_repos": 10000,
54+
"filled_seats": 50,
55+
"seats": 3
56+
},
57+
"advanced_security_enabled_for_new_repositories": false,
58+
"dependabot_alerts_enabled_for_new_repositories": false,
59+
"dependabot_security_updates_enabled_for_new_repositories": false,
60+
"dependency_graph_enabled_for_new_repositories": false,
61+
"secret_scanning_enabled_for_new_repositories": false,
62+
"secret_scanning_push_protection_enabled_for_new_repositories": false,
63+
"secret_scanning_push_protection_custom_link_enabled": false,
64+
"secret_scanning_push_protection_custom_link": null,
65+
"secret_scanning_validity_checks_enabled": false
66+
}

src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/pullRequestReviews/__files/1-user.json

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/pullRequestReviews/__files/10-r_h_g_pulls_258_reviews_285200957.json

Lines changed: 0 additions & 38 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"id": 1926195021,
3+
"node_id": "PRR_kwDODFTdCc5yz2dN",
4+
"user": {
5+
"login": "gsmet",
6+
"id": 1279749,
7+
"node_id": "MDQ6VXNlcjEyNzk3NDk=",
8+
"avatar_url": "https://avatars.githubusercontent.com/u/1279749?u=e462a6165ea17647aed446ca31fae604338ae18c&v=4",
9+
"gravatar_id": "",
10+
"url": "https://api.github.com/users/gsmet",
11+
"html_url": "https://github.com/gsmet",
12+
"followers_url": "https://api.github.com/users/gsmet/followers",
13+
"following_url": "https://api.github.com/users/gsmet/following{/other_user}",
14+
"gists_url": "https://api.github.com/users/gsmet/gists{/gist_id}",
15+
"starred_url": "https://api.github.com/users/gsmet/starred{/owner}{/repo}",
16+
"subscriptions_url": "https://api.github.com/users/gsmet/subscriptions",
17+
"organizations_url": "https://api.github.com/users/gsmet/orgs",
18+
"repos_url": "https://api.github.com/users/gsmet/repos",
19+
"events_url": "https://api.github.com/users/gsmet/events{/privacy}",
20+
"received_events_url": "https://api.github.com/users/gsmet/received_events",
21+
"type": "User",
22+
"site_admin": false
23+
},
24+
"body": "Some new review",
25+
"state": "PENDING",
26+
"html_url": "https://github.com/hub4j-test-org/github-api/pull/475#pullrequestreview-1926195021",
27+
"pull_request_url": "https://api.github.com/repos/hub4j-test-org/github-api/pulls/475",
28+
"author_association": "MEMBER",
29+
"_links": {
30+
"html": {
31+
"href": "https://github.com/hub4j-test-org/github-api/pull/475#pullrequestreview-1926195021"
32+
},
33+
"pull_request": {
34+
"href": "https://api.github.com/repos/hub4j-test-org/github-api/pulls/475"
35+
}
36+
},
37+
"commit_id": "07374fe73aff1c2024a8d4114b32406c7a8e89b7"
38+
}

0 commit comments

Comments
 (0)