-
Notifications
You must be signed in to change notification settings - Fork 741
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #851 from MarcosCela/fix/ghteambuilder-accept-long
GHTeamBuilder#parentTeamId now accepts a long instead of an int
- Loading branch information
Showing
8 changed files
with
314 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.kohsuke.github; | ||
|
||
import org.junit.Test; | ||
|
||
import java.io.IOException; | ||
|
||
public class GHTeamBuilderTest extends AbstractGitHubWireMockTest { | ||
|
||
@Test | ||
public void testCreateChildTeam() throws IOException { | ||
String parentTeamSlug = "dummy-team"; | ||
String childTeamSlug = "dummy-team-child"; | ||
String description = "description"; | ||
|
||
// Get the parent team | ||
GHTeam parentTeam = gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamBySlug(parentTeamSlug); | ||
|
||
// Create a child team, using the parent team identifier | ||
GHTeam childTeam = gitHub.getOrganization(GITHUB_API_TEST_ORG) | ||
.createTeam(childTeamSlug) | ||
.description(description) | ||
.privacy(GHTeam.Privacy.CLOSED) | ||
.parentTeamId(parentTeam.getId()) | ||
.create(); | ||
|
||
assertEquals(description, childTeam.getDescription()); | ||
assertEquals(childTeamSlug, childTeam.getName()); | ||
assertEquals(childTeamSlug, childTeam.getSlug()); | ||
assertEquals(GHTeam.Privacy.CLOSED, childTeam.getPrivacy()); | ||
|
||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
.../github/GHTeamBuilderTest/wiremock/testCreateChildTeam/__files/orgs_hub4j-test-org-2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"login": "hub4j-test-org", | ||
"id": 7544739, | ||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", | ||
"url": "https://api.github.com/orgs/hub4j-test-org", | ||
"repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", | ||
"events_url": "https://api.github.com/orgs/hub4j-test-org/events", | ||
"hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", | ||
"issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", | ||
"members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", | ||
"public_members_url": "https://api.github.com/orgs/hub4j-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": 26, | ||
"public_gists": 0, | ||
"followers": 0, | ||
"following": 0, | ||
"html_url": "https://github.com/hub4j-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": "[email protected]", | ||
"default_repository_permission": "none", | ||
"members_can_create_repositories": false, | ||
"two_factor_requirement_enabled": false, | ||
"plan": { | ||
"name": "free", | ||
"space": 976562499, | ||
"private_repos": 0, | ||
"filled_seats": 13, | ||
"seats": 0 | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...b/GHTeamBuilderTest/wiremock/testCreateChildTeam/__files/orgs_hub4j-test-org_teams-4.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"name": "dummy-team-child", | ||
"id": 3906416, | ||
"node_id": "MDQ6VGVhbTM5MDE2NjQ=", | ||
"slug": "dummy-team-child", | ||
"description": "description", | ||
"privacy": "closed", | ||
"url": "https://api.github.com/organizations/7544739/team/3906416", | ||
"html_url": "https://github.com/orgs/hub4j-test-org/teams/remove-me-team", | ||
"members_url": "https://api.github.com/organizations/7544739/team/3906416/members{/member}", | ||
"repositories_url": "https://api.github.com/organizations/7544739/team/3906416/repos", | ||
"permission": "admin", | ||
"parent": { | ||
"name": "dummy-team", | ||
"id": 3451996, | ||
"node_id": "MDQ6VGVhbTM0NTE5OTY=", | ||
"slug": "dummy-team", | ||
"description": "Updated by API TestModified", | ||
"privacy": "secret", | ||
"url": "https://api.github.com/organizations/7544739/team/3451996", | ||
"html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team", | ||
"members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", | ||
"repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", | ||
"permission": "pull" | ||
}, | ||
"created_at": "2020-06-18T08:11:37Z", | ||
"updated_at": "2020-06-18T08:11:37Z", | ||
"members_count": 1, | ||
"repos_count": 0, | ||
"organization": { | ||
"login": "hub4j-test-org", | ||
"id": 7544739, | ||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", | ||
"url": "https://api.github.com/orgs/hub4j-test-org", | ||
"repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", | ||
"events_url": "https://api.github.com/orgs/hub4j-test-org/events", | ||
"hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", | ||
"issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", | ||
"members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", | ||
"public_members_url": "https://api.github.com/orgs/hub4j-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": 26, | ||
"public_gists": 0, | ||
"followers": 0, | ||
"following": 0, | ||
"html_url": "https://github.com/hub4j-test-org", | ||
"created_at": "2014-05-10T19:39:11Z", | ||
"updated_at": "2015-04-20T00:42:30Z", | ||
"type": "Organization" | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...lderTest/wiremock/testCreateChildTeam/__files/orgs_hub4j-test-org_teams_dummy-team-3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"name": "dummy-team", | ||
"id": 3451996, | ||
"node_id": "MDQ6VGVhbTM0NTE5OTY=", | ||
"slug": "dummy-team", | ||
"description": "Updated by API TestModified", | ||
"privacy": "secret", | ||
"url": "https://api.github.com/organizations/7544739/team/3451996", | ||
"html_url": "https://github.com/orgs/hub4j-test-org/teams/dummy-team", | ||
"members_url": "https://api.github.com/organizations/7544739/team/3451996/members{/member}", | ||
"repositories_url": "https://api.github.com/organizations/7544739/team/3451996/repos", | ||
"permission": "pull", | ||
"created_at": "2019-10-03T21:46:12Z", | ||
"updated_at": "2020-03-17T09:06:57Z", | ||
"members_count": 1, | ||
"repos_count": 1, | ||
"organization": { | ||
"login": "hub4j-test-org", | ||
"id": 7544739, | ||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", | ||
"url": "https://api.github.com/orgs/hub4j-test-org", | ||
"repos_url": "https://api.github.com/orgs/hub4j-test-org/repos", | ||
"events_url": "https://api.github.com/orgs/hub4j-test-org/events", | ||
"hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks", | ||
"issues_url": "https://api.github.com/orgs/hub4j-test-org/issues", | ||
"members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}", | ||
"public_members_url": "https://api.github.com/orgs/hub4j-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": 26, | ||
"public_gists": 0, | ||
"followers": 0, | ||
"following": 0, | ||
"html_url": "https://github.com/hub4j-test-org", | ||
"created_at": "2014-05-10T19:39:11Z", | ||
"updated_at": "2015-04-20T00:42:30Z", | ||
"type": "Organization" | ||
}, | ||
"parent": null | ||
} |
46 changes: 46 additions & 0 deletions
46
...github/GHTeamBuilderTest/wiremock/testCreateChildTeam/mappings/orgs_hub4j-test-org-2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"id": "3211dfd0-5228-4cdc-aea3-ab67437f3fd4", | ||
"name": "orgs_hub4j-test-org", | ||
"request": { | ||
"url": "/orgs/hub4j-test-org", | ||
"method": "GET", | ||
"headers": { | ||
"Accept": { | ||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" | ||
} | ||
} | ||
}, | ||
"response": { | ||
"status": 200, | ||
"bodyFileName": "orgs_hub4j-test-org-2.json", | ||
"headers": { | ||
"Date": "Tue, 17 Mar 2020 09:12:21 GMT", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Server": "GitHub.com", | ||
"Status": "200 OK", | ||
"X-RateLimit-Limit": "5000", | ||
"X-RateLimit-Remaining": "4445", | ||
"X-RateLimit-Reset": "1584436621", | ||
"Cache-Control": "private, max-age=60, s-maxage=60", | ||
"Vary": [ | ||
"Accept, Authorization, Cookie, X-GitHub-OTP", | ||
"Accept-Encoding, Accept, X-Requested-With" | ||
], | ||
"ETag": "W/\"9d4203e09aeffc9b5325c2a5355275b5\"", | ||
"Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", | ||
"X-OAuth-Scopes": "admin:org, admin:public_key, admin:repo_hook, notifications, repo, user", | ||
"X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", | ||
"X-GitHub-Media-Type": "unknown, github.v3", | ||
"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": "F8C7:46E1:A3A21:151ED4:5E709474" | ||
} | ||
}, | ||
"uuid": "3211dfd0-5228-4cdc-aea3-ab67437f3fd4", | ||
"persistent": true, | ||
"insertionIndex": 2 | ||
} |
47 changes: 47 additions & 0 deletions
47
.../GHTeamBuilderTest/wiremock/testCreateChildTeam/mappings/orgs_hub4j-test-org_teams-4.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"id": "96dd9244-d773-4393-b9da-27ac4fef9643", | ||
"name": "orgs_hub4j-test-org_teams", | ||
"request": { | ||
"url": "/orgs/hub4j-test-org/teams", | ||
"method": "POST", | ||
"headers": { | ||
"Accept": { | ||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" | ||
} | ||
}, | ||
"bodyPatterns": [ | ||
{ | ||
"equalToJson": "{\n \"parent_team_id\": 3451996,\n \"name\": \"dummy-team-child\",\n \"description\": \"description\",\n \"privacy\": \"closed\"\n}", | ||
"ignoreArrayOrder": true, | ||
"ignoreExtraElements": false | ||
} | ||
] | ||
}, | ||
"response": { | ||
"status": 201, | ||
"bodyFileName": "orgs_hub4j-test-org_teams-4.json", | ||
"headers": { | ||
"Date": "Thu, 18 Jun 2020 07:59:20 GMT", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Server": "GitHub.com", | ||
"Status": "201 Created", | ||
"X-RateLimit-Limit": "5000", | ||
"X-RateLimit-Remaining": "4000", | ||
"X-RateLimit-Reset": "1592470759", | ||
"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": "admin:org, repo", | ||
"X-GitHub-Media-Type": "unknown, github.v3", | ||
"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'", | ||
"Vary": "Accept-Encoding, Accept, X-Requested-With", | ||
"X-GitHub-Request-Id": "C8BA:37155:255562A:5EFB1ED7:2CCF111" | ||
} | ||
}, | ||
"uuid": "96dd9244-d773-4393-b9da-27ac4fef9643", | ||
"persistent": true, | ||
"insertionIndex": 4 | ||
} |
49 changes: 49 additions & 0 deletions
49
...derTest/wiremock/testCreateChildTeam/mappings/orgs_hub4j-test-org_teams_dummy-team-3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"id": "b239719e-8610-449b-91bd-a35f4cc00424", | ||
"name": "orgs_hub4j-test-org_teams_dummy-team", | ||
"request": { | ||
"url": "/orgs/hub4j-test-org/teams/dummy-team", | ||
"method": "GET", | ||
"headers": { | ||
"Accept": { | ||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" | ||
} | ||
} | ||
}, | ||
"response": { | ||
"status": 200, | ||
"bodyFileName": "orgs_hub4j-test-org_teams_dummy-team-3.json", | ||
"headers": { | ||
"Date": "Tue, 17 Mar 2020 09:12:22 GMT", | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Server": "GitHub.com", | ||
"Status": "200 OK", | ||
"X-RateLimit-Limit": "5000", | ||
"X-RateLimit-Remaining": "4444", | ||
"X-RateLimit-Reset": "1584436622", | ||
"Cache-Control": "private, max-age=60, s-maxage=60", | ||
"Vary": [ | ||
"Accept, Authorization, Cookie, X-GitHub-OTP", | ||
"Accept-Encoding, Accept, X-Requested-With" | ||
], | ||
"ETag": "W/\"a3be19ac98441e2833990a01948c5bbd\"", | ||
"Last-Modified": "Tue, 17 Mar 2020 09:06:57 GMT", | ||
"X-OAuth-Scopes": "admin:org, admin:public_key, admin:repo_hook, notifications, repo, user", | ||
"X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", | ||
"X-GitHub-Media-Type": "unknown, github.v3", | ||
"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": "F8C7:46E1:A3A28:151EF6:5E709475" | ||
} | ||
}, | ||
"uuid": "b239719e-8610-449b-91bd-a35f4cc00424", | ||
"persistent": true, | ||
"scenarioName": "scenario-1-orgs-hub4j-test-org-teams-dummy-team", | ||
"requiredScenarioState": "Started", | ||
"newScenarioState": "scenario-1-orgs-hub4j-test-org-teams-dummy-team-2", | ||
"insertionIndex": 3 | ||
} |