From f25e5f94882dc14e5d713f0ae9e6460dc26c2f96 Mon Sep 17 00:00:00 2001 From: spierce Date: Mon, 24 Feb 2020 15:55:39 -0600 Subject: [PATCH 1/4] [#714]Fix query parameter construction of org member filter --- .../org/kohsuke/github/GHOrganization.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHOrganization.java b/src/main/java/org/kohsuke/github/GHOrganization.java index 061b77d565..bdfa0bd1ac 100644 --- a/src/main/java/org/kohsuke/github/GHOrganization.java +++ b/src/main/java/org/kohsuke/github/GHOrganization.java @@ -279,7 +279,7 @@ public PagedIterable listPublicMembers() throws IOException { } private PagedIterable listMembers(String suffix) throws IOException { - return listMembers(suffix, null); + return listMembers(suffix, null, null); } /** @@ -292,13 +292,27 @@ private PagedIterable listMembers(String suffix) throws IOException { * the io exception */ public PagedIterable listMembersWithFilter(String filter) throws IOException { - return listMembers("members", filter); + return listMembers("members", filter, null); } - private PagedIterable listMembers(final String suffix, final String filter) throws IOException { - String filterParams = (filter == null) ? "" : ("?filter=" + filter); + /** + * List members with specified role paged iterable. + * + * @param role + * the filter + * @return the paged iterable + * @throws IOException + * the io exception + */ + public PagedIterable listMembersWithRole(String role) throws IOException { + return listMembers("members", null, role); + } + + private PagedIterable listMembers(final String suffix, final String filter, String role) throws IOException { return root.createRequest() - .withUrlPath(String.format("/orgs/%s/%s%s", login, suffix, filterParams)) + .withUrlPath(String.format("/orgs/%s/%s", login, suffix)) + .with("filter", filter) + .with("role", role) .toIterable(GHUser[].class, item -> item.wrapUp(root)); } From 0d145147128a89ed4764ea43b72ff2b220e61489 Mon Sep 17 00:00:00 2001 From: spierce Date: Mon, 24 Feb 2020 16:47:35 -0600 Subject: [PATCH 2/4] [#714]Formatting fix --- src/main/java/org/kohsuke/github/GHOrganization.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/kohsuke/github/GHOrganization.java b/src/main/java/org/kohsuke/github/GHOrganization.java index bdfa0bd1ac..228532ae6e 100644 --- a/src/main/java/org/kohsuke/github/GHOrganization.java +++ b/src/main/java/org/kohsuke/github/GHOrganization.java @@ -308,7 +308,8 @@ public PagedIterable listMembersWithRole(String role) throws IOException return listMembers("members", null, role); } - private PagedIterable listMembers(final String suffix, final String filter, String role) throws IOException { + private PagedIterable listMembers(final String suffix, final String filter, String role) + throws IOException { return root.createRequest() .withUrlPath(String.format("/orgs/%s/%s", login, suffix)) .with("filter", filter) From 006f1271d6227e3e3463b4978cb06ca9b2a8ca75 Mon Sep 17 00:00:00 2001 From: spierce Date: Mon, 24 Feb 2020 17:22:03 -0600 Subject: [PATCH 3/4] [#714]Add test for new method --- .../org/kohsuke/github/GHOrganization.java | 2 +- .../kohsuke/github/GHOrganizationTest.java | 10 ++++ ...-6480b3f7-e3e1-4a01-98fb-ca85b6ea4099.json | 41 ++++++++++++++++ ...-e0db340d-7d23-488e-9858-6e71ed5a4c84.json | 42 ++++++++++++++++ ...-7e6e7d53-a5ae-46b0-afc0-a73258da075d.json | 45 +++++++++++++++++ .../orgs_github-api-test-org-1-6480b3.json | 46 ++++++++++++++++++ ..._github-api-test-org_members-2-e0db34.json | 45 +++++++++++++++++ .../mappings/user-6-7e6e7d.json | 48 +++++++++++++++++++ 8 files changed, 278 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org-6480b3f7-e3e1-4a01-98fb-ca85b6ea4099.json create mode 100644 src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org_members-e0db340d-7d23-488e-9858-6e71ed5a4c84.json create mode 100644 src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/user-7e6e7d53-a5ae-46b0-afc0-a73258da075d.json create mode 100644 src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org-1-6480b3.json create mode 100644 src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org_members-2-e0db34.json create mode 100644 src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/user-6-7e6e7d.json diff --git a/src/main/java/org/kohsuke/github/GHOrganization.java b/src/main/java/org/kohsuke/github/GHOrganization.java index 228532ae6e..1955feccc3 100644 --- a/src/main/java/org/kohsuke/github/GHOrganization.java +++ b/src/main/java/org/kohsuke/github/GHOrganization.java @@ -299,7 +299,7 @@ public PagedIterable listMembersWithFilter(String filter) throws IOExcep * List members with specified role paged iterable. * * @param role - * the filter + * the role * @return the paged iterable * @throws IOException * the io exception diff --git a/src/test/java/org/kohsuke/github/GHOrganizationTest.java b/src/test/java/org/kohsuke/github/GHOrganizationTest.java index 5c3cf2140a..7e7bf542c1 100644 --- a/src/test/java/org/kohsuke/github/GHOrganizationTest.java +++ b/src/test/java/org/kohsuke/github/GHOrganizationTest.java @@ -7,6 +7,7 @@ import org.kohsuke.github.GHOrganization.Permission; import java.io.IOException; +import java.util.List; public class GHOrganizationTest extends AbstractGitHubWireMockTest { @@ -76,6 +77,15 @@ public void testInviteUser() throws IOException { // assertTrue(org.hasMember(user)); } + @Test + public void testListMembersWithRole() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + List admins = org.listMembersWithRole("admin").asList(); + + assertFalse(admins.isEmpty()); + } + @Test public void testCreateTeamWithRepoAccess() throws IOException { String REPO_NAME = "github-api"; diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org-6480b3f7-e3e1-4a01-98fb-ca85b6ea4099.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org-6480b3f7-e3e1-4a01-98fb-ca85b6ea4099.json new file mode 100644 index 0000000000..3810bc400e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org-6480b3f7-e3e1-4a01-98fb-ca85b6ea4099.json @@ -0,0 +1,41 @@ +{ + "login": "github-api-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/github-api-test-org", + "repos_url": "https://api.github.com/orgs/github-api-test-org/repos", + "events_url": "https://api.github.com/orgs/github-api-test-org/events", + "hooks_url": "https://api.github.com/orgs/github-api-test-org/hooks", + "issues_url": "https://api.github.com/orgs/github-api-test-org/issues", + "members_url": "https://api.github.com/orgs/github-api-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/github-api-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 9, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/github-api-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 132, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 5, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org_members-e0db340d-7d23-488e-9858-6e71ed5a4c84.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org_members-e0db340d-7d23-488e-9858-6e71ed5a4c84.json new file mode 100644 index 0000000000..5fb4db14e7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org_members-e0db340d-7d23-488e-9858-6e71ed5a4c84.json @@ -0,0 +1,42 @@ +[ + { + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.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 + }, + { + "login": "kohsuke2", + "id": 1329242, + "node_id": "MDQ6VXNlcjEzMjkyNDI=", + "avatar_url": "https://avatars2.githubusercontent.com/u/1329242?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke2", + "html_url": "https://github.com/kohsuke2", + "followers_url": "https://api.github.com/users/kohsuke2/followers", + "following_url": "https://api.github.com/users/kohsuke2/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke2/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke2/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke2/orgs", + "repos_url": "https://api.github.com/users/kohsuke2/repos", + "events_url": "https://api.github.com/users/kohsuke2/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke2/received_events", + "type": "User", + "site_admin": false + } +] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/user-7e6e7d53-a5ae-46b0-afc0-a73258da075d.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/user-7e6e7d53-a5ae-46b0-afc0-a73258da075d.json new file mode 100644 index 0000000000..ee0bf1e3a3 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/user-7e6e7d53-a5ae-46b0-afc0-a73258da075d.json @@ -0,0 +1,45 @@ +{ + "login": "asthinasthi", + "id": 4577101, + "node_id": "MDQ6VXNlcjQ1NzcxMDE=", + "avatar_url": "https://avatars1.githubusercontent.com/u/4577101?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/asthinasthi", + "html_url": "https://github.com/asthinasthi", + "followers_url": "https://api.github.com/users/asthinasthi/followers", + "following_url": "https://api.github.com/users/asthinasthi/following{/other_user}", + "gists_url": "https://api.github.com/users/asthinasthi/gists{/gist_id}", + "starred_url": "https://api.github.com/users/asthinasthi/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/asthinasthi/subscriptions", + "organizations_url": "https://api.github.com/users/asthinasthi/orgs", + "repos_url": "https://api.github.com/users/asthinasthi/repos", + "events_url": "https://api.github.com/users/asthinasthi/events{/privacy}", + "received_events_url": "https://api.github.com/users/asthinasthi/received_events", + "type": "User", + "site_admin": false, + "name": "Anirudh Mathad", + "company": "Adobe", + "blog": "", + "location": "San Jose", + "email": "anirudh.mathad@gmail.com", + "hireable": null, + "bio": "Backend Engineer", + "public_repos": 43, + "public_gists": 1, + "followers": 12, + "following": 35, + "created_at": "2013-05-31T05:50:17Z", + "updated_at": "2019-11-19T18:23:21Z", + "private_gists": 3, + "total_private_repos": 1, + "owned_private_repos": 1, + "disk_usage": 122519, + "collaborators": 0, + "two_factor_authentication": false, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org-1-6480b3.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org-1-6480b3.json new file mode 100644 index 0000000000..c159022fc6 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org-1-6480b3.json @@ -0,0 +1,46 @@ +{ + "id": "6480b3f7-e3e1-4a01-98fb-ca85b6ea4099", + "name": "orgs_github-api-test-org", + "request": { + "url": "/orgs/github-api-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_github-api-test-org-6480b3f7-e3e1-4a01-98fb-ca85b6ea4099.json", + "headers": { + "Date": "Mon, 07 Oct 2019 01:45:07 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4947", + "X-RateLimit-Reset": "1570415536", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"d8bc4d5d05a58bb455672c502a2bd068\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "ED29:68EB:382F4B:417BC3:5D9A98A2" + } + }, + "uuid": "6480b3f7-e3e1-4a01-98fb-ca85b6ea4099", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org_members-2-e0db34.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org_members-2-e0db34.json new file mode 100644 index 0000000000..d9dd65dad4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org_members-2-e0db34.json @@ -0,0 +1,45 @@ +{ + "id": "e0db340d-7d23-488e-9858-6e71ed5a4c84", + "name": "orgs_github-api-test-org_members", + "request": { + "url": "/orgs/github-api-test-org/members?role=admin", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_github-api-test-org_members-e0db340d-7d23-488e-9858-6e71ed5a4c84.json", + "headers": { + "Date": "Mon, 07 Oct 2019 01:45:07 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4946", + "X-RateLimit-Reset": "1570415536", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"28698a13d1d693d64b821be22f3d3455\"", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "ED29:68EB:382F58:417BD1:5D9A98A3" + } + }, + "uuid": "e0db340d-7d23-488e-9858-6e71ed5a4c84", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/user-6-7e6e7d.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/user-6-7e6e7d.json new file mode 100644 index 0000000000..5c7307740f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/user-6-7e6e7d.json @@ -0,0 +1,48 @@ +{ + "id": "7e6e7d53-a5ae-46b0-afc0-a73258da075d", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "user-7e6e7d53-a5ae-46b0-afc0-a73258da075d.json", + "headers": { + "Date": "Wed, 20 Nov 2019 01:07:55 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4950", + "X-RateLimit-Reset": "1574215499", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"3d6980508567a2e87daa452d20106bcd\"", + "Last-Modified": "Tue, 19 Nov 2019 18:23:21 GMT", + "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, read:packages, repo, user, workflow, write:discussion, write:packages", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "A230:58D9:963D8A:AF4500:5DD491EB" + } + }, + "uuid": "7e6e7d53-a5ae-46b0-afc0-a73258da075d", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file From 5baeac4706ce0343d0e8c4ba2ade0e3339a6e058 Mon Sep 17 00:00:00 2001 From: spierce Date: Tue, 25 Feb 2020 08:42:10 -0600 Subject: [PATCH 4/4] [#714]More specific assertions; Add test for members with filter --- .../kohsuke/github/GHOrganizationTest.java | 37 ++- ...3ed48345-73c2-4d8e-9c65-f4a140356d59.json} | 6 +- ...-ef9f50f7-160c-4410-a82e-68d3e14fb250.json | 242 ++++++++++++++++++ ...-9e0ec7a6-d16f-4198-b2e6-ed290e9d780d.json | 45 ++++ .../orgs_github-api-test-org-2-3ed483.json} | 24 +- ..._github-api-test-org_members-3-ef9f50.json | 47 ++++ .../mappings/user-1-9e0ec7.json} | 26 +- ...-6682f58b-c93b-4525-9e99-485e631aaaab.json | 41 +++ ...-80be661d-6679-43df-9ced-eb3b78827280.json | 242 ++++++++++++++++++ ...-e0db340d-7d23-488e-9858-6e71ed5a4c84.json | 42 --- ...-7e6e7d53-a5ae-46b0-afc0-a73258da075d.json | 45 ---- ...-a3604d73-d76d-4f3e-8f7f-cecee94c5cef.json | 45 ++++ .../orgs_github-api-test-org-2-6682f5.json | 48 ++++ ...github-api-test-org_members-3-80be66.json} | 24 +- .../mappings/user-1-a3604d.json | 48 ++++ 15 files changed, 836 insertions(+), 126 deletions(-) rename src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/{testListMembersWithRole/__files/orgs_github-api-test-org-6480b3f7-e3e1-4a01-98fb-ca85b6ea4099.json => testListMembersWithFilter/__files/orgs_github-api-test-org-3ed48345-73c2-4d8e-9c65-f4a140356d59.json} (95%) create mode 100644 src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/__files/orgs_github-api-test-org_members-ef9f50f7-160c-4410-a82e-68d3e14fb250.json create mode 100644 src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/__files/user-9e0ec7a6-d16f-4198-b2e6-ed290e9d780d.json rename src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/{testListMembersWithRole/mappings/orgs_github-api-test-org-1-6480b3.json => testListMembersWithFilter/mappings/orgs_github-api-test-org-2-3ed483.json} (67%) create mode 100644 src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/mappings/orgs_github-api-test-org_members-3-ef9f50.json rename src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/{testListMembersWithRole/mappings/user-6-7e6e7d.json => testListMembersWithFilter/mappings/user-1-9e0ec7.json} (62%) create mode 100644 src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org-6682f58b-c93b-4525-9e99-485e631aaaab.json create mode 100644 src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org_members-80be661d-6679-43df-9ced-eb3b78827280.json delete mode 100644 src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org_members-e0db340d-7d23-488e-9858-6e71ed5a4c84.json delete mode 100644 src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/user-7e6e7d53-a5ae-46b0-afc0-a73258da075d.json create mode 100644 src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/user-a3604d73-d76d-4f3e-8f7f-cecee94c5cef.json create mode 100644 src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org-2-6682f5.json rename src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/{orgs_github-api-test-org_members-2-e0db34.json => orgs_github-api-test-org_members-3-80be66.json} (68%) create mode 100644 src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/user-1-a3604d.json diff --git a/src/test/java/org/kohsuke/github/GHOrganizationTest.java b/src/test/java/org/kohsuke/github/GHOrganizationTest.java index 7e7bf542c1..029705c173 100644 --- a/src/test/java/org/kohsuke/github/GHOrganizationTest.java +++ b/src/test/java/org/kohsuke/github/GHOrganizationTest.java @@ -77,13 +77,48 @@ public void testInviteUser() throws IOException { // assertTrue(org.hasMember(user)); } + @Test + public void testListMembersWithFilter() throws IOException { + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + + List admins = org.listMembersWithFilter("all").asList(); + + assertNotNull(admins); + assertTrue(admins.size() >= 12); // In case more are added in the future + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("alexanderrtaylor"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("asthinasthi"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("bitwiseman"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("farmdawgnation"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("halkeye"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("jberglund-BSFT"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("kohsuke"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("kohsuke2"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("martinvanzijl"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("PauloMigAlmeida"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("Sage-Pierce"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("timja"))); + } + @Test public void testListMembersWithRole() throws IOException { GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); List admins = org.listMembersWithRole("admin").asList(); - assertFalse(admins.isEmpty()); + assertNotNull(admins); + assertTrue(admins.size() >= 12); // In case more are added in the future + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("alexanderrtaylor"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("asthinasthi"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("bitwiseman"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("farmdawgnation"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("halkeye"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("jberglund-BSFT"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("kohsuke"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("kohsuke2"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("martinvanzijl"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("PauloMigAlmeida"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("Sage-Pierce"))); + assertTrue(admins.stream().anyMatch(ghUser -> ghUser.getLogin().equals("timja"))); } @Test diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org-6480b3f7-e3e1-4a01-98fb-ca85b6ea4099.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/__files/orgs_github-api-test-org-3ed48345-73c2-4d8e-9c65-f4a140356d59.json similarity index 95% rename from src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org-6480b3f7-e3e1-4a01-98fb-ca85b6ea4099.json rename to src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/__files/orgs_github-api-test-org-3ed48345-73c2-4d8e-9c65-f4a140356d59.json index 3810bc400e..8f7c610936 100644 --- a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org-6480b3f7-e3e1-4a01-98fb-ca85b6ea4099.json +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/__files/orgs_github-api-test-org-3ed48345-73c2-4d8e-9c65-f4a140356d59.json @@ -14,7 +14,7 @@ "is_verified": false, "has_organization_projects": true, "has_repository_projects": true, - "public_repos": 9, + "public_repos": 11, "public_gists": 0, "followers": 0, "following": 0, @@ -25,7 +25,7 @@ "total_private_repos": 0, "owned_private_repos": 0, "private_gists": 0, - "disk_usage": 132, + "disk_usage": 147, "collaborators": 0, "billing_email": "kk@kohsuke.org", "default_repository_permission": "none", @@ -35,7 +35,7 @@ "name": "free", "space": 976562499, "private_repos": 0, - "filled_seats": 5, + "filled_seats": 12, "seats": 0 } } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/__files/orgs_github-api-test-org_members-ef9f50f7-160c-4410-a82e-68d3e14fb250.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/__files/orgs_github-api-test-org_members-ef9f50f7-160c-4410-a82e-68d3e14fb250.json new file mode 100644 index 0000000000..c8fc2f66f7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/__files/orgs_github-api-test-org_members-ef9f50f7-160c-4410-a82e-68d3e14fb250.json @@ -0,0 +1,242 @@ +[ + { + "login": "alexanderrtaylor", + "id": 852179, + "node_id": "MDQ6VXNlcjg1MjE3OQ==", + "avatar_url": "https://avatars0.githubusercontent.com/u/852179?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/alexanderrtaylor", + "html_url": "https://github.com/alexanderrtaylor", + "followers_url": "https://api.github.com/users/alexanderrtaylor/followers", + "following_url": "https://api.github.com/users/alexanderrtaylor/following{/other_user}", + "gists_url": "https://api.github.com/users/alexanderrtaylor/gists{/gist_id}", + "starred_url": "https://api.github.com/users/alexanderrtaylor/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/alexanderrtaylor/subscriptions", + "organizations_url": "https://api.github.com/users/alexanderrtaylor/orgs", + "repos_url": "https://api.github.com/users/alexanderrtaylor/repos", + "events_url": "https://api.github.com/users/alexanderrtaylor/events{/privacy}", + "received_events_url": "https://api.github.com/users/alexanderrtaylor/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "asthinasthi", + "id": 4577101, + "node_id": "MDQ6VXNlcjQ1NzcxMDE=", + "avatar_url": "https://avatars1.githubusercontent.com/u/4577101?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/asthinasthi", + "html_url": "https://github.com/asthinasthi", + "followers_url": "https://api.github.com/users/asthinasthi/followers", + "following_url": "https://api.github.com/users/asthinasthi/following{/other_user}", + "gists_url": "https://api.github.com/users/asthinasthi/gists{/gist_id}", + "starred_url": "https://api.github.com/users/asthinasthi/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/asthinasthi/subscriptions", + "organizations_url": "https://api.github.com/users/asthinasthi/orgs", + "repos_url": "https://api.github.com/users/asthinasthi/repos", + "events_url": "https://api.github.com/users/asthinasthi/events{/privacy}", + "received_events_url": "https://api.github.com/users/asthinasthi/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.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 + }, + { + "login": "farmdawgnation", + "id": 620189, + "node_id": "MDQ6VXNlcjYyMDE4OQ==", + "avatar_url": "https://avatars2.githubusercontent.com/u/620189?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/farmdawgnation", + "html_url": "https://github.com/farmdawgnation", + "followers_url": "https://api.github.com/users/farmdawgnation/followers", + "following_url": "https://api.github.com/users/farmdawgnation/following{/other_user}", + "gists_url": "https://api.github.com/users/farmdawgnation/gists{/gist_id}", + "starred_url": "https://api.github.com/users/farmdawgnation/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/farmdawgnation/subscriptions", + "organizations_url": "https://api.github.com/users/farmdawgnation/orgs", + "repos_url": "https://api.github.com/users/farmdawgnation/repos", + "events_url": "https://api.github.com/users/farmdawgnation/events{/privacy}", + "received_events_url": "https://api.github.com/users/farmdawgnation/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "halkeye", + "id": 110087, + "node_id": "MDQ6VXNlcjExMDA4Nw==", + "avatar_url": "https://avatars3.githubusercontent.com/u/110087?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/halkeye", + "html_url": "https://github.com/halkeye", + "followers_url": "https://api.github.com/users/halkeye/followers", + "following_url": "https://api.github.com/users/halkeye/following{/other_user}", + "gists_url": "https://api.github.com/users/halkeye/gists{/gist_id}", + "starred_url": "https://api.github.com/users/halkeye/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/halkeye/subscriptions", + "organizations_url": "https://api.github.com/users/halkeye/orgs", + "repos_url": "https://api.github.com/users/halkeye/repos", + "events_url": "https://api.github.com/users/halkeye/events{/privacy}", + "received_events_url": "https://api.github.com/users/halkeye/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "jberglund-BSFT", + "id": 19560713, + "node_id": "MDQ6VXNlcjE5NTYwNzEz", + "avatar_url": "https://avatars3.githubusercontent.com/u/19560713?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jberglund-BSFT", + "html_url": "https://github.com/jberglund-BSFT", + "followers_url": "https://api.github.com/users/jberglund-BSFT/followers", + "following_url": "https://api.github.com/users/jberglund-BSFT/following{/other_user}", + "gists_url": "https://api.github.com/users/jberglund-BSFT/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jberglund-BSFT/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jberglund-BSFT/subscriptions", + "organizations_url": "https://api.github.com/users/jberglund-BSFT/orgs", + "repos_url": "https://api.github.com/users/jberglund-BSFT/repos", + "events_url": "https://api.github.com/users/jberglund-BSFT/events{/privacy}", + "received_events_url": "https://api.github.com/users/jberglund-BSFT/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "kohsuke", + "id": 50003, + "node_id": "MDQ6VXNlcjUwMDAz", + "avatar_url": "https://avatars1.githubusercontent.com/u/50003?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke", + "html_url": "https://github.com/kohsuke", + "followers_url": "https://api.github.com/users/kohsuke/followers", + "following_url": "https://api.github.com/users/kohsuke/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke/orgs", + "repos_url": "https://api.github.com/users/kohsuke/repos", + "events_url": "https://api.github.com/users/kohsuke/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "kohsuke2", + "id": 1329242, + "node_id": "MDQ6VXNlcjEzMjkyNDI=", + "avatar_url": "https://avatars2.githubusercontent.com/u/1329242?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke2", + "html_url": "https://github.com/kohsuke2", + "followers_url": "https://api.github.com/users/kohsuke2/followers", + "following_url": "https://api.github.com/users/kohsuke2/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke2/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke2/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke2/orgs", + "repos_url": "https://api.github.com/users/kohsuke2/repos", + "events_url": "https://api.github.com/users/kohsuke2/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke2/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "martinvanzijl", + "id": 24422213, + "node_id": "MDQ6VXNlcjI0NDIyMjEz", + "avatar_url": "https://avatars0.githubusercontent.com/u/24422213?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/martinvanzijl", + "html_url": "https://github.com/martinvanzijl", + "followers_url": "https://api.github.com/users/martinvanzijl/followers", + "following_url": "https://api.github.com/users/martinvanzijl/following{/other_user}", + "gists_url": "https://api.github.com/users/martinvanzijl/gists{/gist_id}", + "starred_url": "https://api.github.com/users/martinvanzijl/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/martinvanzijl/subscriptions", + "organizations_url": "https://api.github.com/users/martinvanzijl/orgs", + "repos_url": "https://api.github.com/users/martinvanzijl/repos", + "events_url": "https://api.github.com/users/martinvanzijl/events{/privacy}", + "received_events_url": "https://api.github.com/users/martinvanzijl/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "PauloMigAlmeida", + "id": 1011868, + "node_id": "MDQ6VXNlcjEwMTE4Njg=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1011868?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/PauloMigAlmeida", + "html_url": "https://github.com/PauloMigAlmeida", + "followers_url": "https://api.github.com/users/PauloMigAlmeida/followers", + "following_url": "https://api.github.com/users/PauloMigAlmeida/following{/other_user}", + "gists_url": "https://api.github.com/users/PauloMigAlmeida/gists{/gist_id}", + "starred_url": "https://api.github.com/users/PauloMigAlmeida/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/PauloMigAlmeida/subscriptions", + "organizations_url": "https://api.github.com/users/PauloMigAlmeida/orgs", + "repos_url": "https://api.github.com/users/PauloMigAlmeida/repos", + "events_url": "https://api.github.com/users/PauloMigAlmeida/events{/privacy}", + "received_events_url": "https://api.github.com/users/PauloMigAlmeida/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "Sage-Pierce", + "id": 5396306, + "node_id": "MDQ6VXNlcjUzOTYzMDY=", + "avatar_url": "https://avatars3.githubusercontent.com/u/5396306?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Sage-Pierce", + "html_url": "https://github.com/Sage-Pierce", + "followers_url": "https://api.github.com/users/Sage-Pierce/followers", + "following_url": "https://api.github.com/users/Sage-Pierce/following{/other_user}", + "gists_url": "https://api.github.com/users/Sage-Pierce/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Sage-Pierce/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Sage-Pierce/subscriptions", + "organizations_url": "https://api.github.com/users/Sage-Pierce/orgs", + "repos_url": "https://api.github.com/users/Sage-Pierce/repos", + "events_url": "https://api.github.com/users/Sage-Pierce/events{/privacy}", + "received_events_url": "https://api.github.com/users/Sage-Pierce/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "timja", + "id": 21194782, + "node_id": "MDQ6VXNlcjIxMTk0Nzgy", + "avatar_url": "https://avatars3.githubusercontent.com/u/21194782?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/timja", + "html_url": "https://github.com/timja", + "followers_url": "https://api.github.com/users/timja/followers", + "following_url": "https://api.github.com/users/timja/following{/other_user}", + "gists_url": "https://api.github.com/users/timja/gists{/gist_id}", + "starred_url": "https://api.github.com/users/timja/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/timja/subscriptions", + "organizations_url": "https://api.github.com/users/timja/orgs", + "repos_url": "https://api.github.com/users/timja/repos", + "events_url": "https://api.github.com/users/timja/events{/privacy}", + "received_events_url": "https://api.github.com/users/timja/received_events", + "type": "User", + "site_admin": false + } +] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/__files/user-9e0ec7a6-d16f-4198-b2e6-ed290e9d780d.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/__files/user-9e0ec7a6-d16f-4198-b2e6-ed290e9d780d.json new file mode 100644 index 0000000000..750413948a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/__files/user-9e0ec7a6-d16f-4198-b2e6-ed290e9d780d.json @@ -0,0 +1,45 @@ +{ + "login": "Sage-Pierce", + "id": 5396306, + "node_id": "MDQ6VXNlcjUzOTYzMDY=", + "avatar_url": "https://avatars3.githubusercontent.com/u/5396306?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Sage-Pierce", + "html_url": "https://github.com/Sage-Pierce", + "followers_url": "https://api.github.com/users/Sage-Pierce/followers", + "following_url": "https://api.github.com/users/Sage-Pierce/following{/other_user}", + "gists_url": "https://api.github.com/users/Sage-Pierce/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Sage-Pierce/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Sage-Pierce/subscriptions", + "organizations_url": "https://api.github.com/users/Sage-Pierce/orgs", + "repos_url": "https://api.github.com/users/Sage-Pierce/repos", + "events_url": "https://api.github.com/users/Sage-Pierce/events{/privacy}", + "received_events_url": "https://api.github.com/users/Sage-Pierce/received_events", + "type": "User", + "site_admin": false, + "name": "Sage Pierce", + "company": "@Vrbo @ExpediaGroup", + "blog": "", + "location": null, + "email": "sapierce@vrbo.com", + "hireable": true, + "bio": "Software engineer with a Masters of Science in Electrical and Computer Engineering out of The University of Texas at Austin.", + "public_repos": 9, + "public_gists": 0, + "followers": 4, + "following": 0, + "created_at": "2013-09-06T02:22:48Z", + "updated_at": "2020-02-18T13:29:56Z", + "private_gists": 0, + "total_private_repos": 0, + "owned_private_repos": 0, + "disk_usage": 1816, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org-1-6480b3.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/mappings/orgs_github-api-test-org-2-3ed483.json similarity index 67% rename from src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org-1-6480b3.json rename to src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/mappings/orgs_github-api-test-org-2-3ed483.json index c159022fc6..a257d2274e 100644 --- a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org-1-6480b3.json +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/mappings/orgs_github-api-test-org-2-3ed483.json @@ -1,5 +1,5 @@ { - "id": "6480b3f7-e3e1-4a01-98fb-ca85b6ea4099", + "id": "3ed48345-73c2-4d8e-9c65-f4a140356d59", "name": "orgs_github-api-test-org", "request": { "url": "/orgs/github-api-test-org", @@ -12,22 +12,24 @@ }, "response": { "status": 200, - "bodyFileName": "orgs_github-api-test-org-6480b3f7-e3e1-4a01-98fb-ca85b6ea4099.json", + "bodyFileName": "orgs_github-api-test-org-3ed48345-73c2-4d8e-9c65-f4a140356d59.json", "headers": { - "Date": "Mon, 07 Oct 2019 01:45:07 GMT", - "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:05 GMT", + "Content-Type": "application/json; charset=utf-8", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4947", - "X-RateLimit-Reset": "1570415536", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1582644474", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", - "Accept-Encoding" + "Accept-Encoding, Accept, X-Requested-With" ], - "ETag": "W/\"d8bc4d5d05a58bb455672c502a2bd068\"", + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", "X-GitHub-Media-Type": "unknown, github.v3", "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", "Access-Control-Allow-Origin": "*", @@ -37,10 +39,10 @@ "X-XSS-Protection": "1; mode=block", "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", "Content-Security-Policy": "default-src 'none'", - "X-GitHub-Request-Id": "ED29:68EB:382F4B:417BC3:5D9A98A2" + "X-GitHub-Request-Id": "EB37:2979:3EAF7E:786110:5E5531FF" } }, - "uuid": "6480b3f7-e3e1-4a01-98fb-ca85b6ea4099", + "uuid": "3ed48345-73c2-4d8e-9c65-f4a140356d59", "persistent": true, - "insertionIndex": 1 + "insertionIndex": 2 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/mappings/orgs_github-api-test-org_members-3-ef9f50.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/mappings/orgs_github-api-test-org_members-3-ef9f50.json new file mode 100644 index 0000000000..1f03bdc51b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/mappings/orgs_github-api-test-org_members-3-ef9f50.json @@ -0,0 +1,47 @@ +{ + "id": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "name": "orgs_github-api-test-org_members", + "request": { + "url": "/orgs/github-api-test-org/members?filter=all", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_github-api-test-org_members-ef9f50f7-160c-4410-a82e-68d3e14fb250.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:06 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1582644475", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"631de12e6bc586863218257765331a70\"", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "EB37:2979:3EAF8C:78624D:5E553201" + } + }, + "uuid": "ef9f50f7-160c-4410-a82e-68d3e14fb250", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/user-6-7e6e7d.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/mappings/user-1-9e0ec7.json similarity index 62% rename from src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/user-6-7e6e7d.json rename to src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/mappings/user-1-9e0ec7.json index 5c7307740f..dfc3db833b 100644 --- a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/user-6-7e6e7d.json +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithFilter/mappings/user-1-9e0ec7.json @@ -1,5 +1,5 @@ { - "id": "7e6e7d53-a5ae-46b0-afc0-a73258da075d", + "id": "9e0ec7a6-d16f-4198-b2e6-ed290e9d780d", "name": "user", "request": { "url": "/user", @@ -12,23 +12,23 @@ }, "response": { "status": 200, - "bodyFileName": "user-7e6e7d53-a5ae-46b0-afc0-a73258da075d.json", + "bodyFileName": "user-9e0ec7a6-d16f-4198-b2e6-ed290e9d780d.json", "headers": { - "Date": "Wed, 20 Nov 2019 01:07:55 GMT", - "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:41:03 GMT", + "Content-Type": "application/json; charset=utf-8", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4950", - "X-RateLimit-Reset": "1574215499", + "X-RateLimit-Remaining": "4988", + "X-RateLimit-Reset": "1582644474", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", - "Accept-Encoding" + "Accept-Encoding, Accept, X-Requested-With" ], - "ETag": "W/\"3d6980508567a2e87daa452d20106bcd\"", - "Last-Modified": "Tue, 19 Nov 2019 18:23:21 GMT", - "X-OAuth-Scopes": "admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, read:packages, repo, user, workflow, write:discussion, write:packages", + "ETag": "W/\"9adfa44fe91fb698b5fd807d9471afc3\"", + "Last-Modified": "Tue, 18 Feb 2020 13:29:56 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", "X-Accepted-OAuth-Scopes": "", "X-GitHub-Media-Type": "unknown, github.v3", "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", @@ -39,10 +39,10 @@ "X-XSS-Protection": "1; mode=block", "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", "Content-Security-Policy": "default-src 'none'", - "X-GitHub-Request-Id": "A230:58D9:963D8A:AF4500:5DD491EB" + "X-GitHub-Request-Id": "EB37:2979:3EAEEA:7860F9:5E5531FF" } }, - "uuid": "7e6e7d53-a5ae-46b0-afc0-a73258da075d", + "uuid": "9e0ec7a6-d16f-4198-b2e6-ed290e9d780d", "persistent": true, - "insertionIndex": 6 + "insertionIndex": 1 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org-6682f58b-c93b-4525-9e99-485e631aaaab.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org-6682f58b-c93b-4525-9e99-485e631aaaab.json new file mode 100644 index 0000000000..8f7c610936 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org-6682f58b-c93b-4525-9e99-485e631aaaab.json @@ -0,0 +1,41 @@ +{ + "login": "github-api-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "url": "https://api.github.com/orgs/github-api-test-org", + "repos_url": "https://api.github.com/orgs/github-api-test-org/repos", + "events_url": "https://api.github.com/orgs/github-api-test-org/events", + "hooks_url": "https://api.github.com/orgs/github-api-test-org/hooks", + "issues_url": "https://api.github.com/orgs/github-api-test-org/issues", + "members_url": "https://api.github.com/orgs/github-api-test-org/members{/member}", + "public_members_url": "https://api.github.com/orgs/github-api-test-org/public_members{/member}", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "description": null, + "is_verified": false, + "has_organization_projects": true, + "has_repository_projects": true, + "public_repos": 11, + "public_gists": 0, + "followers": 0, + "following": 0, + "html_url": "https://github.com/github-api-test-org", + "created_at": "2014-05-10T19:39:11Z", + "updated_at": "2015-04-20T00:42:30Z", + "type": "Organization", + "total_private_repos": 0, + "owned_private_repos": 0, + "private_gists": 0, + "disk_usage": 147, + "collaborators": 0, + "billing_email": "kk@kohsuke.org", + "default_repository_permission": "none", + "members_can_create_repositories": false, + "two_factor_requirement_enabled": false, + "plan": { + "name": "free", + "space": 976562499, + "private_repos": 0, + "filled_seats": 12, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org_members-80be661d-6679-43df-9ced-eb3b78827280.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org_members-80be661d-6679-43df-9ced-eb3b78827280.json new file mode 100644 index 0000000000..c8fc2f66f7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org_members-80be661d-6679-43df-9ced-eb3b78827280.json @@ -0,0 +1,242 @@ +[ + { + "login": "alexanderrtaylor", + "id": 852179, + "node_id": "MDQ6VXNlcjg1MjE3OQ==", + "avatar_url": "https://avatars0.githubusercontent.com/u/852179?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/alexanderrtaylor", + "html_url": "https://github.com/alexanderrtaylor", + "followers_url": "https://api.github.com/users/alexanderrtaylor/followers", + "following_url": "https://api.github.com/users/alexanderrtaylor/following{/other_user}", + "gists_url": "https://api.github.com/users/alexanderrtaylor/gists{/gist_id}", + "starred_url": "https://api.github.com/users/alexanderrtaylor/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/alexanderrtaylor/subscriptions", + "organizations_url": "https://api.github.com/users/alexanderrtaylor/orgs", + "repos_url": "https://api.github.com/users/alexanderrtaylor/repos", + "events_url": "https://api.github.com/users/alexanderrtaylor/events{/privacy}", + "received_events_url": "https://api.github.com/users/alexanderrtaylor/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "asthinasthi", + "id": 4577101, + "node_id": "MDQ6VXNlcjQ1NzcxMDE=", + "avatar_url": "https://avatars1.githubusercontent.com/u/4577101?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/asthinasthi", + "html_url": "https://github.com/asthinasthi", + "followers_url": "https://api.github.com/users/asthinasthi/followers", + "following_url": "https://api.github.com/users/asthinasthi/following{/other_user}", + "gists_url": "https://api.github.com/users/asthinasthi/gists{/gist_id}", + "starred_url": "https://api.github.com/users/asthinasthi/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/asthinasthi/subscriptions", + "organizations_url": "https://api.github.com/users/asthinasthi/orgs", + "repos_url": "https://api.github.com/users/asthinasthi/repos", + "events_url": "https://api.github.com/users/asthinasthi/events{/privacy}", + "received_events_url": "https://api.github.com/users/asthinasthi/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.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 + }, + { + "login": "farmdawgnation", + "id": 620189, + "node_id": "MDQ6VXNlcjYyMDE4OQ==", + "avatar_url": "https://avatars2.githubusercontent.com/u/620189?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/farmdawgnation", + "html_url": "https://github.com/farmdawgnation", + "followers_url": "https://api.github.com/users/farmdawgnation/followers", + "following_url": "https://api.github.com/users/farmdawgnation/following{/other_user}", + "gists_url": "https://api.github.com/users/farmdawgnation/gists{/gist_id}", + "starred_url": "https://api.github.com/users/farmdawgnation/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/farmdawgnation/subscriptions", + "organizations_url": "https://api.github.com/users/farmdawgnation/orgs", + "repos_url": "https://api.github.com/users/farmdawgnation/repos", + "events_url": "https://api.github.com/users/farmdawgnation/events{/privacy}", + "received_events_url": "https://api.github.com/users/farmdawgnation/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "halkeye", + "id": 110087, + "node_id": "MDQ6VXNlcjExMDA4Nw==", + "avatar_url": "https://avatars3.githubusercontent.com/u/110087?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/halkeye", + "html_url": "https://github.com/halkeye", + "followers_url": "https://api.github.com/users/halkeye/followers", + "following_url": "https://api.github.com/users/halkeye/following{/other_user}", + "gists_url": "https://api.github.com/users/halkeye/gists{/gist_id}", + "starred_url": "https://api.github.com/users/halkeye/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/halkeye/subscriptions", + "organizations_url": "https://api.github.com/users/halkeye/orgs", + "repos_url": "https://api.github.com/users/halkeye/repos", + "events_url": "https://api.github.com/users/halkeye/events{/privacy}", + "received_events_url": "https://api.github.com/users/halkeye/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "jberglund-BSFT", + "id": 19560713, + "node_id": "MDQ6VXNlcjE5NTYwNzEz", + "avatar_url": "https://avatars3.githubusercontent.com/u/19560713?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jberglund-BSFT", + "html_url": "https://github.com/jberglund-BSFT", + "followers_url": "https://api.github.com/users/jberglund-BSFT/followers", + "following_url": "https://api.github.com/users/jberglund-BSFT/following{/other_user}", + "gists_url": "https://api.github.com/users/jberglund-BSFT/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jberglund-BSFT/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jberglund-BSFT/subscriptions", + "organizations_url": "https://api.github.com/users/jberglund-BSFT/orgs", + "repos_url": "https://api.github.com/users/jberglund-BSFT/repos", + "events_url": "https://api.github.com/users/jberglund-BSFT/events{/privacy}", + "received_events_url": "https://api.github.com/users/jberglund-BSFT/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "kohsuke", + "id": 50003, + "node_id": "MDQ6VXNlcjUwMDAz", + "avatar_url": "https://avatars1.githubusercontent.com/u/50003?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke", + "html_url": "https://github.com/kohsuke", + "followers_url": "https://api.github.com/users/kohsuke/followers", + "following_url": "https://api.github.com/users/kohsuke/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke/orgs", + "repos_url": "https://api.github.com/users/kohsuke/repos", + "events_url": "https://api.github.com/users/kohsuke/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "kohsuke2", + "id": 1329242, + "node_id": "MDQ6VXNlcjEzMjkyNDI=", + "avatar_url": "https://avatars2.githubusercontent.com/u/1329242?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke2", + "html_url": "https://github.com/kohsuke2", + "followers_url": "https://api.github.com/users/kohsuke2/followers", + "following_url": "https://api.github.com/users/kohsuke2/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke2/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke2/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke2/orgs", + "repos_url": "https://api.github.com/users/kohsuke2/repos", + "events_url": "https://api.github.com/users/kohsuke2/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke2/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "martinvanzijl", + "id": 24422213, + "node_id": "MDQ6VXNlcjI0NDIyMjEz", + "avatar_url": "https://avatars0.githubusercontent.com/u/24422213?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/martinvanzijl", + "html_url": "https://github.com/martinvanzijl", + "followers_url": "https://api.github.com/users/martinvanzijl/followers", + "following_url": "https://api.github.com/users/martinvanzijl/following{/other_user}", + "gists_url": "https://api.github.com/users/martinvanzijl/gists{/gist_id}", + "starred_url": "https://api.github.com/users/martinvanzijl/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/martinvanzijl/subscriptions", + "organizations_url": "https://api.github.com/users/martinvanzijl/orgs", + "repos_url": "https://api.github.com/users/martinvanzijl/repos", + "events_url": "https://api.github.com/users/martinvanzijl/events{/privacy}", + "received_events_url": "https://api.github.com/users/martinvanzijl/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "PauloMigAlmeida", + "id": 1011868, + "node_id": "MDQ6VXNlcjEwMTE4Njg=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1011868?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/PauloMigAlmeida", + "html_url": "https://github.com/PauloMigAlmeida", + "followers_url": "https://api.github.com/users/PauloMigAlmeida/followers", + "following_url": "https://api.github.com/users/PauloMigAlmeida/following{/other_user}", + "gists_url": "https://api.github.com/users/PauloMigAlmeida/gists{/gist_id}", + "starred_url": "https://api.github.com/users/PauloMigAlmeida/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/PauloMigAlmeida/subscriptions", + "organizations_url": "https://api.github.com/users/PauloMigAlmeida/orgs", + "repos_url": "https://api.github.com/users/PauloMigAlmeida/repos", + "events_url": "https://api.github.com/users/PauloMigAlmeida/events{/privacy}", + "received_events_url": "https://api.github.com/users/PauloMigAlmeida/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "Sage-Pierce", + "id": 5396306, + "node_id": "MDQ6VXNlcjUzOTYzMDY=", + "avatar_url": "https://avatars3.githubusercontent.com/u/5396306?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Sage-Pierce", + "html_url": "https://github.com/Sage-Pierce", + "followers_url": "https://api.github.com/users/Sage-Pierce/followers", + "following_url": "https://api.github.com/users/Sage-Pierce/following{/other_user}", + "gists_url": "https://api.github.com/users/Sage-Pierce/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Sage-Pierce/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Sage-Pierce/subscriptions", + "organizations_url": "https://api.github.com/users/Sage-Pierce/orgs", + "repos_url": "https://api.github.com/users/Sage-Pierce/repos", + "events_url": "https://api.github.com/users/Sage-Pierce/events{/privacy}", + "received_events_url": "https://api.github.com/users/Sage-Pierce/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "timja", + "id": 21194782, + "node_id": "MDQ6VXNlcjIxMTk0Nzgy", + "avatar_url": "https://avatars3.githubusercontent.com/u/21194782?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/timja", + "html_url": "https://github.com/timja", + "followers_url": "https://api.github.com/users/timja/followers", + "following_url": "https://api.github.com/users/timja/following{/other_user}", + "gists_url": "https://api.github.com/users/timja/gists{/gist_id}", + "starred_url": "https://api.github.com/users/timja/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/timja/subscriptions", + "organizations_url": "https://api.github.com/users/timja/orgs", + "repos_url": "https://api.github.com/users/timja/repos", + "events_url": "https://api.github.com/users/timja/events{/privacy}", + "received_events_url": "https://api.github.com/users/timja/received_events", + "type": "User", + "site_admin": false + } +] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org_members-e0db340d-7d23-488e-9858-6e71ed5a4c84.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org_members-e0db340d-7d23-488e-9858-6e71ed5a4c84.json deleted file mode 100644 index 5fb4db14e7..0000000000 --- a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/orgs_github-api-test-org_members-e0db340d-7d23-488e-9858-6e71ed5a4c84.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "login": "bitwiseman", - "id": 1958953, - "node_id": "MDQ6VXNlcjE5NTg5NTM=", - "avatar_url": "https://avatars3.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 - }, - { - "login": "kohsuke2", - "id": 1329242, - "node_id": "MDQ6VXNlcjEzMjkyNDI=", - "avatar_url": "https://avatars2.githubusercontent.com/u/1329242?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/kohsuke2", - "html_url": "https://github.com/kohsuke2", - "followers_url": "https://api.github.com/users/kohsuke2/followers", - "following_url": "https://api.github.com/users/kohsuke2/following{/other_user}", - "gists_url": "https://api.github.com/users/kohsuke2/gists{/gist_id}", - "starred_url": "https://api.github.com/users/kohsuke2/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/kohsuke2/subscriptions", - "organizations_url": "https://api.github.com/users/kohsuke2/orgs", - "repos_url": "https://api.github.com/users/kohsuke2/repos", - "events_url": "https://api.github.com/users/kohsuke2/events{/privacy}", - "received_events_url": "https://api.github.com/users/kohsuke2/received_events", - "type": "User", - "site_admin": false - } -] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/user-7e6e7d53-a5ae-46b0-afc0-a73258da075d.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/user-7e6e7d53-a5ae-46b0-afc0-a73258da075d.json deleted file mode 100644 index ee0bf1e3a3..0000000000 --- a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/user-7e6e7d53-a5ae-46b0-afc0-a73258da075d.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "login": "asthinasthi", - "id": 4577101, - "node_id": "MDQ6VXNlcjQ1NzcxMDE=", - "avatar_url": "https://avatars1.githubusercontent.com/u/4577101?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/asthinasthi", - "html_url": "https://github.com/asthinasthi", - "followers_url": "https://api.github.com/users/asthinasthi/followers", - "following_url": "https://api.github.com/users/asthinasthi/following{/other_user}", - "gists_url": "https://api.github.com/users/asthinasthi/gists{/gist_id}", - "starred_url": "https://api.github.com/users/asthinasthi/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/asthinasthi/subscriptions", - "organizations_url": "https://api.github.com/users/asthinasthi/orgs", - "repos_url": "https://api.github.com/users/asthinasthi/repos", - "events_url": "https://api.github.com/users/asthinasthi/events{/privacy}", - "received_events_url": "https://api.github.com/users/asthinasthi/received_events", - "type": "User", - "site_admin": false, - "name": "Anirudh Mathad", - "company": "Adobe", - "blog": "", - "location": "San Jose", - "email": "anirudh.mathad@gmail.com", - "hireable": null, - "bio": "Backend Engineer", - "public_repos": 43, - "public_gists": 1, - "followers": 12, - "following": 35, - "created_at": "2013-05-31T05:50:17Z", - "updated_at": "2019-11-19T18:23:21Z", - "private_gists": 3, - "total_private_repos": 1, - "owned_private_repos": 1, - "disk_usage": 122519, - "collaborators": 0, - "two_factor_authentication": false, - "plan": { - "name": "free", - "space": 976562499, - "collaborators": 0, - "private_repos": 10000 - } -} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/user-a3604d73-d76d-4f3e-8f7f-cecee94c5cef.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/user-a3604d73-d76d-4f3e-8f7f-cecee94c5cef.json new file mode 100644 index 0000000000..750413948a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/__files/user-a3604d73-d76d-4f3e-8f7f-cecee94c5cef.json @@ -0,0 +1,45 @@ +{ + "login": "Sage-Pierce", + "id": 5396306, + "node_id": "MDQ6VXNlcjUzOTYzMDY=", + "avatar_url": "https://avatars3.githubusercontent.com/u/5396306?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Sage-Pierce", + "html_url": "https://github.com/Sage-Pierce", + "followers_url": "https://api.github.com/users/Sage-Pierce/followers", + "following_url": "https://api.github.com/users/Sage-Pierce/following{/other_user}", + "gists_url": "https://api.github.com/users/Sage-Pierce/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Sage-Pierce/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Sage-Pierce/subscriptions", + "organizations_url": "https://api.github.com/users/Sage-Pierce/orgs", + "repos_url": "https://api.github.com/users/Sage-Pierce/repos", + "events_url": "https://api.github.com/users/Sage-Pierce/events{/privacy}", + "received_events_url": "https://api.github.com/users/Sage-Pierce/received_events", + "type": "User", + "site_admin": false, + "name": "Sage Pierce", + "company": "@Vrbo @ExpediaGroup", + "blog": "", + "location": null, + "email": "sapierce@vrbo.com", + "hireable": true, + "bio": "Software engineer with a Masters of Science in Electrical and Computer Engineering out of The University of Texas at Austin.", + "public_repos": 9, + "public_gists": 0, + "followers": 4, + "following": 0, + "created_at": "2013-09-06T02:22:48Z", + "updated_at": "2020-02-18T13:29:56Z", + "private_gists": 0, + "total_private_repos": 0, + "owned_private_repos": 0, + "disk_usage": 1816, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org-2-6682f5.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org-2-6682f5.json new file mode 100644 index 0000000000..a43e01d143 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org-2-6682f5.json @@ -0,0 +1,48 @@ +{ + "id": "6682f58b-c93b-4525-9e99-485e631aaaab", + "name": "orgs_github-api-test-org", + "request": { + "url": "/orgs/github-api-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_github-api-test-org-6682f58b-c93b-4525-9e99-485e631aaaab.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:29:12 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4991", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"712644daa44df3089a27d6ef60979929\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E7D4:4A52:336FA3:797A80:5E552F38" + } + }, + "uuid": "6682f58b-c93b-4525-9e99-485e631aaaab", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org_members-2-e0db34.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org_members-3-80be66.json similarity index 68% rename from src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org_members-2-e0db34.json rename to src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org_members-3-80be66.json index d9dd65dad4..e08ca0e3e9 100644 --- a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org_members-2-e0db34.json +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/orgs_github-api-test-org_members-3-80be66.json @@ -1,5 +1,5 @@ { - "id": "e0db340d-7d23-488e-9858-6e71ed5a4c84", + "id": "80be661d-6679-43df-9ced-eb3b78827280", "name": "orgs_github-api-test-org_members", "request": { "url": "/orgs/github-api-test-org/members?role=admin", @@ -12,21 +12,23 @@ }, "response": { "status": 200, - "bodyFileName": "orgs_github-api-test-org_members-e0db340d-7d23-488e-9858-6e71ed5a4c84.json", + "bodyFileName": "orgs_github-api-test-org_members-80be661d-6679-43df-9ced-eb3b78827280.json", "headers": { - "Date": "Mon, 07 Oct 2019 01:45:07 GMT", - "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:29:12 GMT", + "Content-Type": "application/json; charset=utf-8", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4946", - "X-RateLimit-Reset": "1570415536", + "X-RateLimit-Remaining": "4990", + "X-RateLimit-Reset": "1582644474", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", - "Accept-Encoding" + "Accept-Encoding, Accept, X-Requested-With" ], - "ETag": "W/\"28698a13d1d693d64b821be22f3d3455\"", + "ETag": "W/\"631de12e6bc586863218257765331a70\"", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "", "X-GitHub-Media-Type": "unknown, github.v3", "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", "Access-Control-Allow-Origin": "*", @@ -36,10 +38,10 @@ "X-XSS-Protection": "1; mode=block", "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", "Content-Security-Policy": "default-src 'none'", - "X-GitHub-Request-Id": "ED29:68EB:382F58:417BD1:5D9A98A3" + "X-GitHub-Request-Id": "E7D4:4A52:336FBD:797AB0:5E552F38" } }, - "uuid": "e0db340d-7d23-488e-9858-6e71ed5a4c84", + "uuid": "80be661d-6679-43df-9ced-eb3b78827280", "persistent": true, - "insertionIndex": 2 + "insertionIndex": 3 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/user-1-a3604d.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/user-1-a3604d.json new file mode 100644 index 0000000000..11342e3d51 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testListMembersWithRole/mappings/user-1-a3604d.json @@ -0,0 +1,48 @@ +{ + "id": "a3604d73-d76d-4f3e-8f7f-cecee94c5cef", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "user-a3604d73-d76d-4f3e-8f7f-cecee94c5cef.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 25 Feb 2020 14:27:54 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4999", + "X-RateLimit-Reset": "1582644474", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"9adfa44fe91fb698b5fd807d9471afc3\"", + "Last-Modified": "Tue, 18 Feb 2020 13:29:56 GMT", + "X-OAuth-Scopes": "delete_repo, repo, user", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "E686:35E3:5882BF:ABE338:5E552EEA" + } + }, + "uuid": "a3604d73-d76d-4f3e-8f7f-cecee94c5cef", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file