diff --git a/src/main/java/org/kohsuke/github/GHOrganization.java b/src/main/java/org/kohsuke/github/GHOrganization.java index 390f7b4b9a..62b38dbe35 100644 --- a/src/main/java/org/kohsuke/github/GHOrganization.java +++ b/src/main/java/org/kohsuke/github/GHOrganization.java @@ -384,7 +384,10 @@ public enum Permission { * @return the gh team * @throws IOException * the io exception + * @deprecated https://developer.github.com/v3/teams/#create-team deprecates permission field use + * {@link #createTeam(String, Collection)} */ + @Deprecated public GHTeam createTeam(String name, Permission p, Collection repositories) throws IOException { Requester post = new Requester(root).with("name", name).with("permission", p); List repo_names = new ArrayList(); @@ -407,11 +410,50 @@ public GHTeam createTeam(String name, Permission p, Collection rep * @return the gh team * @throws IOException * the io exception + * @deprecated https://developer.github.com/v3/teams/#create-team deprecates permission field use + * {@link #createTeam(String, GHRepository...)} */ + @Deprecated public GHTeam createTeam(String name, Permission p, GHRepository... repositories) throws IOException { return createTeam(name, p, Arrays.asList(repositories)); } + /** + * Creates a new team and assigns the repositories. + * + * @param name + * the name + * @param repositories + * the repositories + * @return the gh team + * @throws IOException + * the io exception + */ + public GHTeam createTeam(String name, Collection repositories) throws IOException { + Requester post = new Requester(root).with("name", name); + List repo_names = new ArrayList(); + for (GHRepository r : repositories) { + repo_names.add(login + "/" + r.getName()); + } + post.with("repo_names", repo_names); + return post.method("POST").to("/orgs/" + login + "/teams", GHTeam.class).wrapUp(this); + } + + /** + * Create team gh team. + * + * @param name + * the name + * @param repositories + * the repositories + * @return the gh team + * @throws IOException + * the io exception + */ + public GHTeam createTeam(String name, GHRepository... repositories) throws IOException { + return createTeam(name, Arrays.asList(repositories)); + } + /** * List up repositories that has some open pull requests. *

diff --git a/src/test/java/org/kohsuke/github/GHOrganizationTest.java b/src/test/java/org/kohsuke/github/GHOrganizationTest.java index 11d5adb663..4782ae9941 100644 --- a/src/test/java/org/kohsuke/github/GHOrganizationTest.java +++ b/src/test/java/org/kohsuke/github/GHOrganizationTest.java @@ -4,6 +4,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.kohsuke.github.GHOrganization.Permission; import java.io.IOException; @@ -85,5 +86,20 @@ public void testCreateTeamWithRepoAccess() throws IOException { // Create team with access to repository. Check access was granted. GHTeam team = org.createTeam(TEAM_NAME_CREATE, GHOrganization.Permission.PUSH, repo); Assert.assertTrue(team.getRepositories().containsKey(REPO_NAME)); + Assert.assertEquals(Permission.PUSH.toString().toLowerCase(), team.getPermission()); + } + + @Test + public void testCreateTeam() throws IOException { + String REPO_NAME = "github-api"; + String DEFAULT_PERMISSION = Permission.PULL.toString().toLowerCase(); + + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + GHRepository repo = org.getRepository(REPO_NAME); + + // Create team with no permission field. Verify that default permission is pull + GHTeam team = org.createTeam(TEAM_NAME_CREATE, repo); + Assert.assertTrue(team.getRepositories().containsKey(REPO_NAME)); + Assert.assertEquals(DEFAULT_PERMISSION, team.getPermission()); } } diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/__files/orgs_github-api-test-org-b46fc09e-f6b1-470b-b070-d37c25eb5096.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/__files/orgs_github-api-test-org-b46fc09e-f6b1-470b-b070-d37c25eb5096.json new file mode 100644 index 0000000000..d8cf8e232f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/__files/orgs_github-api-test-org-b46fc09e-f6b1-470b-b070-d37c25eb5096.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": 10, + "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": 9, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/__files/orgs_github-api-test-org_teams-93bbb3e2-5dd1-41f1-b527-1e431a0213b7.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/__files/orgs_github-api-test-org_teams-93bbb3e2-5dd1-41f1-b527-1e431a0213b7.json new file mode 100644 index 0000000000..98179e8768 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/__files/orgs_github-api-test-org_teams-93bbb3e2-5dd1-41f1-b527-1e431a0213b7.json @@ -0,0 +1,42 @@ +{ + "name": "create-team-test", + "id": 3531422, + "node_id": "MDQ6VGVhbTM1MzE0MjI=", + "slug": "create-team-test", + "description": null, + "privacy": "secret", + "url": "https://api.github.com/teams/3531422", + "html_url": "https://github.com/orgs/github-api-test-org/teams/create-team-test", + "members_url": "https://api.github.com/teams/3531422/members{/member}", + "repositories_url": "https://api.github.com/teams/3531422/repos", + "permission": "pull", + "created_at": "2019-11-20T01:07:57Z", + "updated_at": "2019-11-20T01:07:57Z", + "members_count": 0, + "repos_count": 1, + "organization": { + "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": 10, + "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" + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/__files/repos_github-api-test-org_github-api-8907242a-a66e-45d4-a01e-3f12bfa099a2.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/__files/repos_github-api-test-org_github-api-8907242a-a66e-45d4-a01e-3f12bfa099a2.json new file mode 100644 index 0000000000..82cd4e12b9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/__files/repos_github-api-test-org_github-api-8907242a-a66e-45d4-a01e-3f12bfa099a2.json @@ -0,0 +1,330 @@ +{ + "id": 206888201, + "node_id": "MDEwOlJlcG9zaXRvcnkyMDY4ODgyMDE=", + "name": "github-api", + "full_name": "github-api-test-org/github-api", + "private": false, + "owner": { + "login": "github-api-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github-api-test-org", + "html_url": "https://github.com/github-api-test-org", + "followers_url": "https://api.github.com/users/github-api-test-org/followers", + "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/github-api-test-org/orgs", + "repos_url": "https://api.github.com/users/github-api-test-org/repos", + "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/github-api-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/github-api-test-org/github-api", + "description": "Resetting", + "fork": true, + "url": "https://api.github.com/repos/github-api-test-org/github-api", + "forks_url": "https://api.github.com/repos/github-api-test-org/github-api/forks", + "keys_url": "https://api.github.com/repos/github-api-test-org/github-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/github-api-test-org/github-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/github-api-test-org/github-api/teams", + "hooks_url": "https://api.github.com/repos/github-api-test-org/github-api/hooks", + "issue_events_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/github-api-test-org/github-api/events", + "assignees_url": "https://api.github.com/repos/github-api-test-org/github-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/github-api-test-org/github-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/github-api-test-org/github-api/tags", + "blobs_url": "https://api.github.com/repos/github-api-test-org/github-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/github-api-test-org/github-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/github-api-test-org/github-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/github-api-test-org/github-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/github-api-test-org/github-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/github-api-test-org/github-api/languages", + "stargazers_url": "https://api.github.com/repos/github-api-test-org/github-api/stargazers", + "contributors_url": "https://api.github.com/repos/github-api-test-org/github-api/contributors", + "subscribers_url": "https://api.github.com/repos/github-api-test-org/github-api/subscribers", + "subscription_url": "https://api.github.com/repos/github-api-test-org/github-api/subscription", + "commits_url": "https://api.github.com/repos/github-api-test-org/github-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/github-api-test-org/github-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/github-api-test-org/github-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/github-api-test-org/github-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/github-api-test-org/github-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/github-api-test-org/github-api/merges", + "archive_url": "https://api.github.com/repos/github-api-test-org/github-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/github-api-test-org/github-api/downloads", + "issues_url": "https://api.github.com/repos/github-api-test-org/github-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/github-api-test-org/github-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/github-api-test-org/github-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/github-api-test-org/github-api/labels{/name}", + "releases_url": "https://api.github.com/repos/github-api-test-org/github-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/github-api-test-org/github-api/deployments", + "created_at": "2019-09-06T23:26:04Z", + "updated_at": "2019-11-07T22:27:11Z", + "pushed_at": "2019-10-21T22:34:49Z", + "git_url": "git://github.com/github-api-test-org/github-api.git", + "ssh_url": "git@github.com:github-api-test-org/github-api.git", + "clone_url": "https://github.com/github-api-test-org/github-api.git", + "svn_url": "https://github.com/github-api-test-org/github-api", + "homepage": "http://github-api.kohsuke.org/", + "size": 11391, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "organization": { + "login": "github-api-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github-api-test-org", + "html_url": "https://github.com/github-api-test-org", + "followers_url": "https://api.github.com/users/github-api-test-org/followers", + "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/github-api-test-org/orgs", + "repos_url": "https://api.github.com/users/github-api-test-org/repos", + "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/github-api-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "parent": { + "id": 617210, + "node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=", + "name": "github-api", + "full_name": "github-api/github-api", + "private": false, + "owner": { + "login": "github-api", + "id": 54909825, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github-api", + "html_url": "https://github.com/github-api", + "followers_url": "https://api.github.com/users/github-api/followers", + "following_url": "https://api.github.com/users/github-api/following{/other_user}", + "gists_url": "https://api.github.com/users/github-api/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github-api/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github-api/subscriptions", + "organizations_url": "https://api.github.com/users/github-api/orgs", + "repos_url": "https://api.github.com/users/github-api/repos", + "events_url": "https://api.github.com/users/github-api/events{/privacy}", + "received_events_url": "https://api.github.com/users/github-api/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/github-api/github-api", + "description": "Java API for GitHub", + "fork": false, + "url": "https://api.github.com/repos/github-api/github-api", + "forks_url": "https://api.github.com/repos/github-api/github-api/forks", + "keys_url": "https://api.github.com/repos/github-api/github-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/github-api/github-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/github-api/github-api/teams", + "hooks_url": "https://api.github.com/repos/github-api/github-api/hooks", + "issue_events_url": "https://api.github.com/repos/github-api/github-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/github-api/github-api/events", + "assignees_url": "https://api.github.com/repos/github-api/github-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/github-api/github-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/github-api/github-api/tags", + "blobs_url": "https://api.github.com/repos/github-api/github-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/github-api/github-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/github-api/github-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/github-api/github-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/github-api/github-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/github-api/github-api/languages", + "stargazers_url": "https://api.github.com/repos/github-api/github-api/stargazers", + "contributors_url": "https://api.github.com/repos/github-api/github-api/contributors", + "subscribers_url": "https://api.github.com/repos/github-api/github-api/subscribers", + "subscription_url": "https://api.github.com/repos/github-api/github-api/subscription", + "commits_url": "https://api.github.com/repos/github-api/github-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/github-api/github-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/github-api/github-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/github-api/github-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/github-api/github-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/github-api/github-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/github-api/github-api/merges", + "archive_url": "https://api.github.com/repos/github-api/github-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/github-api/github-api/downloads", + "issues_url": "https://api.github.com/repos/github-api/github-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/github-api/github-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/github-api/github-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/github-api/github-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/github-api/github-api/labels{/name}", + "releases_url": "https://api.github.com/repos/github-api/github-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/github-api/github-api/deployments", + "created_at": "2010-04-19T04:13:03Z", + "updated_at": "2019-11-19T06:48:53Z", + "pushed_at": "2019-11-19T04:03:23Z", + "git_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", + "svn_url": "https://github.com/github-api/github-api", + "homepage": "http://github-api.kohsuke.org/", + "size": 15749, + "stargazers_count": 580, + "watchers_count": 580, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 443, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 52, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 443, + "open_issues": 52, + "watchers": 580, + "default_branch": "master" + }, + "source": { + "id": 617210, + "node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=", + "name": "github-api", + "full_name": "github-api/github-api", + "private": false, + "owner": { + "login": "github-api", + "id": 54909825, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1", + "avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github-api", + "html_url": "https://github.com/github-api", + "followers_url": "https://api.github.com/users/github-api/followers", + "following_url": "https://api.github.com/users/github-api/following{/other_user}", + "gists_url": "https://api.github.com/users/github-api/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github-api/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github-api/subscriptions", + "organizations_url": "https://api.github.com/users/github-api/orgs", + "repos_url": "https://api.github.com/users/github-api/repos", + "events_url": "https://api.github.com/users/github-api/events{/privacy}", + "received_events_url": "https://api.github.com/users/github-api/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/github-api/github-api", + "description": "Java API for GitHub", + "fork": false, + "url": "https://api.github.com/repos/github-api/github-api", + "forks_url": "https://api.github.com/repos/github-api/github-api/forks", + "keys_url": "https://api.github.com/repos/github-api/github-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/github-api/github-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/github-api/github-api/teams", + "hooks_url": "https://api.github.com/repos/github-api/github-api/hooks", + "issue_events_url": "https://api.github.com/repos/github-api/github-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/github-api/github-api/events", + "assignees_url": "https://api.github.com/repos/github-api/github-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/github-api/github-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/github-api/github-api/tags", + "blobs_url": "https://api.github.com/repos/github-api/github-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/github-api/github-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/github-api/github-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/github-api/github-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/github-api/github-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/github-api/github-api/languages", + "stargazers_url": "https://api.github.com/repos/github-api/github-api/stargazers", + "contributors_url": "https://api.github.com/repos/github-api/github-api/contributors", + "subscribers_url": "https://api.github.com/repos/github-api/github-api/subscribers", + "subscription_url": "https://api.github.com/repos/github-api/github-api/subscription", + "commits_url": "https://api.github.com/repos/github-api/github-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/github-api/github-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/github-api/github-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/github-api/github-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/github-api/github-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/github-api/github-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/github-api/github-api/merges", + "archive_url": "https://api.github.com/repos/github-api/github-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/github-api/github-api/downloads", + "issues_url": "https://api.github.com/repos/github-api/github-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/github-api/github-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/github-api/github-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/github-api/github-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/github-api/github-api/labels{/name}", + "releases_url": "https://api.github.com/repos/github-api/github-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/github-api/github-api/deployments", + "created_at": "2010-04-19T04:13:03Z", + "updated_at": "2019-11-19T06:48:53Z", + "pushed_at": "2019-11-19T04:03:23Z", + "git_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", + "svn_url": "https://github.com/github-api/github-api", + "homepage": "http://github-api.kohsuke.org/", + "size": 15749, + "stargazers_count": 580, + "watchers_count": 580, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 443, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 52, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 443, + "open_issues": 52, + "watchers": 580, + "default_branch": "master" + }, + "network_count": 443, + "subscribers_count": 0 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/__files/teams_3531422_repos-9893d54e-bc2f-4246-ba25-b9c157b22845.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/__files/teams_3531422_repos-9893d54e-bc2f-4246-ba25-b9c157b22845.json new file mode 100644 index 0000000000..0f89f8ce12 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/__files/teams_3531422_repos-9893d54e-bc2f-4246-ba25-b9c157b22845.json @@ -0,0 +1,107 @@ +[ + { + "id": 206888201, + "node_id": "MDEwOlJlcG9zaXRvcnkyMDY4ODgyMDE=", + "name": "github-api", + "full_name": "github-api-test-org/github-api", + "owner": { + "login": "github-api-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github-api-test-org", + "html_url": "https://github.com/github-api-test-org", + "followers_url": "https://api.github.com/users/github-api-test-org/followers", + "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/github-api-test-org/orgs", + "repos_url": "https://api.github.com/users/github-api-test-org/repos", + "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/github-api-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/github-api-test-org/github-api", + "description": "Resetting", + "fork": true, + "url": "https://api.github.com/repos/github-api-test-org/github-api", + "forks_url": "https://api.github.com/repos/github-api-test-org/github-api/forks", + "keys_url": "https://api.github.com/repos/github-api-test-org/github-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/github-api-test-org/github-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/github-api-test-org/github-api/teams", + "hooks_url": "https://api.github.com/repos/github-api-test-org/github-api/hooks", + "issue_events_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/github-api-test-org/github-api/events", + "assignees_url": "https://api.github.com/repos/github-api-test-org/github-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/github-api-test-org/github-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/github-api-test-org/github-api/tags", + "blobs_url": "https://api.github.com/repos/github-api-test-org/github-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/github-api-test-org/github-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/github-api-test-org/github-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/github-api-test-org/github-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/github-api-test-org/github-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/github-api-test-org/github-api/languages", + "stargazers_url": "https://api.github.com/repos/github-api-test-org/github-api/stargazers", + "contributors_url": "https://api.github.com/repos/github-api-test-org/github-api/contributors", + "subscribers_url": "https://api.github.com/repos/github-api-test-org/github-api/subscribers", + "subscription_url": "https://api.github.com/repos/github-api-test-org/github-api/subscription", + "commits_url": "https://api.github.com/repos/github-api-test-org/github-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/github-api-test-org/github-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/github-api-test-org/github-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/github-api-test-org/github-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/github-api-test-org/github-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/github-api-test-org/github-api/merges", + "archive_url": "https://api.github.com/repos/github-api-test-org/github-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/github-api-test-org/github-api/downloads", + "issues_url": "https://api.github.com/repos/github-api-test-org/github-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/github-api-test-org/github-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/github-api-test-org/github-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/github-api-test-org/github-api/labels{/name}", + "releases_url": "https://api.github.com/repos/github-api-test-org/github-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/github-api-test-org/github-api/deployments", + "created_at": "2019-09-06T23:26:04Z", + "updated_at": "2019-11-07T22:27:11Z", + "pushed_at": "2019-10-21T22:34:49Z", + "git_url": "git://github.com/github-api-test-org/github-api.git", + "ssh_url": "git@github.com:github-api-test-org/github-api.git", + "clone_url": "https://github.com/github-api-test-org/github-api.git", + "svn_url": "https://github.com/github-api-test-org/github-api", + "homepage": "http://github-api.kohsuke.org/", + "size": 11391, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Java", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "permissions": { + "pull": true, + "push": false, + "admin": false + } + } +] \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/__files/user-3a6b16d8-0d7e-4409-bb25-07ac6103a4fd.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/__files/user-3a6b16d8-0d7e-4409-bb25-07ac6103a4fd.json new file mode 100644 index 0000000000..ee0bf1e3a3 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/__files/user-3a6b16d8-0d7e-4409-bb25-07ac6103a4fd.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/testCreateTeam/mappings/orgs_github-api-test-org-2-b46fc0.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/mappings/orgs_github-api-test-org-2-b46fc0.json new file mode 100644 index 0000000000..c48153d52b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/mappings/orgs_github-api-test-org-2-b46fc0.json @@ -0,0 +1,43 @@ +{ + "id": "b46fc09e-f6b1-470b-b070-d37c25eb5096", + "name": "orgs_github-api-test-org", + "request": { + "url": "/orgs/github-api-test-org", + "method": "GET" + }, + "response": { + "status": 200, + "bodyFileName": "orgs_github-api-test-org-b46fc09e-f6b1-470b-b070-d37c25eb5096.json", + "headers": { + "Date": "Wed, 20 Nov 2019 01:07:56 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4941", + "X-RateLimit-Reset": "1574215499", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"06bf8d27c18bdcae52cacdb1c04e5618\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 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": "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": "84E8:8C36:9EA5B0:B90507:5DD491EC" + } + }, + "uuid": "b46fc09e-f6b1-470b-b070-d37c25eb5096", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/mappings/orgs_github-api-test-org_teams-4-93bbb3.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/mappings/orgs_github-api-test-org_teams-4-93bbb3.json new file mode 100644 index 0000000000..92078b54d6 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/mappings/orgs_github-api-test-org_teams-4-93bbb3.json @@ -0,0 +1,50 @@ +{ + "id": "93bbb3e2-5dd1-41f1-b527-1e431a0213b7", + "name": "orgs_github-api-test-org_teams", + "request": { + "url": "/orgs/github-api-test-org/teams", + "method": "POST", + "bodyPatterns": [ + { + "equalToJson": "{\"name\":\"create-team-test\",\"repo_names\":[\"github-api-test-org/github-api\"]}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "orgs_github-api-test-org_teams-93bbb3e2-5dd1-41f1-b527-1e431a0213b7.json", + "headers": { + "Date": "Wed, 20 Nov 2019 01:07:58 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4939", + "X-RateLimit-Reset": "1574215499", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "\"454ab73d1808f8bc3abc9478505ad221\"", + "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", + "Location": "https://api.github.com/teams/3531422", + "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": "84E8:8C36:9EA5E9:B90588:5DD491ED" + } + }, + "uuid": "93bbb3e2-5dd1-41f1-b527-1e431a0213b7", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/mappings/repos_github-api-test-org_github-api-3-890724.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/mappings/repos_github-api-test-org_github-api-3-890724.json new file mode 100644 index 0000000000..43017fe7c1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/mappings/repos_github-api-test-org_github-api-3-890724.json @@ -0,0 +1,43 @@ +{ + "id": "8907242a-a66e-45d4-a01e-3f12bfa099a2", + "name": "repos_github-api-test-org_github-api", + "request": { + "url": "/repos/github-api-test-org/github-api", + "method": "GET" + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_github-api-8907242a-a66e-45d4-a01e-3f12bfa099a2.json", + "headers": { + "Date": "Wed, 20 Nov 2019 01:07:57 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4940", + "X-RateLimit-Reset": "1574215499", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"5f93d5d1afae66d9e8f982e4cad293b6\"", + "Last-Modified": "Thu, 07 Nov 2019 22:27:11 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": "repo", + "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": "84E8:8C36:9EA5C8:B9056B:5DD491EC" + } + }, + "uuid": "8907242a-a66e-45d4-a01e-3f12bfa099a2", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/mappings/teams_3531422_repos-5-9893d5.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/mappings/teams_3531422_repos-5-9893d5.json new file mode 100644 index 0000000000..a2c5168514 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/mappings/teams_3531422_repos-5-9893d5.json @@ -0,0 +1,42 @@ +{ + "id": "9893d54e-bc2f-4246-ba25-b9c157b22845", + "name": "teams_3531422_repos", + "request": { + "url": "/teams/3531422/repos", + "method": "GET" + }, + "response": { + "status": 200, + "bodyFileName": "teams_3531422_repos-9893d54e-bc2f-4246-ba25-b9c157b22845.json", + "headers": { + "Date": "Wed, 20 Nov 2019 01:07:58 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4938", + "X-RateLimit-Reset": "1574215499", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"56e4bb5283d34fc86bf30247ae56cfbd\"", + "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, 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": "84E8:8C36:9EA654:B9060A:5DD491EE" + } + }, + "uuid": "9893d54e-bc2f-4246-ba25-b9c157b22845", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/mappings/user-1-3a6b16.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/mappings/user-1-3a6b16.json new file mode 100644 index 0000000000..d7d8ce78b0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateTeam/mappings/user-1-3a6b16.json @@ -0,0 +1,43 @@ +{ + "id": "3a6b16d8-0d7e-4409-bb25-07ac6103a4fd", + "name": "user", + "request": { + "url": "/user", + "method": "GET" + }, + "response": { + "status": 200, + "bodyFileName": "user-3a6b16d8-0d7e-4409-bb25-07ac6103a4fd.json", + "headers": { + "Date": "Wed, 20 Nov 2019 01:07:56 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4945", + "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": "84E8:8C36:9EA55D:B904F1:5DD491EC" + } + }, + "uuid": "3a6b16d8-0d7e-4409-bb25-07ac6103a4fd", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testInviteUser/__files/user-7e6e7d53-a5ae-46b0-afc0-a73258da075d.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testInviteUser/__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/testInviteUser/__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/testInviteUser/mappings/user-6-7e6e7d.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testInviteUser/mappings/user-6-7e6e7d.json new file mode 100644 index 0000000000..c53b130248 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testInviteUser/mappings/user-6-7e6e7d.json @@ -0,0 +1,43 @@ +{ + "id": "7e6e7d53-a5ae-46b0-afc0-a73258da075d", + "name": "user", + "request": { + "url": "/user", + "method": "GET" + }, + "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