Skip to content

Commit 177c386

Browse files
committed
Test deploy key
1 parent 9c843e9 commit 177c386

10 files changed

+420
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,18 +1283,17 @@ public void directoryListing() throws IOException {
12831283
* @throws IOException
12841284
* Signals that an I/O exception has occurred.
12851285
*/
1286-
@Ignore("Needs mocking check")
12871286
@Test
12881287
public void testAddDeployKey() throws IOException {
12891288
GHRepository myRepository = getTestRepository();
12901289
final GHDeployKey newDeployKey = myRepository.addDeployKey("test",
1291-
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUt0RAycC5cS42JKh6SecfFZBR1RrF+2hYMctz4mk74/arBE+wFb7fnSHGzdGKX2h5CFOWODifRCJVhB7hlVxodxe+QkQQYAEL/x1WVCJnGgTGQGOrhOMj95V3UE5pQKhsKD608C+u5tSofcWXLToP1/wZ7U4/AHjqYi08OLsWToHCax55TZkvdt2jo0hbIoYU+XI9Q8Uv4ONDN1oabiOdgeKi8+crvHAuvNleiBhWVBzFh8KdfzaH5uNdw7ihhFjEd1vzqACsjCINCjdMfzl6jD9ExuWuE92nZJnucls2cEoNC6k2aPmrZDg9hA32FXVpyseY+bDUWFU6LO2LG6PB kohsuke@atlas");
1290+
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIATWwMLytklB44O66isWRKOB3Qd7Ysc7q7EyWTmT0bG9 [email protected]");
12921291
try {
12931292
assertThat(newDeployKey.getId(), notNullValue());
12941293

12951294
GHDeployKey k = Iterables.find(myRepository.getDeployKeys(), new Predicate<GHDeployKey>() {
12961295
public boolean apply(GHDeployKey deployKey) {
1297-
return newDeployKey.getId() == deployKey.getId();
1296+
return newDeployKey.getId() == deployKey.getId() && !deployKey.isRead_only();
12981297
}
12991298
});
13001299
assertThat(k, notNullValue());
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
{
2+
"id": 611473997,
3+
"node_id": "R_kgDOJHJaTQ",
4+
"name": "github-api-test",
5+
"full_name": "hub4j-test-org/github-api-test",
6+
"private": false,
7+
"owner": {
8+
"login": "hub4j-test-org",
9+
"id": 238558,
10+
"node_id": "MDQ6VXNlcjIzODU1OA==",
11+
"avatar_url": "https://avatars.githubusercontent.com/u/238558?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": "User",
25+
"site_admin": false
26+
},
27+
"html_url": "https://github.com/hub4j-test-org/github-api-test",
28+
"description": "A test repository for testing the github-api project: github-api-test",
29+
"fork": false,
30+
"url": "https://api.github.com/repos/hub4j-test-org/github-api-test",
31+
"forks_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/forks",
32+
"keys_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/keys{/key_id}",
33+
"collaborators_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/collaborators{/collaborator}",
34+
"teams_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/teams",
35+
"hooks_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/hooks",
36+
"issue_events_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/issues/events{/number}",
37+
"events_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/events",
38+
"assignees_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/assignees{/user}",
39+
"branches_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/branches{/branch}",
40+
"tags_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/tags",
41+
"blobs_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/git/blobs{/sha}",
42+
"git_tags_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/git/tags{/sha}",
43+
"git_refs_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/git/refs{/sha}",
44+
"trees_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/git/trees{/sha}",
45+
"statuses_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/statuses/{sha}",
46+
"languages_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/languages",
47+
"stargazers_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/stargazers",
48+
"contributors_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/contributors",
49+
"subscribers_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/subscribers",
50+
"subscription_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/subscription",
51+
"commits_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/commits{/sha}",
52+
"git_commits_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/git/commits{/sha}",
53+
"comments_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/comments{/number}",
54+
"issue_comment_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/issues/comments{/number}",
55+
"contents_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/contents/{+path}",
56+
"compare_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/compare/{base}...{head}",
57+
"merges_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/merges",
58+
"archive_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/{archive_format}{/ref}",
59+
"downloads_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/downloads",
60+
"issues_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/issues{/number}",
61+
"pulls_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/pulls{/number}",
62+
"milestones_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/milestones{/number}",
63+
"notifications_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/notifications{?since,all,participating}",
64+
"labels_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/labels{/name}",
65+
"releases_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/releases{/id}",
66+
"deployments_url": "https://api.github.com/repos/hub4j-test-org/github-api-test/deployments",
67+
"created_at": "2023-03-08T22:36:45Z",
68+
"updated_at": "2023-03-08T22:36:45Z",
69+
"pushed_at": "2023-03-08T22:36:45Z",
70+
"git_url": "git://github.com/hub4j-test-org/github-api-test.git",
71+
"ssh_url": "[email protected]:hub4j-test-org/github-api-test.git",
72+
"clone_url": "https://github.com/hub4j-test-org/github-api-test.git",
73+
"svn_url": "https://github.com/hub4j-test-org/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+
"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+
"security_and_analysis": {
108+
"secret_scanning": {
109+
"status": "disabled"
110+
},
111+
"secret_scanning_push_protection": {
112+
"status": "disabled"
113+
}
114+
},
115+
"network_count": 0,
116+
"subscribers_count": 1
117+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"id": 78869617,
3+
"key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIATWwMLytklB44O66isWRKOB3Qd7Ysc7q7EyWTmT0bG9",
4+
"url": "https://api.github.com/repos/hub4j-test-org/github-api-test/keys/78869617",
5+
"title": "test",
6+
"verified": true,
7+
"created_at": "2023-03-08T22:36:50Z",
8+
"read_only": false,
9+
"last_used": null,
10+
"added_by": "hub4j-test-org"
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
{
3+
"id": 78869617,
4+
"key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIATWwMLytklB44O66isWRKOB3Qd7Ysc7q7EyWTmT0bG9",
5+
"url": "https://api.github.com/repos/hub4j-test-org/github-api-test/keys/78869617",
6+
"title": "test",
7+
"verified": true,
8+
"created_at": "2023-03-08T22:36:50Z",
9+
"read_only": false,
10+
"last_used": null,
11+
"added_by": "hub4j-test-org"
12+
}
13+
]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"login": "hub4j-test-org",
3+
"id": 7544739,
4+
"node_id": "MDQ6VXNlcjIzODU1OA==",
5+
"avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4",
6+
"gravatar_id": "",
7+
"url": "https://api.github.com/users/hub4j-test-org",
8+
"html_url": "https://github.com/hub4j-test-org",
9+
"followers_url": "https://api.github.com/users/hub4j-test-org/followers",
10+
"following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}",
11+
"gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}",
12+
"starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}",
13+
"subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions",
14+
"organizations_url": "https://api.github.com/users/hub4j-test-org/orgs",
15+
"repos_url": "https://api.github.com/users/hub4j-test-org/repos",
16+
"events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}",
17+
"received_events_url": "https://api.github.com/users/hub4j-test-org/received_events",
18+
"type": "User",
19+
"site_admin": false,
20+
"name": "hub4j-test-org",
21+
"company": null,
22+
"blog": "",
23+
"location": "",
24+
"email": null,
25+
"hireable": null,
26+
"bio": "",
27+
"twitter_username": null,
28+
"public_repos": 13,
29+
"public_gists": 4,
30+
"followers": 6,
31+
"following": 1,
32+
"created_at": "2010-04-07T08:30:12Z",
33+
"updated_at": "2022-11-28T20:54:46Z"
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"id": "8b7ef826-893b-4288-b625-4492949cd9b1",
3+
"name": "repos_hub4j-test-org_github-api-test",
4+
"request": {
5+
"url": "/repos/hub4j-test-org/github-api-test",
6+
"method": "GET",
7+
"headers": {
8+
"Accept": {
9+
"equalTo": "application/vnd.github.v3+json"
10+
}
11+
}
12+
},
13+
"response": {
14+
"status": 200,
15+
"bodyFileName": "repos_hub4j-test-org_github-api-test-2.json",
16+
"headers": {
17+
"Server": "GitHub.com",
18+
"Date": "Wed, 08 Mar 2023 22:36:49 GMT",
19+
"Content-Type": "application/json; charset=utf-8",
20+
"Cache-Control": "private, max-age=60, s-maxage=60",
21+
"Vary": [
22+
"Accept, Authorization, Cookie, X-GitHub-OTP",
23+
"Accept-Encoding, Accept, X-Requested-With"
24+
],
25+
"ETag": "W/\"9a25876ca00d328a54c1400dffe501009cdcbc3410dd90140b0c33cc19608961\"",
26+
"Last-Modified": "Wed, 08 Mar 2023 22:36:45 GMT",
27+
"github-authentication-token-expiration": "2023-04-07 23:24:34 +0200",
28+
"X-GitHub-Media-Type": "github.v3; format=json",
29+
"x-github-api-version-selected": "2022-11-28",
30+
"X-RateLimit-Limit": "5000",
31+
"X-RateLimit-Remaining": "4903",
32+
"X-RateLimit-Reset": "1678317208",
33+
"X-RateLimit-Used": "97",
34+
"X-RateLimit-Resource": "core",
35+
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
36+
"Access-Control-Allow-Origin": "*",
37+
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
38+
"X-Frame-Options": "deny",
39+
"X-Content-Type-Options": "nosniff",
40+
"X-XSS-Protection": "0",
41+
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
42+
"Content-Security-Policy": "default-src 'none'",
43+
"X-GitHub-Request-Id": "E5D8:ACE5:B4A8F2D:B741C36:64090E01"
44+
}
45+
},
46+
"uuid": "8b7ef826-893b-4288-b625-4492949cd9b1",
47+
"persistent": true,
48+
"insertionIndex": 2
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"id": "f648e6ad-c2ec-42b2-bc75-017ac64e67d9",
3+
"name": "repos_hub4j-test-org_github-api-test_keys",
4+
"request": {
5+
"url": "/repos/hub4j-test-org/github-api-test/keys",
6+
"method": "POST",
7+
"headers": {
8+
"Accept": {
9+
"equalTo": "application/vnd.github.v3+json"
10+
}
11+
},
12+
"bodyPatterns": [
13+
{
14+
"equalToJson": "{\"read_only\":false,\"title\":\"test\",\"key\":\"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIATWwMLytklB44O66isWRKOB3Qd7Ysc7q7EyWTmT0bG9 [email protected]\"}",
15+
"ignoreArrayOrder": true,
16+
"ignoreExtraElements": false
17+
}
18+
]
19+
},
20+
"response": {
21+
"status": 201,
22+
"bodyFileName": "repos_hub4j-test-org_github-api-test_keys-3.json",
23+
"headers": {
24+
"Server": "GitHub.com",
25+
"Date": "Wed, 08 Mar 2023 22:36:50 GMT",
26+
"Content-Type": "application/json; charset=utf-8",
27+
"Cache-Control": "private, max-age=60, s-maxage=60",
28+
"Vary": [
29+
"Accept, Authorization, Cookie, X-GitHub-OTP",
30+
"Accept-Encoding, Accept, X-Requested-With"
31+
],
32+
"ETag": "\"0a4e82c98d34824d431a19b779f7fcc35e1a3c1142ff9c1a7132d8840630f8a6\"",
33+
"github-authentication-token-expiration": "2023-04-07 23:24:34 +0200",
34+
"X-GitHub-Media-Type": "github.v3; format=json",
35+
"x-github-api-version-selected": "2022-11-28",
36+
"X-RateLimit-Limit": "5000",
37+
"X-RateLimit-Remaining": "4902",
38+
"X-RateLimit-Reset": "1678317208",
39+
"X-RateLimit-Used": "98",
40+
"X-RateLimit-Resource": "core",
41+
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
42+
"Access-Control-Allow-Origin": "*",
43+
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
44+
"X-Frame-Options": "deny",
45+
"X-Content-Type-Options": "nosniff",
46+
"X-XSS-Protection": "0",
47+
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
48+
"Content-Security-Policy": "default-src 'none'",
49+
"X-GitHub-Request-Id": "E5DE:A9BF:A40D94B:A69E360:64090E01",
50+
"Location": "https://api.github.com/repos/hub4j-test-org/github-api-test/keys/78869617"
51+
}
52+
},
53+
"uuid": "f648e6ad-c2ec-42b2-bc75-017ac64e67d9",
54+
"persistent": true,
55+
"insertionIndex": 3
56+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"id": "ca5ce05e-5052-4cce-9508-c33ba42ab18f",
3+
"name": "repos_hub4j-test-org_github-api-test_keys",
4+
"request": {
5+
"url": "/repos/hub4j-test-org/github-api-test/keys",
6+
"method": "GET",
7+
"headers": {
8+
"Accept": {
9+
"equalTo": "application/vnd.github.v3+json"
10+
}
11+
}
12+
},
13+
"response": {
14+
"status": 200,
15+
"bodyFileName": "repos_hub4j-test-org_github-api-test_keys-4.json",
16+
"headers": {
17+
"Server": "GitHub.com",
18+
"Date": "Wed, 08 Mar 2023 22:36:50 GMT",
19+
"Content-Type": "application/json; charset=utf-8",
20+
"Cache-Control": "private, max-age=60, s-maxage=60",
21+
"Vary": [
22+
"Accept, Authorization, Cookie, X-GitHub-OTP",
23+
"Accept-Encoding, Accept, X-Requested-With"
24+
],
25+
"ETag": "W/\"0a77e8787fcd166b10430624945723c4d8bdc5f131bcc1c821d56170eec9db86\"",
26+
"github-authentication-token-expiration": "2023-04-07 23:24:34 +0200",
27+
"X-GitHub-Media-Type": "github.v3; format=json",
28+
"x-github-api-version-selected": "2022-11-28",
29+
"X-RateLimit-Limit": "5000",
30+
"X-RateLimit-Remaining": "4901",
31+
"X-RateLimit-Reset": "1678317208",
32+
"X-RateLimit-Used": "99",
33+
"X-RateLimit-Resource": "core",
34+
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
35+
"Access-Control-Allow-Origin": "*",
36+
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
37+
"X-Frame-Options": "deny",
38+
"X-Content-Type-Options": "nosniff",
39+
"X-XSS-Protection": "0",
40+
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
41+
"Content-Security-Policy": "default-src 'none'",
42+
"X-GitHub-Request-Id": "E5EA:3041:9E5EEE8:A0EE307:64090E02"
43+
}
44+
},
45+
"uuid": "ca5ce05e-5052-4cce-9508-c33ba42ab18f",
46+
"persistent": true,
47+
"insertionIndex": 4
48+
}

0 commit comments

Comments
 (0)