Added test for addCollaborators

Mark old addCollaborators methods depricated
This commit is contained in:
James Vaughn
2020-02-02 22:02:56 -06:00
parent 205e5ab03d
commit d767575f76
14 changed files with 199 additions and 39 deletions

1
.gitignore vendored
View File

@@ -10,3 +10,4 @@ target
dependency-reduced-pom.xml dependency-reduced-pom.xml
.factorypath .factorypath
.vscode/settings.json

View File

@@ -860,6 +860,7 @@ public class GHRepository extends GHObject {
* @throws IOException * @throws IOException
* the io exception * the io exception
*/ */
@Deprecated
public void addCollaborators(GHUser... users) throws IOException { public void addCollaborators(GHUser... users) throws IOException {
addCollaborators(asList(users)); addCollaborators(asList(users));
} }
@@ -872,6 +873,7 @@ public class GHRepository extends GHObject {
* @throws IOException * @throws IOException
* the io exception * the io exception
*/ */
@Deprecated
public void addCollaborators(List<GHUser> users) throws IOException { public void addCollaborators(List<GHUser> users) throws IOException {
modifyCollaborators(users, "PUT"); modifyCollaborators(users, "PUT");
} }

View File

@@ -169,10 +169,9 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
GHPersonSet<GHUser> collabs = repo.getCollaborators(); GHPersonSet<GHUser> collabs = repo.getCollaborators();
GHUser colabUser = collabs.byLogin(user.getLogin()); GHUser colabUser = collabs.byLogin("jimmysombrero");
assertEquals(colabUser.getName(), user.getName()); assertEquals(colabUser.getName(), user.getName());
assertEquals(GHOrganization.Permission.PUSH, repo.getPermission(user.getName()));
} }
@Test @Test

View File

@@ -191,7 +191,7 @@
"deployments_url": "https://api.github.com/repos/github-api/github-api/deployments", "deployments_url": "https://api.github.com/repos/github-api/github-api/deployments",
"created_at": "2010-04-19T04:13:03Z", "created_at": "2010-04-19T04:13:03Z",
"updated_at": "2020-02-01T02:00:03Z", "updated_at": "2020-02-01T02:00:03Z",
"pushed_at": "2020-01-31T21:18:18Z", "pushed_at": "2020-02-02T04:40:57Z",
"git_url": "git://github.com/github-api/github-api.git", "git_url": "git://github.com/github-api/github-api.git",
"ssh_url": "git@github.com:github-api/github-api.git", "ssh_url": "git@github.com:github-api/github-api.git",
"clone_url": "https://github.com/github-api/github-api.git", "clone_url": "https://github.com/github-api/github-api.git",
@@ -291,7 +291,7 @@
"deployments_url": "https://api.github.com/repos/github-api/github-api/deployments", "deployments_url": "https://api.github.com/repos/github-api/github-api/deployments",
"created_at": "2010-04-19T04:13:03Z", "created_at": "2010-04-19T04:13:03Z",
"updated_at": "2020-02-01T02:00:03Z", "updated_at": "2020-02-01T02:00:03Z",
"pushed_at": "2020-01-31T21:18:18Z", "pushed_at": "2020-02-02T04:40:57Z",
"git_url": "git://github.com/github-api/github-api.git", "git_url": "git://github.com/github-api/github-api.git",
"ssh_url": "git@github.com:github-api/github-api.git", "ssh_url": "git@github.com:github-api/github-api.git",
"clone_url": "https://github.com/github-api/github-api.git", "clone_url": "https://github.com/github-api/github-api.git",

View File

@@ -0,0 +1,27 @@
[
{
"login": "jimmysombrero",
"id": 12157727,
"node_id": "MDQ6VXNlcjEyMTU3NzI3",
"avatar_url": "https://avatars3.githubusercontent.com/u/12157727?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/jimmysombrero",
"html_url": "https://github.com/jimmysombrero",
"followers_url": "https://api.github.com/users/jimmysombrero/followers",
"following_url": "https://api.github.com/users/jimmysombrero/following{/other_user}",
"gists_url": "https://api.github.com/users/jimmysombrero/gists{/gist_id}",
"starred_url": "https://api.github.com/users/jimmysombrero/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/jimmysombrero/subscriptions",
"organizations_url": "https://api.github.com/users/jimmysombrero/orgs",
"repos_url": "https://api.github.com/users/jimmysombrero/repos",
"events_url": "https://api.github.com/users/jimmysombrero/events{/privacy}",
"received_events_url": "https://api.github.com/users/jimmysombrero/received_events",
"type": "User",
"site_admin": false,
"permissions": {
"push": true,
"pull": true,
"admin": false
}
}
]

View File

@@ -29,7 +29,7 @@
"followers": 1, "followers": 1,
"following": 0, "following": 0,
"created_at": "2015-04-28T17:47:19Z", "created_at": "2015-04-28T17:47:19Z",
"updated_at": "2020-02-02T04:15:35Z", "updated_at": "2020-02-02T04:43:58Z",
"private_gists": 0, "private_gists": 0,
"total_private_repos": 0, "total_private_repos": 0,
"owned_private_repos": 0, "owned_private_repos": 0,

View File

@@ -0,0 +1,45 @@
{
"login": "jimmysombrero",
"id": 12157727,
"node_id": "MDQ6VXNlcjEyMTU3NzI3",
"avatar_url": "https://avatars3.githubusercontent.com/u/12157727?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/jimmysombrero",
"html_url": "https://github.com/jimmysombrero",
"followers_url": "https://api.github.com/users/jimmysombrero/followers",
"following_url": "https://api.github.com/users/jimmysombrero/following{/other_user}",
"gists_url": "https://api.github.com/users/jimmysombrero/gists{/gist_id}",
"starred_url": "https://api.github.com/users/jimmysombrero/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/jimmysombrero/subscriptions",
"organizations_url": "https://api.github.com/users/jimmysombrero/orgs",
"repos_url": "https://api.github.com/users/jimmysombrero/repos",
"events_url": "https://api.github.com/users/jimmysombrero/events{/privacy}",
"received_events_url": "https://api.github.com/users/jimmysombrero/received_events",
"type": "User",
"site_admin": false,
"name": null,
"company": null,
"blog": "",
"location": null,
"email": null,
"hireable": null,
"bio": null,
"public_repos": 4,
"public_gists": 0,
"followers": 1,
"following": 0,
"created_at": "2015-04-28T17:47:19Z",
"updated_at": "2020-02-02T04:43:58Z",
"private_gists": 0,
"total_private_repos": 0,
"owned_private_repos": 0,
"disk_usage": 19,
"collaborators": 0,
"two_factor_authentication": false,
"plan": {
"name": "free",
"space": 976562499,
"collaborators": 0,
"private_repos": 10000
}
}

View File

@@ -1,5 +1,5 @@
{ {
"id": "355d5cda-5423-49ef-b604-6276fbaba24e", "id": "a3d2b552-58b8-4028-b731-d00420496ca8",
"name": "orgs_github-api-test-org", "name": "orgs_github-api-test-org",
"request": { "request": {
"url": "/orgs/github-api-test-org", "url": "/orgs/github-api-test-org",
@@ -12,14 +12,14 @@
}, },
"response": { "response": {
"status": 200, "status": 200,
"bodyFileName": "orgs_github-api-test-org-355d5cda-5423-49ef-b604-6276fbaba24e.json", "bodyFileName": "orgs_github-api-test-org-a3d2b552-58b8-4028-b731-d00420496ca8.json",
"headers": { "headers": {
"Server": "GitHub.com", "Server": "GitHub.com",
"Date": "Sun, 02 Feb 2020 04:29:45 GMT", "Date": "Sun, 02 Feb 2020 04:59:39 GMT",
"Content-Type": "application/json; charset=utf-8", "Content-Type": "application/json; charset=utf-8",
"Status": "200 OK", "Status": "200 OK",
"X-RateLimit-Limit": "5000", "X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4951", "X-RateLimit-Remaining": "4895",
"X-RateLimit-Reset": "1580620984", "X-RateLimit-Reset": "1580620984",
"Cache-Control": "private, max-age=60, s-maxage=60", "Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP",
@@ -36,10 +36,10 @@
"X-XSS-Protection": "1; mode=block", "X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'", "Content-Security-Policy": "default-src 'none'",
"X-GitHub-Request-Id": "C7DB:0D8E:63D359:C9F18B:5E365038" "X-GitHub-Request-Id": "C903:768E:16C4938:2BA1171:5E36573B"
} }
}, },
"uuid": "355d5cda-5423-49ef-b604-6276fbaba24e", "uuid": "a3d2b552-58b8-4028-b731-d00420496ca8",
"persistent": true, "persistent": true,
"insertionIndex": 2 "insertionIndex": 1
} }

View File

@@ -1,5 +1,5 @@
{ {
"id": "e5504dd6-42ca-4d7f-9d95-f224e5f36a90", "id": "95ce4098-4e40-49f0-8661-0870614d5d78",
"name": "repos_github-api-test-org_github-api", "name": "repos_github-api-test-org_github-api",
"request": { "request": {
"url": "/repos/github-api-test-org/github-api", "url": "/repos/github-api-test-org/github-api",
@@ -12,18 +12,18 @@
}, },
"response": { "response": {
"status": 200, "status": 200,
"bodyFileName": "repos_github-api-test-org_github-api-e5504dd6-42ca-4d7f-9d95-f224e5f36a90.json", "bodyFileName": "repos_github-api-test-org_github-api-95ce4098-4e40-49f0-8661-0870614d5d78.json",
"headers": { "headers": {
"Server": "GitHub.com", "Server": "GitHub.com",
"Date": "Sun, 02 Feb 2020 04:29:45 GMT", "Date": "Sun, 02 Feb 2020 04:59:39 GMT",
"Content-Type": "application/json; charset=utf-8", "Content-Type": "application/json; charset=utf-8",
"Status": "200 OK", "Status": "200 OK",
"X-RateLimit-Limit": "5000", "X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4950", "X-RateLimit-Remaining": "4894",
"X-RateLimit-Reset": "1580620984", "X-RateLimit-Reset": "1580620983",
"Cache-Control": "private, max-age=60, s-maxage=60", "Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP",
"ETag": "W/\"c310cb7abd9a90e105810461c34dd8c6\"", "ETag": "W/\"d61f18a7ccc89231875444b59f56580f\"",
"Last-Modified": "Thu, 16 Jan 2020 21:22:56 GMT", "Last-Modified": "Thu, 16 Jan 2020 21:22:56 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-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": "repo", "X-Accepted-OAuth-Scopes": "repo",
@@ -36,10 +36,10 @@
"X-XSS-Protection": "1; mode=block", "X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'", "Content-Security-Policy": "default-src 'none'",
"X-GitHub-Request-Id": "C7DB:0D8E:63D35D:C9F1A2:5E365039" "X-GitHub-Request-Id": "C903:768E:16C4945:2BA117B:5E36573B"
} }
}, },
"uuid": "e5504dd6-42ca-4d7f-9d95-f224e5f36a90", "uuid": "95ce4098-4e40-49f0-8661-0870614d5d78",
"persistent": true, "persistent": true,
"insertionIndex": 3 "insertionIndex": 2
} }

View File

@@ -0,0 +1,41 @@
{
"id": "ddaa8229-c0ae-4df6-90ed-08425bfe71f2",
"name": "repos_github-api-test-org_github-api_collaborators",
"request": {
"url": "/repos/github-api-test-org/github-api/collaborators",
"method": "GET",
"headers": {
"Accept": {
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
}
}
},
"response": {
"status": "200",
"bodyFileName": "repos_github-apit-test-ort_github-api_get_collaborators-5-ddaa82.json",
"headers": {
"Server": "GitHub.com",
"Date": "Mon, 03 Feb 2020 02:32:07 GMT",
"Content-Type": "application/json; charset=utf-8",
"Status": "200 OK",
"X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4979",
"X-RateLimit-Reset": "1580700723",
"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": "CBB1:43C6:FBCD05:26D0ED5:5E378627"
}
},
"uuid": "ddaa8229-c0ae-4df6-90ed-08425bfe71f2",
"persistent": true,
"insertionIndex": 5
}

View File

@@ -1,5 +1,5 @@
{ {
"id": "1bfe0280-5533-459c-8515-57f70bed0d04", "id": "3d80b19e-05f4-4ad9-a610-5f573abc4363",
"name": "repos_github-api-test-org_github-api_collaborators_jimmysombrero", "name": "repos_github-api-test-org_github-api_collaborators_jimmysombrero",
"request": { "request": {
"url": "/repos/github-api-test-org/github-api/collaborators/jimmysombrero", "url": "/repos/github-api-test-org/github-api/collaborators/jimmysombrero",
@@ -18,16 +18,16 @@
] ]
}, },
"response": { "response": {
"status": 404, "status": 201,
"body": "{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/repos/collaborators/#add-user-as-a-collaborator\"}", "body": "[]",
"headers": { "headers": {
"Server": "GitHub.com", "Server": "GitHub.com",
"Date": "Sun, 02 Feb 2020 04:29:45 GMT", "Date": "Sun, 02 Feb 2020 04:59:39 GMT",
"Content-Type": "application/json; charset=utf-8", "Content-Type": "application/json; charset=utf-8",
"Status": "404 Not Found", "Status": "201 Created",
"X-RateLimit-Limit": "5000", "X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4949", "X-RateLimit-Remaining": "4892",
"X-RateLimit-Reset": "1580620984", "X-RateLimit-Reset": "1580620983",
"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-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-Accepted-OAuth-Scopes": "",
"X-GitHub-Media-Type": "unknown, github.v3", "X-GitHub-Media-Type": "unknown, github.v3",
@@ -39,10 +39,10 @@
"X-XSS-Protection": "1; mode=block", "X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'", "Content-Security-Policy": "default-src 'none'",
"X-GitHub-Request-Id": "C7DB:0D8E:63D367:C9F1B5:5E365039" "X-GitHub-Request-Id": "C903:768E:16C4966:2BA11B0:5E36573B"
} }
}, },
"uuid": "1bfe0280-5533-459c-8515-57f70bed0d04", "uuid": "3d80b19e-05f4-4ad9-a610-5f573abc4363",
"persistent": true, "persistent": true,
"insertionIndex": 4 "insertionIndex": 4
} }

View File

@@ -1,5 +1,5 @@
{ {
"id": "4533e6b8-1725-4450-97b1-895a776d49b7", "id": "f20ea960-c1f4-440c-bdc1-a605956a351a",
"name": "user", "name": "user",
"request": { "request": {
"url": "/user", "url": "/user",
@@ -12,19 +12,19 @@
}, },
"response": { "response": {
"status": 200, "status": 200,
"bodyFileName": "user-4533e6b8-1725-4450-97b1-895a776d49b7.json", "bodyFileName": "user-f20ea960-c1f4-440c-bdc1-a605956a351a.json",
"headers": { "headers": {
"Server": "GitHub.com", "Server": "GitHub.com",
"Date": "Sun, 02 Feb 2020 04:29:44 GMT", "Date": "Sun, 02 Feb 2020 04:59:39 GMT",
"Content-Type": "application/json; charset=utf-8", "Content-Type": "application/json; charset=utf-8",
"Status": "200 OK", "Status": "200 OK",
"X-RateLimit-Limit": "5000", "X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4953", "X-RateLimit-Remaining": "4893",
"X-RateLimit-Reset": "1580620983", "X-RateLimit-Reset": "1580620983",
"Cache-Control": "private, max-age=60, s-maxage=60", "Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP",
"ETag": "W/\"275d33915a65ed3fa77d5fed34147440\"", "ETag": "W/\"7a0206b47e995649c88218afeb2266a6\"",
"Last-Modified": "Sun, 02 Feb 2020 04:15:35 GMT", "Last-Modified": "Sun, 02 Feb 2020 04:43:58 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-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-Accepted-OAuth-Scopes": "",
"X-GitHub-Media-Type": "unknown, github.v3", "X-GitHub-Media-Type": "unknown, github.v3",
@@ -36,10 +36,10 @@
"X-XSS-Protection": "1; mode=block", "X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'", "Content-Security-Policy": "default-src 'none'",
"X-GitHub-Request-Id": "C7DB:0D8E:63D34F:C9F17E:5E365038" "X-GitHub-Request-Id": "C903:768E:16C495A:2BA119D:5E36573B"
} }
}, },
"uuid": "4533e6b8-1725-4450-97b1-895a776d49b7", "uuid": "f20ea960-c1f4-440c-bdc1-a605956a351a",
"persistent": true, "persistent": true,
"insertionIndex": 1 "insertionIndex": 3
} }

View File

@@ -0,0 +1,45 @@
{
"id": "6685376c-451b-486d-88cd-502af9a7c5d1",
"name": "users_jimmysombrero",
"request": {
"url": "/users/jimmysombrero",
"method": "GET",
"headers": {
"Accept": {
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
}
}
},
"response": {
"status": 200,
"bodyFileName": "users_jimmysombrero-6685376c-451b-486d-88cd-502af9a7c5d1.json",
"headers": {
"Server": "GitHub.com",
"Date": "Mon, 03 Feb 2020 03:50:14 GMT",
"Content-Type": "application/json; charset=utf-8",
"Status": "200 OK",
"X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4907",
"X-RateLimit-Reset": "1580704799",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP",
"ETag": "W/\"7a0206b47e995649c88218afeb2266a6\"",
"Last-Modified": "Sun, 02 Feb 2020 04:43:58 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": "CDFE:768D:1021273:26DC788:5E379876"
}
},
"uuid": "6685376c-451b-486d-88cd-502af9a7c5d1",
"persistent": true,
"insertionIndex": 6
}