Skip to content

Commit f6e2656

Browse files
committed
implemented github app get by slug tests
1 parent 179c8f4 commit f6e2656

File tree

5 files changed

+217
-0
lines changed

5 files changed

+217
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package org.kohsuke.github;
2+
3+
import org.junit.Test;
4+
5+
import java.io.IOException;
6+
7+
import static org.hamcrest.Matchers.equalTo;
8+
import static org.hamcrest.Matchers.is;
9+
10+
/**
11+
* Tests for the GitHub App Api Test
12+
*
13+
* @author Daniel Baur
14+
*/
15+
public class GHAppExtendedTest extends AbstractGitHubWireMockTest {
16+
17+
private static final String APP_SLUG = "ghapi-test-app-4";
18+
19+
/**
20+
* Gets the GitHub App by its slug.
21+
*
22+
* @throws IOException
23+
* An IOException has occurred.
24+
*/
25+
@Test
26+
public void testGetAppBySlugTest() throws IOException {
27+
GHApp app = gitHub.getApp(APP_SLUG);
28+
29+
assertThat(app.getId(), is((long) 330762));
30+
assertThat(app.getSlug(), equalTo(APP_SLUG));
31+
assertThat(app.getName(), equalTo("GHApi Test app 4"));
32+
assertThat(app.getExternalUrl(), equalTo("https://github.com/organizations/hub4j-test-org"));
33+
assertThat(app.getHtmlUrl().toString(), equalTo("https://github.com/apps/ghapi-test-app-4"));
34+
assertThat(app.getDescription(), equalTo("An app to test the GitHub getApp(slug) method."));
35+
}
36+
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"id": 330762,
3+
"slug": "ghapi-test-app-4",
4+
"node_id": "A_kwHOAHMfo84ABQwK",
5+
"owner": {
6+
"login": "hub4j-test-org",
7+
"id": 7544739,
8+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
9+
"avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4",
10+
"gravatar_id": "",
11+
"url": "https://api.github.com/users/hub4j-test-org",
12+
"html_url": "https://github.com/hub4j-test-org",
13+
"followers_url": "https://api.github.com/users/hub4j-test-org/followers",
14+
"following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}",
15+
"gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}",
16+
"starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}",
17+
"subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions",
18+
"organizations_url": "https://api.github.com/users/hub4j-test-org/orgs",
19+
"repos_url": "https://api.github.com/users/hub4j-test-org/repos",
20+
"events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}",
21+
"received_events_url": "https://api.github.com/users/hub4j-test-org/received_events",
22+
"type": "Organization",
23+
"site_admin": false
24+
},
25+
"name": "GHApi Test app 4",
26+
"description": "An app to test the GitHub getApp(slug) method.",
27+
"external_url": "https://github.com/organizations/hub4j-test-org",
28+
"html_url": "https://github.com/apps/ghapi-test-app-4",
29+
"created_at": "2023-05-08T08:32:35Z",
30+
"updated_at": "2023-05-08T08:32:35Z",
31+
"permissions": {},
32+
"events": []
33+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"login": "dbaur",
3+
"id": 7251904,
4+
"node_id": "MDQ6VXNlcjcyNTE5MDQ=",
5+
"avatar_url": "https://avatars.githubusercontent.com/u/7251904?v=4",
6+
"gravatar_id": "",
7+
"url": "https://api.github.com/users/dbaur",
8+
"html_url": "https://github.com/dbaur",
9+
"followers_url": "https://api.github.com/users/dbaur/followers",
10+
"following_url": "https://api.github.com/users/dbaur/following{/other_user}",
11+
"gists_url": "https://api.github.com/users/dbaur/gists{/gist_id}",
12+
"starred_url": "https://api.github.com/users/dbaur/starred{/owner}{/repo}",
13+
"subscriptions_url": "https://api.github.com/users/dbaur/subscriptions",
14+
"organizations_url": "https://api.github.com/users/dbaur/orgs",
15+
"repos_url": "https://api.github.com/users/dbaur/repos",
16+
"events_url": "https://api.github.com/users/dbaur/events{/privacy}",
17+
"received_events_url": "https://api.github.com/users/dbaur/received_events",
18+
"type": "User",
19+
"site_admin": false,
20+
"name": "Daniel Baur",
21+
"company": null,
22+
"blog": "",
23+
"location": "Ulm",
24+
"email": null,
25+
"hireable": null,
26+
"bio": null,
27+
"twitter_username": null,
28+
"public_repos": 48,
29+
"public_gists": 0,
30+
"followers": 7,
31+
"following": 10,
32+
"created_at": "2014-04-10T14:14:43Z",
33+
"updated_at": "2023-04-28T11:26:17Z",
34+
"private_gists": 3,
35+
"total_private_repos": 13,
36+
"owned_private_repos": 13,
37+
"disk_usage": 104958,
38+
"collaborators": 0,
39+
"two_factor_authentication": true,
40+
"plan": {
41+
"name": "free",
42+
"space": 976562499,
43+
"collaborators": 0,
44+
"private_repos": 10000
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"id": "ec4e2dee-efbc-4422-bccf-93b9c74601da",
3+
"name": "apps_ghapi-test-app-4",
4+
"request": {
5+
"url": "/apps/ghapi-test-app-4",
6+
"method": "GET",
7+
"headers": {
8+
"Accept": {
9+
"equalTo": "application/vnd.github.v3+json"
10+
}
11+
}
12+
},
13+
"response": {
14+
"status": 200,
15+
"bodyFileName": "apps_ghapi-test-app-4-2.json",
16+
"headers": {
17+
"Server": "GitHub.com",
18+
"Date": "Mon, 08 May 2023 09:02:25 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/\"cce36a75318a31dbe0f95039e6b4063a2c1f69854549ec4ce872f5035e7091c7\"",
26+
"X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages",
27+
"X-Accepted-OAuth-Scopes": "",
28+
"github-authentication-token-expiration": "2023-06-07 08:27:57 UTC",
29+
"X-GitHub-Media-Type": "github.v3; format=json",
30+
"x-github-api-version-selected": "2022-11-28",
31+
"X-RateLimit-Limit": "5000",
32+
"X-RateLimit-Remaining": "4961",
33+
"X-RateLimit-Reset": "1683538171",
34+
"X-RateLimit-Used": "39",
35+
"X-RateLimit-Resource": "core",
36+
"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",
37+
"Access-Control-Allow-Origin": "*",
38+
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
39+
"X-Frame-Options": "deny",
40+
"X-Content-Type-Options": "nosniff",
41+
"X-XSS-Protection": "0",
42+
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
43+
"Content-Security-Policy": "default-src 'none'",
44+
"X-GitHub-Request-Id": "9FE0:F781:330A702:33B805E:6458BAA1"
45+
}
46+
},
47+
"uuid": "ec4e2dee-efbc-4422-bccf-93b9c74601da",
48+
"persistent": true,
49+
"insertionIndex": 2
50+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"id": "c58c0624-10ba-438b-a3bc-6f02d11aa7ac",
3+
"name": "user",
4+
"request": {
5+
"url": "/user",
6+
"method": "GET",
7+
"headers": {
8+
"Accept": {
9+
"equalTo": "application/vnd.github.v3+json"
10+
}
11+
}
12+
},
13+
"response": {
14+
"status": 200,
15+
"bodyFileName": "user-1.json",
16+
"headers": {
17+
"Server": "GitHub.com",
18+
"Date": "Mon, 08 May 2023 09:02:24 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/\"ed2b1866194223c334b01088179c15c223bc73dc80a5611a2dd5df357b0f0b30\"",
26+
"Last-Modified": "Fri, 28 Apr 2023 11:26:17 GMT",
27+
"X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, notifications, project, repo, user, workflow, write:discussion, write:packages",
28+
"X-Accepted-OAuth-Scopes": "",
29+
"github-authentication-token-expiration": "2023-06-07 08:27:57 UTC",
30+
"X-GitHub-Media-Type": "github.v3; format=json",
31+
"x-github-api-version-selected": "2022-11-28",
32+
"X-RateLimit-Limit": "5000",
33+
"X-RateLimit-Remaining": "4963",
34+
"X-RateLimit-Reset": "1683538171",
35+
"X-RateLimit-Used": "37",
36+
"X-RateLimit-Resource": "core",
37+
"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",
38+
"Access-Control-Allow-Origin": "*",
39+
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
40+
"X-Frame-Options": "deny",
41+
"X-Content-Type-Options": "nosniff",
42+
"X-XSS-Protection": "0",
43+
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
44+
"Content-Security-Policy": "default-src 'none'",
45+
"X-GitHub-Request-Id": "BFEE:A6A8:81BA8C1:831FD5D:6458BAA0"
46+
}
47+
},
48+
"uuid": "c58c0624-10ba-438b-a3bc-6f02d11aa7ac",
49+
"persistent": true,
50+
"insertionIndex": 1
51+
}

0 commit comments

Comments
 (0)