Skip to content

Commit 597a9bb

Browse files
committed
test: implement test for enable pull request auto merge
1 parent 818f077 commit 597a9bb

File tree

13 files changed

+1318
-0
lines changed

13 files changed

+1318
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,30 @@ public void refreshFromSearchResults() throws Exception {
10361036
pullRequestFromSearchResults.close();
10371037
}
10381038

1039+
@Test
1040+
public void enablePullRequestAutoMerge() throws IOException {
1041+
String authorEmail = "[email protected]";
1042+
String clientMutationId = "github-api";
1043+
String commitBody = "This is commit body.";
1044+
String commitTitle = "This is commit title.";
1045+
String expectedCommitHeadOid = "4888b44d7204dd05680e90159af839c8b1194b6d";
1046+
1047+
GHPullRequest pullRequest = gitHub.getRepository("seate/for-test").getPullRequest(9);
1048+
1049+
pullRequest.requestEnableAutoMerge(authorEmail,
1050+
clientMutationId,
1051+
commitBody,
1052+
commitTitle,
1053+
expectedCommitHeadOid,
1054+
GHPullRequest.MergeMethod.MERGE);
1055+
1056+
AutoMerge autoMerge = pullRequest.getAutoMerge();
1057+
assertThat(autoMerge.getEnabledBy().getEmail(), is(authorEmail));
1058+
assertThat(autoMerge.getCommitMessage(), is(commitBody));
1059+
assertThat(autoMerge.getCommitTitle(), is(commitTitle));
1060+
assertThat(autoMerge.getMergeMethod(), is(GHPullRequest.MergeMethod.MERGE));
1061+
}
1062+
10391063
/**
10401064
* Gets the repository.
10411065
*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"login": "seate",
3+
"id": 86824703,
4+
"node_id": "MDQ6VXNlcjg2ODI0NzAz",
5+
"avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4",
6+
"gravatar_id": "",
7+
"url": "https://api.github.com/users/seate",
8+
"html_url": "https://github.com/seate",
9+
"followers_url": "https://api.github.com/users/seate/followers",
10+
"following_url": "https://api.github.com/users/seate/following{/other_user}",
11+
"gists_url": "https://api.github.com/users/seate/gists{/gist_id}",
12+
"starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}",
13+
"subscriptions_url": "https://api.github.com/users/seate/subscriptions",
14+
"organizations_url": "https://api.github.com/users/seate/orgs",
15+
"repos_url": "https://api.github.com/users/seate/repos",
16+
"events_url": "https://api.github.com/users/seate/events{/privacy}",
17+
"received_events_url": "https://api.github.com/users/seate/received_events",
18+
"type": "User",
19+
"user_view_type": "public",
20+
"site_admin": false,
21+
"name": "KIMSIWOO",
22+
"company": "Inha university",
23+
"blog": "",
24+
"location": null,
25+
"email": "[email protected]",
26+
"hireable": null,
27+
"bio": null,
28+
"twitter_username": null,
29+
"notification_email": "[email protected]",
30+
"public_repos": 34,
31+
"public_gists": 0,
32+
"followers": 2,
33+
"following": 2,
34+
"created_at": "2021-07-02T07:40:16Z",
35+
"updated_at": "2025-03-03T13:26:53Z"
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
{
2+
"id": 933252913,
3+
"node_id": "R_kgDON6BPMQ",
4+
"name": "for-test",
5+
"full_name": "seate/for-test",
6+
"private": false,
7+
"owner": {
8+
"login": "seate",
9+
"id": 86824703,
10+
"node_id": "MDQ6VXNlcjg2ODI0NzAz",
11+
"avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4",
12+
"gravatar_id": "",
13+
"url": "https://api.github.com/users/seate",
14+
"html_url": "https://github.com/seate",
15+
"followers_url": "https://api.github.com/users/seate/followers",
16+
"following_url": "https://api.github.com/users/seate/following{/other_user}",
17+
"gists_url": "https://api.github.com/users/seate/gists{/gist_id}",
18+
"starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}",
19+
"subscriptions_url": "https://api.github.com/users/seate/subscriptions",
20+
"organizations_url": "https://api.github.com/users/seate/orgs",
21+
"repos_url": "https://api.github.com/users/seate/repos",
22+
"events_url": "https://api.github.com/users/seate/events{/privacy}",
23+
"received_events_url": "https://api.github.com/users/seate/received_events",
24+
"type": "User",
25+
"user_view_type": "public",
26+
"site_admin": false
27+
},
28+
"html_url": "https://github.com/seate/for-test",
29+
"description": "깃허브 테스트용 레포",
30+
"fork": false,
31+
"url": "https://api.github.com/repos/seate/for-test",
32+
"forks_url": "https://api.github.com/repos/seate/for-test/forks",
33+
"keys_url": "https://api.github.com/repos/seate/for-test/keys{/key_id}",
34+
"collaborators_url": "https://api.github.com/repos/seate/for-test/collaborators{/collaborator}",
35+
"teams_url": "https://api.github.com/repos/seate/for-test/teams",
36+
"hooks_url": "https://api.github.com/repos/seate/for-test/hooks",
37+
"issue_events_url": "https://api.github.com/repos/seate/for-test/issues/events{/number}",
38+
"events_url": "https://api.github.com/repos/seate/for-test/events",
39+
"assignees_url": "https://api.github.com/repos/seate/for-test/assignees{/user}",
40+
"branches_url": "https://api.github.com/repos/seate/for-test/branches{/branch}",
41+
"tags_url": "https://api.github.com/repos/seate/for-test/tags",
42+
"blobs_url": "https://api.github.com/repos/seate/for-test/git/blobs{/sha}",
43+
"git_tags_url": "https://api.github.com/repos/seate/for-test/git/tags{/sha}",
44+
"git_refs_url": "https://api.github.com/repos/seate/for-test/git/refs{/sha}",
45+
"trees_url": "https://api.github.com/repos/seate/for-test/git/trees{/sha}",
46+
"statuses_url": "https://api.github.com/repos/seate/for-test/statuses/{sha}",
47+
"languages_url": "https://api.github.com/repos/seate/for-test/languages",
48+
"stargazers_url": "https://api.github.com/repos/seate/for-test/stargazers",
49+
"contributors_url": "https://api.github.com/repos/seate/for-test/contributors",
50+
"subscribers_url": "https://api.github.com/repos/seate/for-test/subscribers",
51+
"subscription_url": "https://api.github.com/repos/seate/for-test/subscription",
52+
"commits_url": "https://api.github.com/repos/seate/for-test/commits{/sha}",
53+
"git_commits_url": "https://api.github.com/repos/seate/for-test/git/commits{/sha}",
54+
"comments_url": "https://api.github.com/repos/seate/for-test/comments{/number}",
55+
"issue_comment_url": "https://api.github.com/repos/seate/for-test/issues/comments{/number}",
56+
"contents_url": "https://api.github.com/repos/seate/for-test/contents/{+path}",
57+
"compare_url": "https://api.github.com/repos/seate/for-test/compare/{base}...{head}",
58+
"merges_url": "https://api.github.com/repos/seate/for-test/merges",
59+
"archive_url": "https://api.github.com/repos/seate/for-test/{archive_format}{/ref}",
60+
"downloads_url": "https://api.github.com/repos/seate/for-test/downloads",
61+
"issues_url": "https://api.github.com/repos/seate/for-test/issues{/number}",
62+
"pulls_url": "https://api.github.com/repos/seate/for-test/pulls{/number}",
63+
"milestones_url": "https://api.github.com/repos/seate/for-test/milestones{/number}",
64+
"notifications_url": "https://api.github.com/repos/seate/for-test/notifications{?since,all,participating}",
65+
"labels_url": "https://api.github.com/repos/seate/for-test/labels{/name}",
66+
"releases_url": "https://api.github.com/repos/seate/for-test/releases{/id}",
67+
"deployments_url": "https://api.github.com/repos/seate/for-test/deployments",
68+
"created_at": "2025-02-15T14:21:31Z",
69+
"updated_at": "2025-03-15T16:06:51Z",
70+
"pushed_at": "2025-03-15T16:17:01Z",
71+
"git_url": "git://github.com/seate/for-test.git",
72+
"ssh_url": "[email protected]:seate/for-test.git",
73+
"clone_url": "https://github.com/seate/for-test.git",
74+
"svn_url": "https://github.com/seate/for-test",
75+
"homepage": null,
76+
"size": 62,
77+
"stargazers_count": 0,
78+
"watchers_count": 0,
79+
"language": null,
80+
"has_issues": true,
81+
"has_projects": true,
82+
"has_downloads": true,
83+
"has_wiki": true,
84+
"has_pages": false,
85+
"has_discussions": false,
86+
"forks_count": 0,
87+
"mirror_url": null,
88+
"archived": false,
89+
"disabled": false,
90+
"open_issues_count": 3,
91+
"license": null,
92+
"allow_forking": true,
93+
"is_template": false,
94+
"web_commit_signoff_required": false,
95+
"topics": [],
96+
"visibility": "public",
97+
"forks": 0,
98+
"open_issues": 3,
99+
"watchers": 0,
100+
"default_branch": "develop",
101+
"permissions": {
102+
"admin": true,
103+
"maintain": true,
104+
"push": true,
105+
"triage": true,
106+
"pull": true
107+
},
108+
"temp_clone_token": "",
109+
"allow_squash_merge": true,
110+
"allow_merge_commit": true,
111+
"allow_rebase_merge": true,
112+
"allow_auto_merge": true,
113+
"delete_branch_on_merge": false,
114+
"allow_update_branch": false,
115+
"use_squash_pr_title_as_default": false,
116+
"squash_merge_commit_message": "COMMIT_MESSAGES",
117+
"squash_merge_commit_title": "COMMIT_OR_PR_TITLE",
118+
"merge_commit_message": "PR_TITLE",
119+
"merge_commit_title": "MERGE_MESSAGE",
120+
"security_and_analysis": {
121+
"secret_scanning": {
122+
"status": "disabled"
123+
},
124+
"secret_scanning_push_protection": {
125+
"status": "disabled"
126+
},
127+
"dependabot_security_updates": {
128+
"status": "disabled"
129+
},
130+
"secret_scanning_non_provider_patterns": {
131+
"status": "disabled"
132+
},
133+
"secret_scanning_validity_checks": {
134+
"status": "disabled"
135+
}
136+
},
137+
"network_count": 0,
138+
"subscribers_count": 1
139+
}

0 commit comments

Comments
 (0)