Skip to content

Commit 33e1ccb

Browse files
test: add test to verify new checks are being populated
1 parent c8c7b30 commit 33e1ccb

File tree

9 files changed

+550
-0
lines changed

9 files changed

+550
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,21 @@ public void testSignedCommits() throws Exception {
189189
assertThat(protection.getRequiredSignatures(), is(false));
190190
}
191191

192+
/**
193+
* Checks with app ids are being populated
194+
*
195+
* @throws Exception
196+
* the exception
197+
*/
198+
@Test
199+
public void testChecksWithAppIds() throws Exception {
200+
GHBranchProtection protection = branch.enableProtection()
201+
.addRequiredChecksWithAppIds(new GHBranchProtection.Check("context", -1))
202+
.enable();
203+
204+
assertThat(protection.getRequiredStatusChecks().getChecks().isEmpty(), is(false));
205+
}
206+
192207
/**
193208
* Test get protection.
194209
*
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"login": "tginiotis-at-work",
3+
"id": 61763026,
4+
"node_id": "MDQ6VXNlcjYxNzYzMDI2",
5+
"avatar_url": "https://avatars.githubusercontent.com/u/61763026?v=4",
6+
"gravatar_id": "",
7+
"url": "https://api.github.com/users/tginiotis-at-work",
8+
"html_url": "https://github.com/tginiotis-at-work",
9+
"followers_url": "https://api.github.com/users/tginiotis-at-work/followers",
10+
"following_url": "https://api.github.com/users/tginiotis-at-work/following{/other_user}",
11+
"gists_url": "https://api.github.com/users/tginiotis-at-work/gists{/gist_id}",
12+
"starred_url": "https://api.github.com/users/tginiotis-at-work/starred{/owner}{/repo}",
13+
"subscriptions_url": "https://api.github.com/users/tginiotis-at-work/subscriptions",
14+
"organizations_url": "https://api.github.com/users/tginiotis-at-work/orgs",
15+
"repos_url": "https://api.github.com/users/tginiotis-at-work/repos",
16+
"events_url": "https://api.github.com/users/tginiotis-at-work/events{/privacy}",
17+
"received_events_url": "https://api.github.com/users/tginiotis-at-work/received_events",
18+
"type": "User",
19+
"site_admin": false,
20+
"name": "Tadas Giniotis",
21+
"company": "IBM Lietuva",
22+
"blog": "",
23+
"location": null,
24+
"email": null,
25+
"hireable": null,
26+
"bio": null,
27+
"twitter_username": null,
28+
"public_repos": 12,
29+
"public_gists": 0,
30+
"followers": 0,
31+
"following": 0,
32+
"created_at": "2020-03-03T23:04:00Z",
33+
"updated_at": "2024-05-15T15:03:51Z"
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
{
2+
"id": 802086844,
3+
"node_id": "R_kgDOL87fvA",
4+
"name": "temp-testChecksWithAppIds",
5+
"full_name": "hub4j-test-org/temp-testChecksWithAppIds",
6+
"private": false,
7+
"owner": {
8+
"login": "hub4j-test-org",
9+
"id": 7544739,
10+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
11+
"avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4",
12+
"gravatar_id": "",
13+
"url": "https://api.github.com/users/hub4j-test-org",
14+
"html_url": "https://github.com/hub4j-test-org",
15+
"followers_url": "https://api.github.com/users/hub4j-test-org/followers",
16+
"following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}",
17+
"gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}",
18+
"starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}",
19+
"subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions",
20+
"organizations_url": "https://api.github.com/users/hub4j-test-org/orgs",
21+
"repos_url": "https://api.github.com/users/hub4j-test-org/repos",
22+
"events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}",
23+
"received_events_url": "https://api.github.com/users/hub4j-test-org/received_events",
24+
"type": "Organization",
25+
"site_admin": false
26+
},
27+
"html_url": "https://github.com/hub4j-test-org/temp-testChecksWithAppIds",
28+
"description": "A test repository for testing the github-api project: temp-testChecksWithAppIds",
29+
"fork": false,
30+
"url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds",
31+
"forks_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/forks",
32+
"keys_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/keys{/key_id}",
33+
"collaborators_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/collaborators{/collaborator}",
34+
"teams_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/teams",
35+
"hooks_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/hooks",
36+
"issue_events_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/issues/events{/number}",
37+
"events_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/events",
38+
"assignees_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/assignees{/user}",
39+
"branches_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches{/branch}",
40+
"tags_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/tags",
41+
"blobs_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/git/blobs{/sha}",
42+
"git_tags_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/git/tags{/sha}",
43+
"git_refs_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/git/refs{/sha}",
44+
"trees_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/git/trees{/sha}",
45+
"statuses_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/statuses/{sha}",
46+
"languages_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/languages",
47+
"stargazers_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/stargazers",
48+
"contributors_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/contributors",
49+
"subscribers_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/subscribers",
50+
"subscription_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/subscription",
51+
"commits_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/commits{/sha}",
52+
"git_commits_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/git/commits{/sha}",
53+
"comments_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/comments{/number}",
54+
"issue_comment_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/issues/comments{/number}",
55+
"contents_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/contents/{+path}",
56+
"compare_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/compare/{base}...{head}",
57+
"merges_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/merges",
58+
"archive_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/{archive_format}{/ref}",
59+
"downloads_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/downloads",
60+
"issues_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/issues{/number}",
61+
"pulls_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/pulls{/number}",
62+
"milestones_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/milestones{/number}",
63+
"notifications_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/notifications{?since,all,participating}",
64+
"labels_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/labels{/name}",
65+
"releases_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/releases{/id}",
66+
"deployments_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/deployments",
67+
"created_at": "2024-05-17T13:51:56Z",
68+
"updated_at": "2024-05-17T13:52:00Z",
69+
"pushed_at": "2024-05-17T13:51:57Z",
70+
"git_url": "git://github.com/hub4j-test-org/temp-testChecksWithAppIds.git",
71+
"ssh_url": "git@github.com:hub4j-test-org/temp-testChecksWithAppIds.git",
72+
"clone_url": "https://github.com/hub4j-test-org/temp-testChecksWithAppIds.git",
73+
"svn_url": "https://github.com/hub4j-test-org/temp-testChecksWithAppIds",
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+
"has_discussions": false,
85+
"forks_count": 0,
86+
"mirror_url": null,
87+
"archived": false,
88+
"disabled": false,
89+
"open_issues_count": 0,
90+
"license": null,
91+
"allow_forking": true,
92+
"is_template": false,
93+
"web_commit_signoff_required": false,
94+
"topics": [],
95+
"visibility": "public",
96+
"forks": 0,
97+
"open_issues": 0,
98+
"watchers": 0,
99+
"default_branch": "main",
100+
"permissions": {
101+
"admin": true,
102+
"maintain": true,
103+
"push": true,
104+
"triage": true,
105+
"pull": true
106+
},
107+
"temp_clone_token": "",
108+
"allow_squash_merge": true,
109+
"allow_merge_commit": true,
110+
"allow_rebase_merge": true,
111+
"allow_auto_merge": false,
112+
"delete_branch_on_merge": false,
113+
"allow_update_branch": false,
114+
"use_squash_pr_title_as_default": false,
115+
"squash_merge_commit_message": "COMMIT_MESSAGES",
116+
"squash_merge_commit_title": "COMMIT_OR_PR_TITLE",
117+
"merge_commit_message": "PR_TITLE",
118+
"merge_commit_title": "MERGE_MESSAGE",
119+
"custom_properties": {},
120+
"organization": {
121+
"login": "hub4j-test-org",
122+
"id": 7544739,
123+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
124+
"avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4",
125+
"gravatar_id": "",
126+
"url": "https://api.github.com/users/hub4j-test-org",
127+
"html_url": "https://github.com/hub4j-test-org",
128+
"followers_url": "https://api.github.com/users/hub4j-test-org/followers",
129+
"following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}",
130+
"gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}",
131+
"starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}",
132+
"subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions",
133+
"organizations_url": "https://api.github.com/users/hub4j-test-org/orgs",
134+
"repos_url": "https://api.github.com/users/hub4j-test-org/repos",
135+
"events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}",
136+
"received_events_url": "https://api.github.com/users/hub4j-test-org/received_events",
137+
"type": "Organization",
138+
"site_admin": false
139+
},
140+
"security_and_analysis": {
141+
"secret_scanning": {
142+
"status": "disabled"
143+
},
144+
"secret_scanning_push_protection": {
145+
"status": "disabled"
146+
},
147+
"dependabot_security_updates": {
148+
"status": "disabled"
149+
},
150+
"secret_scanning_validity_checks": {
151+
"status": "disabled"
152+
}
153+
},
154+
"network_count": 0,
155+
"subscribers_count": 22
156+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"name": "main",
3+
"commit": {
4+
"sha": "301c76278622d97be24c9e6bf37306eb91984505",
5+
"node_id": "C_kwDOL87fvNoAKDMwMWM3NjI3ODYyMmQ5N2JlMjRjOWU2YmYzNzMwNmViOTE5ODQ1MDU",
6+
"commit": {
7+
"author": {
8+
"name": "Tadas Giniotis",
9+
"email": "61763026+tginiotis-at-work@users.noreply.github.com",
10+
"date": "2024-05-17T13:51:57Z"
11+
},
12+
"committer": {
13+
"name": "GitHub",
14+
"email": "noreply@github.com",
15+
"date": "2024-05-17T13:51:57Z"
16+
},
17+
"message": "Initial commit",
18+
"tree": {
19+
"sha": "c53290e965014088d71812a1a0ef5453d5671047",
20+
"url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/git/trees/c53290e965014088d71812a1a0ef5453d5671047"
21+
},
22+
"url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/git/commits/301c76278622d97be24c9e6bf37306eb91984505",
23+
"comment_count": 0,
24+
"verification": {
25+
"verified": true,
26+
"reason": "valid",
27+
"signature": "-----BEGIN PGP SIGNATURE-----\n\nwsFcBAABCAAQBQJmR2D9CRC1aQ7uu5UhlAAAiboQADXa0dYfU4xR7N7c1cq5KsqP\nK8v1iaP1CxfbZSqZQSt3TNA+Jtc9TJ505M+6b8Ex3RpNBmQX4YG+kGvs0sa4vdMD\nHxbR8HOW6J+ht8BaV829iu4eVwI4N+hABhSTHJv6EhZg2wgPqX72zQV9k4QZw/uL\nSONyFJgFmX+kU/YVr+ax0yLnjQLfBIAR4Q4/f7afG1p5e3a8oOxucnptQBEW86wK\n0aNN1VWhP0IA8+D7ftgubClHu+/RFH3DRXdjPU5cvphLvNUM5Ime9Xktm5cFkv32\nOtjet8GUesT/cJiAkSEMU9C5nCIaJXgjchnp/yA2l6Z31tXaEik/UhqizE3EQMeP\nVPZMhCIeh69JGOerpflqP0/os3THF57x054RaFN6KxG7I158ClsfmyGp5WzkLFJ4\nkqiPrFltZm2k9MvUQ2r8Ewd3/OkDt/bAV8B34qAa/xhJUF4D5iq15gKsHNZsCBw5\nddz0dOO2YWmF0eMGv+iV25qu/xwdRrPbrPDb7NHcbZdAoBlNJm/07YAVkG3x3qBn\nPelfba5XjD6RPke5jRejhukV8PGFNfKQ3m7zYflqay2H6e2a0RCdtuSzLiIhkgP8\nvXxd4+xRvMC6aLDd1f0Z60G72ATCFsZ2H60yRcS6uMcufdbAt9h5B0UcKw6xT4Zi\nKILbAvfbDMtXdTVfeeWM\n=p3Ka\n-----END PGP SIGNATURE-----\n",
28+
"payload": "tree c53290e965014088d71812a1a0ef5453d5671047\nauthor Tadas Giniotis <61763026+tginiotis-at-work@users.noreply.github.com> 1715953917 +0300\ncommitter GitHub <noreply@github.com> 1715953917 +0300\n\nInitial commit"
29+
}
30+
},
31+
"url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/commits/301c76278622d97be24c9e6bf37306eb91984505",
32+
"html_url": "https://github.com/hub4j-test-org/temp-testChecksWithAppIds/commit/301c76278622d97be24c9e6bf37306eb91984505",
33+
"comments_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/commits/301c76278622d97be24c9e6bf37306eb91984505/comments",
34+
"author": {
35+
"login": "tginiotis-at-work",
36+
"id": 61763026,
37+
"node_id": "MDQ6VXNlcjYxNzYzMDI2",
38+
"avatar_url": "https://avatars.githubusercontent.com/u/61763026?v=4",
39+
"gravatar_id": "",
40+
"url": "https://api.github.com/users/tginiotis-at-work",
41+
"html_url": "https://github.com/tginiotis-at-work",
42+
"followers_url": "https://api.github.com/users/tginiotis-at-work/followers",
43+
"following_url": "https://api.github.com/users/tginiotis-at-work/following{/other_user}",
44+
"gists_url": "https://api.github.com/users/tginiotis-at-work/gists{/gist_id}",
45+
"starred_url": "https://api.github.com/users/tginiotis-at-work/starred{/owner}{/repo}",
46+
"subscriptions_url": "https://api.github.com/users/tginiotis-at-work/subscriptions",
47+
"organizations_url": "https://api.github.com/users/tginiotis-at-work/orgs",
48+
"repos_url": "https://api.github.com/users/tginiotis-at-work/repos",
49+
"events_url": "https://api.github.com/users/tginiotis-at-work/events{/privacy}",
50+
"received_events_url": "https://api.github.com/users/tginiotis-at-work/received_events",
51+
"type": "User",
52+
"site_admin": false
53+
},
54+
"committer": {
55+
"login": "web-flow",
56+
"id": 19864447,
57+
"node_id": "MDQ6VXNlcjE5ODY0NDQ3",
58+
"avatar_url": "https://avatars.githubusercontent.com/u/19864447?v=4",
59+
"gravatar_id": "",
60+
"url": "https://api.github.com/users/web-flow",
61+
"html_url": "https://github.com/web-flow",
62+
"followers_url": "https://api.github.com/users/web-flow/followers",
63+
"following_url": "https://api.github.com/users/web-flow/following{/other_user}",
64+
"gists_url": "https://api.github.com/users/web-flow/gists{/gist_id}",
65+
"starred_url": "https://api.github.com/users/web-flow/starred{/owner}{/repo}",
66+
"subscriptions_url": "https://api.github.com/users/web-flow/subscriptions",
67+
"organizations_url": "https://api.github.com/users/web-flow/orgs",
68+
"repos_url": "https://api.github.com/users/web-flow/repos",
69+
"events_url": "https://api.github.com/users/web-flow/events{/privacy}",
70+
"received_events_url": "https://api.github.com/users/web-flow/received_events",
71+
"type": "User",
72+
"site_admin": false
73+
},
74+
"parents": []
75+
},
76+
"_links": {
77+
"self": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main",
78+
"html": "https://github.com/hub4j-test-org/temp-testChecksWithAppIds/tree/main"
79+
},
80+
"protected": false,
81+
"protection": {
82+
"enabled": false,
83+
"required_status_checks": {
84+
"enforcement_level": "off",
85+
"contexts": [],
86+
"checks": []
87+
}
88+
},
89+
"protection_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection"
90+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection",
3+
"required_status_checks": {
4+
"url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection/required_status_checks",
5+
"strict": false,
6+
"contexts": [
7+
"context"
8+
],
9+
"contexts_url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection/required_status_checks/contexts",
10+
"checks": [
11+
{
12+
"context": "context",
13+
"app_id": null
14+
}
15+
]
16+
},
17+
"required_signatures": {
18+
"url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection/required_signatures",
19+
"enabled": false
20+
},
21+
"enforce_admins": {
22+
"url": "https://api.github.com/repos/hub4j-test-org/temp-testChecksWithAppIds/branches/main/protection/enforce_admins",
23+
"enabled": false
24+
},
25+
"required_linear_history": {
26+
"enabled": false
27+
},
28+
"allow_force_pushes": {
29+
"enabled": false
30+
},
31+
"allow_deletions": {
32+
"enabled": false
33+
},
34+
"block_creations": {
35+
"enabled": false
36+
},
37+
"required_conversation_resolution": {
38+
"enabled": false
39+
},
40+
"lock_branch": {
41+
"enabled": false
42+
},
43+
"allow_fork_syncing": {
44+
"enabled": false
45+
}
46+
}

0 commit comments

Comments
 (0)