Skip to content

Commit 4dd1e25

Browse files
committed
feat: test marking non-drafted pr ready for review
1 parent efe9696 commit 4dd1e25

9 files changed

Lines changed: 1089 additions & 0 deletions

File tree

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,28 @@ public void markReadyForReview() throws Exception {
436436
assertThat(p.isDraft(), is(false));
437437
}
438438

439+
/**
440+
* Marking a non-draft pull request as ready for review throws an exception.
441+
*
442+
* @throws Exception
443+
* the exception
444+
*/
445+
@Test
446+
public void markReadyForReviewNonDraft() throws Exception {
447+
// Create a non-draft PR
448+
GHPullRequest p = getRepository()
449+
.createPullRequest("markReadyForReviewNonDraft", "test/stable", "main", "## test");
450+
assertThat(p.isDraft(), is(false));
451+
452+
// Attempting to mark a non-draft PR as ready should throw
453+
try {
454+
p.markReadyForReview();
455+
fail("Expected IllegalStateException");
456+
} catch (IllegalStateException e) {
457+
assertThat(e.getMessage(), equalTo("Pull request is not a draft"));
458+
}
459+
}
460+
439461
/**
440462
* Merge commit SHA.
441463
*
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"login": "Anonycoders",
3+
"id": 40047636,
4+
"node_id": "MDQ6VXNlcjQwMDQ3NjM2",
5+
"avatar_url": "https://avatars.githubusercontent.com/u/40047636?v=4",
6+
"gravatar_id": "",
7+
"url": "https://api.github.com/users/Anonycoders",
8+
"html_url": "https://github.com/Anonycoders",
9+
"followers_url": "https://api.github.com/users/Anonycoders/followers",
10+
"following_url": "https://api.github.com/users/Anonycoders/following{/other_user}",
11+
"gists_url": "https://api.github.com/users/Anonycoders/gists{/gist_id}",
12+
"starred_url": "https://api.github.com/users/Anonycoders/starred{/owner}{/repo}",
13+
"subscriptions_url": "https://api.github.com/users/Anonycoders/subscriptions",
14+
"organizations_url": "https://api.github.com/users/Anonycoders/orgs",
15+
"repos_url": "https://api.github.com/users/Anonycoders/repos",
16+
"events_url": "https://api.github.com/users/Anonycoders/events{/privacy}",
17+
"received_events_url": "https://api.github.com/users/Anonycoders/received_events",
18+
"type": "User",
19+
"user_view_type": "public",
20+
"site_admin": false,
21+
"name": "Sorena Sarabadani",
22+
"company": "@Adevinta",
23+
"blog": "",
24+
"location": "Berlin, Germany",
25+
"email": "[email protected]",
26+
"hireable": null,
27+
"bio": "Ex-Shopifyer - Adevinta/Kleinanzeigen",
28+
"twitter_username": "sorena_s",
29+
"notification_email": "[email protected]",
30+
"public_repos": 12,
31+
"public_gists": 0,
32+
"followers": 38,
33+
"following": 4,
34+
"created_at": "2018-06-08T02:07:15Z",
35+
"updated_at": "2026-01-24T22:07:12Z"
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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": 27,
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": "2025-08-05T00:53:03Z",
30+
"archived_at": null,
31+
"type": "Organization",
32+
"total_private_repos": 8,
33+
"owned_private_repos": 8,
34+
"private_gists": 0,
35+
"disk_usage": 12076,
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+
"deploy_keys_enabled_for_repositories": false,
49+
"members_can_delete_repositories": true,
50+
"members_can_change_repo_visibility": true,
51+
"members_can_invite_outside_collaborators": true,
52+
"members_can_delete_issues": false,
53+
"display_commenter_full_name_setting_enabled": false,
54+
"readers_can_create_discussions": true,
55+
"members_can_create_teams": true,
56+
"members_can_view_dependency_insights": true,
57+
"default_repository_branch": "main",
58+
"members_can_create_public_pages": true,
59+
"members_can_create_private_pages": true,
60+
"plan": {
61+
"name": "free",
62+
"space": 976562499,
63+
"private_repos": 10000,
64+
"filled_seats": 53,
65+
"seats": 3
66+
},
67+
"advanced_security_enabled_for_new_repositories": false,
68+
"dependabot_alerts_enabled_for_new_repositories": false,
69+
"dependabot_security_updates_enabled_for_new_repositories": false,
70+
"dependency_graph_enabled_for_new_repositories": false,
71+
"secret_scanning_enabled_for_new_repositories": false,
72+
"secret_scanning_push_protection_enabled_for_new_repositories": false,
73+
"secret_scanning_push_protection_custom_link_enabled": false,
74+
"secret_scanning_push_protection_custom_link": null,
75+
"secret_scanning_validity_checks_enabled": false
76+
}

0 commit comments

Comments
 (0)