Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c3869be

Browse filesBrowse files
author
Rob Rodrigues
committed
Reverted changes which added filter unnecessarily, cleanup, add test cache, enable test
1 parent 17af78f commit c3869be
Copy full SHA for c3869be
Expand file treeCollapse file tree

17 files changed

+1264
-16
lines changed

‎CONTRIBUTING.md

Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ Example:
1414

1515
This the default behavior.
1616

17+
Example for a single test case:
18+
19+
`mvn install -Dtest=WireMockStatusReporterTest#user_whenProxying_AuthCorrectlyConfigured`
20+
1721

1822
### Setting up credential
1923

‎src/main/java/org/kohsuke/github/GHRepository.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHRepository.java
+17-9Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ public enum CollaboratorAffiliation {
834834
*/
835835
@WithBridgeMethods(Set.class)
836836
public GHPersonSet<GHUser> getCollaborators() throws IOException {
837-
return new GHPersonSet<GHUser>(listCollaborators(CollaboratorAffiliation.ALL).toList());
837+
return new GHPersonSet<GHUser>(listCollaborators().toList());
838838
}
839839

840840
/**
@@ -845,7 +845,7 @@ public GHPersonSet<GHUser> getCollaborators() throws IOException {
845845
* the io exception
846846
*/
847847
public PagedIterable<GHUser> listCollaborators() throws IOException {
848-
return listCollaborators(CollaboratorAffiliation.ALL);
848+
return listUsers("collaborators");
849849
}
850850

851851
/**
@@ -899,7 +899,15 @@ public boolean hasAssignee(GHUser u) throws IOException {
899899
* the io exception
900900
*/
901901
public Set<String> getCollaboratorNames() throws IOException {
902-
return getCollaboratorNames(CollaboratorAffiliation.ALL);
902+
Set<String> r = new HashSet<>();
903+
// no initializer - we just want to the logins
904+
PagedIterable<GHUser> users = root.createRequest()
905+
.withUrlPath(getApiTailUrl("collaborators"))
906+
.toIterable(GHUser[].class, null);
907+
for (GHUser u : users.toArray()) {
908+
r.add(u.login);
909+
}
910+
return r;
903911
}
904912

905913
/**
@@ -2129,15 +2137,15 @@ public PagedIterable<GHStargazer> listStargazers2() {
21292137
}
21302138

21312139
private PagedIterable<GHUser> listUsers(final String suffix) {
2132-
Map<String, Object> defaultArgs = Collections.EMPTY_MAP;
2133-
return listUsers(suffix, defaultArgs);
2140+
return listUsers(root.createRequest(), suffix);
21342141
}
21352142

21362143
private PagedIterable<GHUser> listUsers(final String suffix, Map<String, Object> args) {
2137-
return root.createRequest()
2138-
.withUrlPath(getApiTailUrl(suffix))
2139-
.with(args)
2140-
.toIterable(GHUser[].class, item -> item.wrapUp(root));
2144+
return listUsers(root.createRequest().with(args), suffix);
2145+
}
2146+
2147+
private PagedIterable<GHUser> listUsers(Requester requester, final String suffix) {
2148+
return requester.withUrlPath(getApiTailUrl(suffix)).toIterable(GHUser[].class, item -> item.wrapUp(root));
21412149
}
21422150

21432151
/**

‎src/test/java/org/kohsuke/github/GHRepositoryTest.java

Copy file name to clipboardExpand all lines: src/test/java/org/kohsuke/github/GHRepositoryTest.java
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.fasterxml.jackson.databind.JsonMappingException;
44
import org.apache.commons.io.IOUtils;
5-
import org.junit.Ignore;
65
import org.junit.Test;
76

87
import java.io.FileNotFoundException;
@@ -647,13 +646,12 @@ public void listCollaborators() throws Exception {
647646
}
648647

649648
@Test
650-
@Ignore("Data not cached")
651649
public void listCollaboratorsFiltered() throws Exception {
652650
GHRepository repo = getRepository();
653651
List<GHUser> allCollaborators = repo.listCollaborators().toList();
654652
List<GHUser> filteredCollaborators = repo.listCollaborators(GHRepository.CollaboratorAffiliation.OUTSIDE)
655653
.toList();
656-
assertThat(allCollaborators.size(), greaterThan(filteredCollaborators.size()));
654+
assertThat(filteredCollaborators.size(), lessThan(allCollaborators.size()));
657655
}
658656

659657
@Test

‎src/test/resources/org/kohsuke/github/AppTest/wiremock/testMembership/mappings/repos_hub4j-test-org_jenkins_collaborators-4.json

Copy file name to clipboardExpand all lines: src/test/resources/org/kohsuke/github/AppTest/wiremock/testMembership/mappings/repos_hub4j-test-org_jenkins_collaborators-4.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "bce97482-6a11-44e5-a112-29230b142636",
33
"name": "repos_hub4j-test-org_jenkins_collaborators",
44
"request": {
5-
"url": "/repos/hub4j-test-org/jenkins/collaborators?affiliation=all",
5+
"url": "/repos/hub4j-test-org/jenkins/collaborators",
66
"method": "GET",
77
"headers": {
88
"Accept": {

‎src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/addCollaborators/mappings/repos_hub4j-test-org_github-api_collaborators-5-ddaa82.json

Copy file name to clipboardExpand all lines: src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/addCollaborators/mappings/repos_hub4j-test-org_github-api_collaborators-5-ddaa82.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "ddaa8229-c0ae-4df6-90ed-08425bfe71f2",
33
"name": "repos_hub4j-test-org_github-api_collaborators",
44
"request": {
5-
"url": "/repos/hub4j-test-org/github-api/collaborators?affiliation=all",
5+
"url": "/repos/hub4j-test-org/github-api/collaborators",
66
"method": "GET",
77
"headers": {
88
"Accept": {

‎src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCollaborators/mappings/repos_hub4j-test-org_github-api_collaborators-4.json

Copy file name to clipboardExpand all lines: src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getCollaborators/mappings/repos_hub4j-test-org_github-api_collaborators-4.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "2b8badfb-52b8-4304-a9a5-66b80274e93d",
33
"name": "repos_hub4j-test-org_github-api_collaborators",
44
"request": {
5-
"url": "/repos/hub4j-test-org/github-api/collaborators?affiliation=all",
5+
"url": "/repos/hub4j-test-org/github-api/collaborators",
66
"method": "GET",
77
"headers": {
88
"Accept": {

‎src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listCollaborators/mappings/repos_hub4j-test-org_github-api_collaborators-4.json

Copy file name to clipboardExpand all lines: src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/listCollaborators/mappings/repos_hub4j-test-org_github-api_collaborators-4.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "b0680d17-cd3b-4ec0-a857-d352c7167e94",
33
"name": "repos_hub4j-test-org_github-api_collaborators",
44
"request": {
5-
"url": "/repos/hub4j-test-org/github-api/collaborators?affiliation=all",
5+
"url": "/repos/hub4j-test-org/github-api/collaborators",
66
"method": "GET",
77
"headers": {
88
"Accept": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"login": "hub4j-test-org",
3+
"id": 7544739,
4+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
5+
"url": "https://api.github.com/orgs/hub4j-test-org",
6+
"repos_url": "https://api.github.com/orgs/hub4j-test-org/repos",
7+
"events_url": "https://api.github.com/orgs/hub4j-test-org/events",
8+
"hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks",
9+
"issues_url": "https://api.github.com/orgs/hub4j-test-org/issues",
10+
"members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}",
11+
"public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}",
12+
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
13+
"description": "Hub4j Test Org Description (this could be null or blank too)",
14+
"name": "Hub4j Test Org Name (this could be null or blank too)",
15+
"company": null,
16+
"blog": "https://hub4j.url.io/could/be/null",
17+
"location": "Hub4j Test Org Location (this could be null or blank too)",
18+
"email": "hub4jtestorgemail@could.be.null.com",
19+
"twitter_username": null,
20+
"is_verified": false,
21+
"has_organization_projects": true,
22+
"has_repository_projects": true,
23+
"public_repos": 13,
24+
"public_gists": 0,
25+
"followers": 0,
26+
"following": 0,
27+
"html_url": "https://github.com/hub4j-test-org",
28+
"created_at": "2014-05-10T19:39:11Z",
29+
"updated_at": "2020-06-04T05:56:10Z",
30+
"type": "Organization",
31+
"total_private_repos": 2,
32+
"owned_private_repos": 2,
33+
"private_gists": 0,
34+
"disk_usage": 152,
35+
"collaborators": 0,
36+
"billing_email": "kk@kohsuke.org",
37+
"default_repository_permission": "none",
38+
"members_can_create_repositories": false,
39+
"two_factor_requirement_enabled": false,
40+
"members_can_create_pages": true,
41+
"plan": {
42+
"name": "free",
43+
"space": 976562499,
44+
"private_repos": 10000,
45+
"filled_seats": 21,
46+
"seats": 3
47+
}
48+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.