8000 Merge pull request #1945 from bitwiseman/feature/testGetEmails · hub4j/github-api@6e6c2c2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6e6c2c2

Browse files
authored
Merge pull request #1945 from bitwiseman/feature/testGetEmails
Test getEmails
2 parents d9f8fff + f14aa53 commit 6e6c2c2

File tree

6 files changed

+171
-2
lines changed

6 files changed

+171
-2
lines changed

src/main/java/org/kohsuke/github/GHMyself.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ public enum RepositoryListFilter {
5050
* @return the emails
5151
* @throws IOException
5252
* the io exception
53-
* @deprecated Use {@link #getEmails2()}
53+
* @deprecated Use {@link #listEmails()}
5454
*/
5555
@Deprecated
5656
public List<String> getEmails() throws IOException {
57-
return listEmails().toList().stream().map(email -> email.getEmail()).collect(Collectors.toList());
57+
return getEmails2().stream().map(email -> email.getEmail()).collect(Collectors.toList());
5858
}
5959

6060
/**

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,19 @@ public void testUserPublicEventApi() throws Exception {
10431043
}
10441044
}
10451045

1046+
/**
1047+
* Test getEmails.
1048+
*
1049+
* @throws IOException
1050+
* Signals that an I/O exception has occurred.
1051+
*/
1052+
@Test
1053+
public void testGetEmails() throws IOException {
1054+
List<String> emails = gitHub.getMyself().getEmails();
1055+
assertThat(emails.size(), equalTo(2));
1056+
assertThat(emails, contains("bitwiseman@gmail.com", "bitwiseman@users.noreply.github.com"));
1057+
}
1058+
10461059
/**
10471060
* Test app.
10481061
*
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"login": "bitwiseman",
3+
"id": 1958953,
4+
"node_id": "MDQ6VXNlcjE5NTg5NTM=",
5+
"avatar_url": "https://avatars.githubusercontent.com/u/1958953?v=4",
6+
"gravatar_id": "",
7+
"url": "https://api.github.com/users/bitwiseman",
8+
"html_url": "https://github.com/bitwiseman",
9+
"followers_url": "https://api.github.com/users/bitwiseman/followers",
10+
"following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
11+
"gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
12+
"starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
13+
"subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
14+
"organizations_url": "https://api.github.com/users/bitwiseman/orgs",
15+
"repos_url": "https://api.github.com/users/bitwiseman/repos",
16+
"events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
17+
"received_events_url": "https://api.github.com/users/bitwiseman/received_events",
18+
"type": "User",
19+
"site_admin": false,
20+
"name": "Liam Newman",
21+
"company": null,
22+
"blog": "",
23+
"location": "Seattle, WA, USA",
24+
"email": "bitwiseman@gmail.com",
25+
"hireable": null,
26+
"bio": null,
27+
"twitter_username": "bitwiseman",
28+
"notification_email": "bitwiseman@gmail.com",
29+
"public_repos": 212,
30+
"public_gists": 8,
31+
"followers": 258,
32+
"following": 12,
33+
"created_at": "2012-07-11T20:38:33Z",
34+
"updated_at": "2024-07-11T16:46:55Z",
35+
"private_gists": 19,
36+
"total_private_repos": 3,
37+
"owned_private_repos": 3,
38+
"disk_usage": 34051,
39+
"collaborators": 4,
40+
"two_factor_authentication": true,
41+
"plan": {
42+
"name": "free",
43+
"space": 976562499,
44+
"collaborators": 0,
45+
"private_repos": 10000
46+
}
47+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"email": "bitwiseman@gmail.com",
4+
"primary": true,
5+
"verified": true,
6+
"visibility": "public"
7+
},
8+
{
9+
"email": "bitwiseman@users.noreply.github.com",
10+
"primary": false,
11+
"verified": true,
12+
"visibility": null
13+
}
14+
]
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"id": "ccd6f98f-7d6f-44a8-87ab-375e3a49d8f2",
3+
"name": "user",
4+
"request": {
5+
"url": "/user",
6+
"method": "GET",
7+
"headers": {
8+
"Accept": {
9+
"equalTo": "application/vnd.github+json"
10+
}
11+
}
12+
},
13+
"response": {
14+
"status": 200,
15+
"bodyFileName": "1-user.json",
16+
"headers": {
17+
"Date": "Tue, 17 Sep 2024 18:41:52 GMT",
18+
"Content-Type": "application/json; charset=utf-8",
19+
"Cache-Control": "private, max-age=60, s-maxage=60",
20+
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With",
21+
"ETag": "W/\"a27242a466c3df86c7421f5da77e7af0282d7b11679db48547af0b315d2eb3c1\"",
22+
"Last-Modified": "Thu, 11 Jul 2024 16:46:55 GMT",
23+
"X-OAuth-Scopes": "read:user, repo, user:email",
24+
"X-Accepted-OAuth-Scopes": "",
25+
"github-authentication-token-expiration": "2024-10-17 18:38:10 UTC",
26+
"X-GitHub-Media-Type": "github.v3; format=json",
27+
"x-github-api-version-selected": "2022-11-28",
28+
"X-RateLimit-Limit": "5000",
29+
"X-RateLimit-Remaining": "4991",
30+
"X-RateLimit-Reset": "1726601960",
31+
"X-RateLimit-Used": "9",
32+
"X-RateLimit-Resource": "core",
33+
"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",
34+
"Access-Control-Allow-Origin": "*",
35+
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
36+
"X-Frame-Options": "deny",
37+
"X-Content-Type-Options": "nosniff",
38+
"X-XSS-Protection": "0",
39+
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
40+
"Content-Security-Policy": "default-src 'none'",
41+
"Server": "github.com",
42+
"X-GitHub-Request-Id": "6A1F:A6CDA:12AE1BE:12C74DE:66E9CD70"
43+
}
44+
},
45+
"uuid": "ccd6f98f-7d6f-44a8-87ab-375e3a49d8f2",
46+
"persistent": true,
47+
"insertionIndex": 1
48+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"id": "f17d4d94-f19c-425e-8133-f9f3ad2bafea",
3+
"name": "user_emails",
4+
"request": {
5+
"url": "/user/emails",
6+
"method": "GET",
7+
"headers": {
8+
"Accept": {
9+
"equalTo": "application/vnd.github+json"
10+
}
11+
}
12+
},
13+
"response": {
14+
"status": 200,
15+
"bodyFileName": "2-user_emails.json",
16+
"headers": {
17+
"Date": "Tue, 17 Sep 2024 18:41:52 GMT",
18+
"Content-Type": "application/json; charset=utf-8",
19+
"Cache-Control": "private, max-age=60, s-maxage=60",
20+
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With",
21+
"ETag": "W/\"6e974566422ee9f8351add9d3450581b14045944d67d5b0d45d93816f7526d77\"",
22+
"X-OAuth-Scopes": "read:user, repo, user:email",
23+
"X-Accepted-OAuth-Scopes": "user, user:email",
24+
"github-authentication-token-expiration": "2024-10-17 18:38:10 UTC",
25+
"X-GitHub-Media-Type": "github.v3; format=json",
26+
"x-github-api-version-selected": "2022-11-28",
27+
"X-RateLimit-Limit": "5000",
28+
"X-RateLimit-Remaining": "4989",
29+
"X-RateLimit-Reset": "1726601960",
30+
"X-RateLimit-Used": "11",
31+
"X-RateLimit-Resource": "core",
32+
"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",
33+
"Access-Control-Allow-Origin": "*",
34+
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
35+
"X-Frame-Options": "deny",
36+
"X-Content-Type-Options": "nosniff",
37+
"X-XSS-Protection": "0",
38+
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
39+
"Content-Security-Policy": "default-src 'none'",
40+
"Server": "github.com",
41+
"X-GitHub-Request-Id": "9EA1:32201C:118116E:119A333:66E9CD70"
42+
}
43+
},
44+
"uuid": "f17d4d94-f19c-425e-8133-f9f3ad2bafea",
45+
"persistent": true,
46+
"insertionIndex": 2
47+
}

0 commit comments

Comments
 (0)
0