-
Notifications
You must be signed in to change notification settings - Fork 736
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9a4c80
commit 6609bd4
Showing
7 changed files
with
173 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1066,6 +1066,19 @@ public void testUserPublicEventApi() throws Exception { | |
} | ||
} | ||
|
||
/** | ||
* Test getEmails. | ||
* | ||
* @throws IOException | ||
* Signals that an I/O exception has occurred. | ||
*/ | ||
@Test | ||
public void testGetEmails() throws IOException { | ||
List<String> emails = gitHub.getMyself().getEmails(); | ||
assertThat(emails.size(), equalTo(2)); | ||
assertThat(emails, contains("[email protected]", "[email protected]")); | ||
} | ||
|
||
/** | ||
* Test app. | ||
* | ||
|
47 changes: 47 additions & 0 deletions
47
src/test/resources/org/kohsuke/github/AppTest/wiremock/testGetEmails/__files/1-user.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"login": "bitwiseman", | ||
"id": 1958953, | ||
"node_id": "MDQ6VXNlcjE5NTg5NTM=", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/1958953?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/bitwiseman", | ||
"html_url": "https://github.com/bitwiseman", | ||
"followers_url": "https://api.github.com/users/bitwiseman/followers", | ||
"following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", | ||
"organizations_url": "https://api.github.com/users/bitwiseman/orgs", | ||
"repos_url": "https://api.github.com/users/bitwiseman/repos", | ||
"events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/bitwiseman/received_events", | ||
"type": "User", | ||
"site_admin": false, | ||
"name": "Liam Newman", | ||
"company": null, | ||
"blog": "", | ||
"location": "Seattle, WA, USA", | ||
"email": "[email protected]", | ||
"hireable": null, | ||
"bio": null, | ||
"twitter_username": "bitwiseman", | ||
"notification_email": "[email protected]", | ||
"public_repos": 212, | ||
"public_gists": 8, | ||
"followers": 258, | ||
"following": 12, | ||
"created_at": "2012-07-11T20:38:33Z", | ||
"updated_at": "2024-07-11T16:46:55Z", | ||
"private_gists": 19, | ||
"total_private_repos": 3, | ||
"owned_private_repos": 3, | ||
"disk_usage": 34051, | ||
"collaborators": 4, | ||
"two_factor_authentication": true, | ||
"plan": { | ||
"name": "free", | ||
"space": 976562499, | ||
"collaborators": 0, | ||
"private_repos": 10000 | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...st/resources/org/kohsuke/github/AppTest/wiremock/testGetEmails/__files/2-user_emails.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
"email": "[email protected]", | ||
"primary": true, | ||
"verified": true, | ||
"visibility": "public" | ||
}, | ||
{ | ||
"email": "[email protected]", | ||
"primary": false, | ||
"verified": true, | ||
"visibility": null | ||
} | ||
] |
48 changes: 48 additions & 0 deletions
48
src/test/resources/org/kohsuke/github/AppTest/wiremock/testGetEmails/mappings/1-user.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"id": "ccd6f98f-7d6f-44a8-87ab-375e3a49d8f2", | ||
"name": "user", | ||
"request": { | ||
"url": "/user", | ||
"method": "GET", | ||
"headers": { | ||
"Accept": { | ||
"equalTo": "application/vnd.github+json" | ||
} | ||
} | ||
}, | ||
"response": { | ||
"status": 200, | ||
"bodyFileName": "1-user.json", | ||
"headers": { | ||
"Date": "Tue, 17 Sep 2024 18:41:52 GMT", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Cache-Control": "private, max-age=60, s-maxage=60", | ||
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", | ||
"ETag": "W/\"a27242a466c3df86c7421f5da77e7af0282d7b11679db48547af0b315d2eb3c1\"", | ||
"Last-Modified": "Thu, 11 Jul 2024 16:46:55 GMT", | ||
"X-OAuth-Scopes": "read:user, repo, user:email", | ||
"X-Accepted-OAuth-Scopes": "", | ||
"github-authentication-token-expiration": "2024-10-17 18:38:10 UTC", | ||
"X-GitHub-Media-Type": "github.v3; format=json", | ||
"x-github-api-version-selected": "2022-11-28", | ||
"X-RateLimit-Limit": "5000", | ||
"X-RateLimit-Remaining": "4991", | ||
"X-RateLimit-Reset": "1726601960", | ||
"X-RateLimit-Used": "9", | ||
"X-RateLimit-Resource": "core", | ||
"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", | ||
"Access-Control-Allow-Origin": "*", | ||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", | ||
"X-Frame-Options": "deny", | ||
"X-Content-Type-Options": "nosniff", | ||
"X-XSS-Protection": "0", | ||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", | ||
"Content-Security-Policy": "default-src 'none'", | ||
"Server": "github.com", | ||
"X-GitHub-Request-Id": "6A1F:A6CDA:12AE1BE:12C74DE:66E9CD70" | ||
} | ||
}, | ||
"uuid": "ccd6f98f-7d6f-44a8-87ab-375e3a49d8f2", | ||
"persistent": true, | ||
"insertionIndex": 1 | ||
} |
47 changes: 47 additions & 0 deletions
47
...t/resources/org/kohsuke/github/AppTest/wiremock/testGetEmails/mappings/2-user_emails.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"id": "f17d4d94-f19c-425e-8133-f9f3ad2bafea", | ||
"name": "user_emails", | ||
"request": { | ||
"url": "/user/emails", | ||
"method": "GET", | ||
"headers": { | ||
"Accept": { | ||
"equalTo": "application/vnd.github+json" | ||
} | ||
} | ||
}, | ||
"response": { | ||
"status": 200, | ||
"bodyFileName": "2-user_emails.json", | ||
"headers": { | ||
"Date": "Tue, 17 Sep 2024 18:41:52 GMT", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Cache-Control": "private, max-age=60, s-maxage=60", | ||
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", | ||
"ETag": "W/\"6e974566422ee9f8351add9d3450581b14045944d67d5b0d45d93816f7526d77\"", | ||
"X-OAuth-Scopes": "read:user, repo, user:email", | ||
"X-Accepted-OAuth-Scopes": "user, user:email", | ||
"github-authentication-token-expiration": "2024-10-17 18:38:10 UTC", | ||
"X-GitHub-Media-Type": "github.v3; format=json", | ||
"x-github-api-version-selected": "2022-11-28", | ||
"X-RateLimit-Limit": "5000", | ||
"X-RateLimit-Remaining": "4989", | ||
"X-RateLimit-Reset": "1726601960", | ||
"X-RateLimit-Used": "11", | ||
"X-RateLimit-Resource": "core", | ||
"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", | ||
"Access-Control-Allow-Origin": "*", | ||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", | ||
"X-Frame-Options": "deny", | ||
"X-Content-Type-Options": "nosniff", | ||
"X-XSS-Protection": "0", | ||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", | ||
"Content-Security-Policy": "default-src 'none'", | ||
"Server": "github.com", | ||
"X-GitHub-Request-Id": "9EA1:32201C:118116E:119A333:66E9CD70" | ||
} | ||
}, | ||
"uuid": "f17d4d94-f19c-425e-8133-f9f3ad2bafea", | ||
"persistent": true, | ||
"insertionIndex": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
**/extras/** | ||
**/AbuseLimitHandlerTest | ||
**/GHRateLimitTest | ||
**/GHPullRequestTest | ||
**/RequesterRetryTest | ||
|