diff --git a/src/main/java/org/kohsuke/github/GHCreateRepositoryBuilder.java b/src/main/java/org/kohsuke/github/GHCreateRepositoryBuilder.java index f2ec24a14b..1303143fc5 100644 --- a/src/main/java/org/kohsuke/github/GHCreateRepositoryBuilder.java +++ b/src/main/java/org/kohsuke/github/GHCreateRepositoryBuilder.java @@ -1,6 +1,7 @@ package org.kohsuke.github; import java.io.IOException; +import java.util.Objects; import static org.kohsuke.github.internal.Previews.BAPTISTE; @@ -131,6 +132,23 @@ public GHCreateRepositoryBuilder fromTemplateRepository(String templateOwner, St return this; } + /** + * Create repository from template repository. + * + * @param templateRepository + * the template repository as a GHRepository + * @return a builder to continue with building + * @see GitHub API Previews + */ + @Preview(BAPTISTE) + public GHCreateRepositoryBuilder fromTemplateRepository(GHRepository templateRepository) { + Objects.requireNonNull(templateRepository, "templateRepository cannot be null"); + if (!templateRepository.isTemplate()) { + throw new IllegalArgumentException("The provided repository is not a template repository."); + } + return fromTemplateRepository(templateRepository.getOwnerName(), templateRepository.getName()); + } + /** * Creates a repository with all the parameters. * diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index 429ac67cdb..a508b17971 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -120,6 +120,8 @@ public class GHRepository extends GHObject { private String default_branch, language; + private GHRepository template_repository; + private Map commits = Collections.synchronizedMap(new WeakHashMap<>()); @SkipFromToString @@ -948,6 +950,16 @@ public String getMasterBranch() { return default_branch; } + /** + * Get Repository template was the repository created from. + * + * @return the repository template + */ + @SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected") + public GHRepository getTemplateRepository() { + return (GHRepository) template_repository; + } + /** * Gets size. * diff --git a/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java b/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java index 580675b10d..c663dc1b32 100644 --- a/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java +++ b/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java @@ -15,7 +15,6 @@ import java.util.List; import static org.hamcrest.Matchers.*; -import static org.hamcrest.Matchers.equalTo; // TODO: Auto-generated Javadoc /** @@ -75,6 +74,20 @@ public void testGetRepository() throws Exception { assertThat(testRepo.getName(), equalTo(repo.getName())); } + /** + * Test get repository created from a template repository + * + * @throws Exception + * the exception + */ + @Test + public void testGetRepositoryWithTemplateRepositoryInfo() throws Exception { + GHRepository testRepo = gitHub.getRepositoryById(repo.getId()); + assertThat(testRepo.getTemplateRepository(), notNullValue()); + assertThat(testRepo.getTemplateRepository().getOwnerName(), equalTo("octocat")); + assertThat(testRepo.getTemplateRepository().isTemplate(), equalTo(true)); + } + /** * Test get file content. * diff --git a/src/test/java/org/kohsuke/github/GHOrganizationTest.java b/src/test/java/org/kohsuke/github/GHOrganizationTest.java index 6edd1e172e..5bf71751a3 100644 --- a/src/test/java/org/kohsuke/github/GHOrganizationTest.java +++ b/src/test/java/org/kohsuke/github/GHOrganizationTest.java @@ -11,6 +11,7 @@ import java.util.stream.Collectors; import static org.hamcrest.Matchers.*; +import static org.junit.Assert.assertThrows; // TODO: Auto-generated Javadoc /** @@ -154,6 +155,66 @@ public void testCreateRepositoryWithTemplate() throws IOException { } + /** + * Test create repository with template. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testCreateRepositoryWithTemplateAndGHRepository() throws IOException { + cleanupRepository(GITHUB_API_TEST_ORG + '/' + GITHUB_API_TEST); + + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + GHRepository templateRepository = org.getRepository(GITHUB_API_TEMPLATE_TEST); + + GHRepository repository = org.createRepository(GITHUB_API_TEST) + .fromTemplateRepository(templateRepository) + .owner(GITHUB_API_TEST_ORG) + .create(); + + assertThat(repository, notNullValue()); + assertThat(repository.getReadme(), notNullValue()); + + } + + /** + * Test create repository with template repository null. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testCreateRepositoryFromTemplateRepositoryNull() throws IOException { + cleanupRepository(GITHUB_API_TEST_ORG + '/' + GITHUB_API_TEST); + + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + assertThrows(NullPointerException.class, () -> { + org.createRepository(GITHUB_API_TEST).fromTemplateRepository(null).owner(GITHUB_API_TEST_ORG).create(); + }); + } + + /** + * Test create repository when repository template is not a template. + * + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @Test + public void testCreateRepositoryWhenRepositoryTemplateIsNotATemplate() throws IOException { + cleanupRepository(GITHUB_API_TEST_ORG + '/' + GITHUB_API_TEST); + + GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG); + GHRepository templateRepository = org.getRepository(GITHUB_API_TEMPLATE_TEST); + + assertThrows(IllegalArgumentException.class, () -> { + org.createRepository(GITHUB_API_TEST) + .fromTemplateRepository(templateRepository) + .owner(GITHUB_API_TEST_ORG) + .create(); + }); + } + /** * Test invite user. * diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/__files/1-user.json new file mode 100644 index 0000000000..045960ff93 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/__files/1-user.json @@ -0,0 +1,46 @@ +{ + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": null, + "twitter_username": "bitwiseman", + "public_repos": 202, + "public_gists": 8, + "followers": 179, + "following": 11, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2021-02-25T18:01:06Z", + "private_gists": 19, + "total_private_repos": 18, + "owned_private_repos": 0, + "disk_usage": 33700, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/__files/2-r_h_ghcontentintegrationtest.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/__files/2-r_h_ghcontentintegrationtest.json new file mode 100644 index 0000000000..4bcd9d86a1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/__files/2-r_h_ghcontentintegrationtest.json @@ -0,0 +1,436 @@ +{ + "id": 40763577, + "node_id": "MDEwOlJlcG9zaXRvcnk0MDc2MzU3Nw==", + "name": "GHContentIntegrationTest", + "full_name": "hub4j-test-org/GHContentIntegrationTest", + "private": false, + "owner": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest", + "description": "Repository used for integration test of github-api", + "fork": true, + "url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest", + "forks_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/deployments", + "created_at": "2015-08-15T14:14:57Z", + "updated_at": "2020-07-02T15:49:49Z", + "pushed_at": "2020-07-02T15:49:47Z", + "git_url": "git://github.com/hub4j-test-org/GHContentIntegrationTest.git", + "ssh_url": "git@github.com:hub4j-test-org/GHContentIntegrationTest.git", + "clone_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest.git", + "svn_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest", + "homepage": null, + "size": 55, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 41, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 41, + "open_issues": 0, + "watchers": 0, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "template_repository": { + "id": 1296269, + "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", + "name": "Hello-World-Template", + "full_name": "octocat/Hello-World-Template", + "owner": { + "login": "octocat", + "id": 1, + "node_id": "MDQ6VXNlcjE=", + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/octocat/Hello-World-Template", + "description": "This your first repo!", + "fork": false, + "url": "https://api.github.com/repos/octocat/Hello-World-Template", + "archive_url": "https://api.github.com/repos/octocat/Hello-World-Template/{archive_format}{/ref}", + "assignees_url": "https://api.github.com/repos/octocat/Hello-World-Template/assignees{/user}", + "blobs_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/octocat/Hello-World-Template/branches{/branch}", + "collaborators_url": "https://api.github.com/repos/octocat/Hello-World-Template/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/octocat/Hello-World-Template/comments{/number}", + "commits_url": "https://api.github.com/repos/octocat/Hello-World-Template/commits{/sha}", + "compare_url": "https://api.github.com/repos/octocat/Hello-World-Template/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/octocat/Hello-World-Template/contents/{+path}", + "contributors_url": "https://api.github.com/repos/octocat/Hello-World-Template/contributors", + "deployments_url": "https://api.github.com/repos/octocat/Hello-World-Template/deployments", + "downloads_url": "https://api.github.com/repos/octocat/Hello-World-Template/downloads", + "events_url": "https://api.github.com/repos/octocat/Hello-World-Template/events", + "forks_url": "https://api.github.com/repos/octocat/Hello-World-Template/forks", + "git_commits_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/tags{/sha}", + "git_url": "git:github.com/octocat/Hello-World-Template.git", + "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World-Template/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/octocat/Hello-World-Template/issues/events{/number}", + "issues_url": "https://api.github.com/repos/octocat/Hello-World-Template/issues{/number}", + "keys_url": "https://api.github.com/repos/octocat/Hello-World-Template/keys{/key_id}", + "labels_url": "https://api.github.com/repos/octocat/Hello-World-Template/labels{/name}", + "languages_url": "https://api.github.com/repos/octocat/Hello-World-Template/languages", + "merges_url": "https://api.github.com/repos/octocat/Hello-World-Template/merges", + "milestones_url": "https://api.github.com/repos/octocat/Hello-World-Template/milestones{/number}", + "notifications_url": "https://api.github.com/repos/octocat/Hello-World-Template/notifications{?since,all,participating}", + "pulls_url": "https://api.github.com/repos/octocat/Hello-World-Template/pulls{/number}", + "releases_url": "https://api.github.com/repos/octocat/Hello-World-Template/releases{/id}", + "ssh_url": "git@github.com:octocat/Hello-World-Template.git", + "stargazers_url": "https://api.github.com/repos/octocat/Hello-World-Template/stargazers", + "statuses_url": "https://api.github.com/repos/octocat/Hello-World-Template/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/octocat/Hello-World-Template/subscribers", + "subscription_url": "https://api.github.com/repos/octocat/Hello-World-Template/subscription", + "tags_url": "https://api.github.com/repos/octocat/Hello-World-Template/tags", + "teams_url": "https://api.github.com/repos/octocat/Hello-World-Template/teams", + "trees_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/trees{/sha}", + "clone_url": "https://github.com/octocat/Hello-World-Template.git", + "mirror_url": "git:git.example.com/octocat/Hello-World-Template", + "hooks_url": "https://api.github.com/repos/octocat/Hello-World-Template/hooks", + "svn_url": "https://svn.github.com/octocat/Hello-World-Template", + "homepage": "https://github.com", + "language": null, + "forks": 9, + "forks_count": 9, + "stargazers_count": 80, + "watchers_count": 80, + "watchers": 80, + "size": 108, + "default_branch": "master", + "open_issues": 0, + "open_issues_count": 0, + "is_template": true, + "license": { + "key": "mit", + "name": "MIT License", + "url": "https://api.github.com/licenses/mit", + "spdx_id": "MIT", + "node_id": "MDc6TGljZW5zZW1pdA==", + "html_url": "https://api.github.com/licenses/mit" + }, + "topics": [ + "octocat", + "atom", + "electron", + "api" + ], + "has_issues": true, + "has_projects": true, + "has_wiki": true, + "has_pages": false, + "has_downloads": true, + "archived": false, + "disabled": false, + "visibility": "public", + "pushed_at": "2011-01-26T19:06:43Z", + "created_at": "2011-01-26T19:01:12Z", + "updated_at": "2011-01-26T19:14:43Z", + "permissions": { + "admin": false, + "push": false, + "pull": true + }, + "allow_rebase_merge": true, + "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O", + "allow_squash_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": true, + "allow_merge_commit": true, + "subscribers_count": 42, + "network_count": 0 + }, + "temp_clone_token": "", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "delete_branch_on_merge": false, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "parent": { + "id": 19653852, + "node_id": "MDEwOlJlcG9zaXRvcnkxOTY1Mzg1Mg==", + "name": "GHContentIntegrationTest", + "full_name": "kohsuke2/GHContentIntegrationTest", + "private": false, + "owner": { + "login": "kohsuke2", + "id": 1329242, + "node_id": "MDQ6VXNlcjEzMjkyNDI=", + "avatar_url": "https://avatars.githubusercontent.com/u/1329242?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke2", + "html_url": "https://github.com/kohsuke2", + "followers_url": "https://api.github.com/users/kohsuke2/followers", + "following_url": "https://api.github.com/users/kohsuke2/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke2/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke2/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke2/orgs", + "repos_url": "https://api.github.com/users/kohsuke2/repos", + "events_url": "https://api.github.com/users/kohsuke2/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke2/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/kohsuke2/GHContentIntegrationTest", + "description": "Repository used for integration test of github-api", + "fork": true, + "url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest", + "forks_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/forks", + "keys_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/teams", + "hooks_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/hooks", + "issue_events_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/issues/events{/number}", + "events_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/events", + "assignees_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/assignees{/user}", + "branches_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/branches{/branch}", + "tags_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/tags", + "blobs_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/languages", + "stargazers_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/stargazers", + "contributors_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/contributors", + "subscribers_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/subscribers", + "subscription_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/subscription", + "commits_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/contents/{+path}", + "compare_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/merges", + "archive_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/downloads", + "issues_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/issues{/number}", + "pulls_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/labels{/name}", + "releases_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/releases{/id}", + "deployments_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/deployments", + "created_at": "2014-05-10T22:50:30Z", + "updated_at": "2018-11-07T15:36:19Z", + "pushed_at": "2018-11-07T15:36:18Z", + "git_url": "git://github.com/kohsuke2/GHContentIntegrationTest.git", + "ssh_url": "git@github.com:kohsuke2/GHContentIntegrationTest.git", + "clone_url": "https://github.com/kohsuke2/GHContentIntegrationTest.git", + "svn_url": "https://github.com/kohsuke2/GHContentIntegrationTest", + "homepage": null, + "size": 111, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 1, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 1, + "open_issues": 0, + "watchers": 0, + "default_branch": "main" + }, + "source": { + "id": 14779458, + "node_id": "MDEwOlJlcG9zaXRvcnkxNDc3OTQ1OA==", + "name": "github-api-test-1", + "full_name": "farmdawgnation/github-api-test-1", + "private": false, + "owner": { + "login": "farmdawgnation", + "id": 620189, + "node_id": "MDQ6VXNlcjYyMDE4OQ==", + "avatar_url": "https://avatars.githubusercontent.com/u/620189?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/farmdawgnation", + "html_url": "https://github.com/farmdawgnation", + "followers_url": "https://api.github.com/users/farmdawgnation/followers", + "following_url": "https://api.github.com/users/farmdawgnation/following{/other_user}", + "gists_url": "https://api.github.com/users/farmdawgnation/gists{/gist_id}", + "starred_url": "https://api.github.com/users/farmdawgnation/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/farmdawgnation/subscriptions", + "organizations_url": "https://api.github.com/users/farmdawgnation/orgs", + "repos_url": "https://api.github.com/users/farmdawgnation/repos", + "events_url": "https://api.github.com/users/farmdawgnation/events{/privacy}", + "received_events_url": "https://api.github.com/users/farmdawgnation/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/farmdawgnation/github-api-test-1", + "description": "Repository used for integration test of github-api", + "fork": false, + "url": "https://api.github.com/repos/farmdawgnation/github-api-test-1", + "forks_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/forks", + "keys_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/teams", + "hooks_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/hooks", + "issue_events_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/issues/events{/number}", + "events_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/events", + "assignees_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/assignees{/user}", + "branches_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/branches{/branch}", + "tags_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/tags", + "blobs_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/statuses/{sha}", + "languages_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/languages", + "stargazers_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/stargazers", + "contributors_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/contributors", + "subscribers_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/subscribers", + "subscription_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/subscription", + "commits_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/contents/{+path}", + "compare_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/merges", + "archive_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/downloads", + "issues_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/issues{/number}", + "pulls_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/pulls{/number}", + "milestones_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/milestones{/number}", + "notifications_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/labels{/name}", + "releases_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/releases{/id}", + "deployments_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/deployments", + "created_at": "2013-11-28T14:46:38Z", + "updated_at": "2016-02-05T13:33:23Z", + "pushed_at": "2013-11-28T14:55:36Z", + "git_url": "git://github.com/farmdawgnation/github-api-test-1.git", + "ssh_url": "git@github.com:farmdawgnation/github-api-test-1.git", + "clone_url": "https://github.com/farmdawgnation/github-api-test-1.git", + "svn_url": "https://github.com/farmdawgnation/github-api-test-1", + "homepage": null, + "size": 89, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 59, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 59, + "open_issues": 0, + "watchers": 0, + "default_branch": "main" + }, + "network_count": 59, + "subscribers_count": 0 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/__files/3-repositories_40763577.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/__files/3-repositories_40763577.json new file mode 100644 index 0000000000..4bcd9d86a1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/__files/3-repositories_40763577.json @@ -0,0 +1,436 @@ +{ + "id": 40763577, + "node_id": "MDEwOlJlcG9zaXRvcnk0MDc2MzU3Nw==", + "name": "GHContentIntegrationTest", + "full_name": "hub4j-test-org/GHContentIntegrationTest", + "private": false, + "owner": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest", + "description": "Repository used for integration test of github-api", + "fork": true, + "url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest", + "forks_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/GHContentIntegrationTest/deployments", + "created_at": "2015-08-15T14:14:57Z", + "updated_at": "2020-07-02T15:49:49Z", + "pushed_at": "2020-07-02T15:49:47Z", + "git_url": "git://github.com/hub4j-test-org/GHContentIntegrationTest.git", + "ssh_url": "git@github.com:hub4j-test-org/GHContentIntegrationTest.git", + "clone_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest.git", + "svn_url": "https://github.com/hub4j-test-org/GHContentIntegrationTest", + "homepage": null, + "size": 55, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 41, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 41, + "open_issues": 0, + "watchers": 0, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "template_repository": { + "id": 1296269, + "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", + "name": "Hello-World-Template", + "full_name": "octocat/Hello-World-Template", + "owner": { + "login": "octocat", + "id": 1, + "node_id": "MDQ6VXNlcjE=", + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/octocat/Hello-World-Template", + "description": "This your first repo!", + "fork": false, + "url": "https://api.github.com/repos/octocat/Hello-World-Template", + "archive_url": "https://api.github.com/repos/octocat/Hello-World-Template/{archive_format}{/ref}", + "assignees_url": "https://api.github.com/repos/octocat/Hello-World-Template/assignees{/user}", + "blobs_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/octocat/Hello-World-Template/branches{/branch}", + "collaborators_url": "https://api.github.com/repos/octocat/Hello-World-Template/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/octocat/Hello-World-Template/comments{/number}", + "commits_url": "https://api.github.com/repos/octocat/Hello-World-Template/commits{/sha}", + "compare_url": "https://api.github.com/repos/octocat/Hello-World-Template/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/octocat/Hello-World-Template/contents/{+path}", + "contributors_url": "https://api.github.com/repos/octocat/Hello-World-Template/contributors", + "deployments_url": "https://api.github.com/repos/octocat/Hello-World-Template/deployments", + "downloads_url": "https://api.github.com/repos/octocat/Hello-World-Template/downloads", + "events_url": "https://api.github.com/repos/octocat/Hello-World-Template/events", + "forks_url": "https://api.github.com/repos/octocat/Hello-World-Template/forks", + "git_commits_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/tags{/sha}", + "git_url": "git:github.com/octocat/Hello-World-Template.git", + "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World-Template/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/octocat/Hello-World-Template/issues/events{/number}", + "issues_url": "https://api.github.com/repos/octocat/Hello-World-Template/issues{/number}", + "keys_url": "https://api.github.com/repos/octocat/Hello-World-Template/keys{/key_id}", + "labels_url": "https://api.github.com/repos/octocat/Hello-World-Template/labels{/name}", + "languages_url": "https://api.github.com/repos/octocat/Hello-World-Template/languages", + "merges_url": "https://api.github.com/repos/octocat/Hello-World-Template/merges", + "milestones_url": "https://api.github.com/repos/octocat/Hello-World-Template/milestones{/number}", + "notifications_url": "https://api.github.com/repos/octocat/Hello-World-Template/notifications{?since,all,participating}", + "pulls_url": "https://api.github.com/repos/octocat/Hello-World-Template/pulls{/number}", + "releases_url": "https://api.github.com/repos/octocat/Hello-World-Template/releases{/id}", + "ssh_url": "git@github.com:octocat/Hello-World-Template.git", + "stargazers_url": "https://api.github.com/repos/octocat/Hello-World-Template/stargazers", + "statuses_url": "https://api.github.com/repos/octocat/Hello-World-Template/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/octocat/Hello-World-Template/subscribers", + "subscription_url": "https://api.github.com/repos/octocat/Hello-World-Template/subscription", + "tags_url": "https://api.github.com/repos/octocat/Hello-World-Template/tags", + "teams_url": "https://api.github.com/repos/octocat/Hello-World-Template/teams", + "trees_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/trees{/sha}", + "clone_url": "https://github.com/octocat/Hello-World-Template.git", + "mirror_url": "git:git.example.com/octocat/Hello-World-Template", + "hooks_url": "https://api.github.com/repos/octocat/Hello-World-Template/hooks", + "svn_url": "https://svn.github.com/octocat/Hello-World-Template", + "homepage": "https://github.com", + "language": null, + "forks": 9, + "forks_count": 9, + "stargazers_count": 80, + "watchers_count": 80, + "watchers": 80, + "size": 108, + "default_branch": "master", + "open_issues": 0, + "open_issues_count": 0, + "is_template": true, + "license": { + "key": "mit", + "name": "MIT License", + "url": "https://api.github.com/licenses/mit", + "spdx_id": "MIT", + "node_id": "MDc6TGljZW5zZW1pdA==", + "html_url": "https://api.github.com/licenses/mit" + }, + "topics": [ + "octocat", + "atom", + "electron", + "api" + ], + "has_issues": true, + "has_projects": true, + "has_wiki": true, + "has_pages": false, + "has_downloads": true, + "archived": false, + "disabled": false, + "visibility": "public", + "pushed_at": "2011-01-26T19:06:43Z", + "created_at": "2011-01-26T19:01:12Z", + "updated_at": "2011-01-26T19:14:43Z", + "permissions": { + "admin": false, + "push": false, + "pull": true + }, + "allow_rebase_merge": true, + "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O", + "allow_squash_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": true, + "allow_merge_commit": true, + "subscribers_count": 42, + "network_count": 0 + }, + "temp_clone_token": "", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "delete_branch_on_merge": false, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "parent": { + "id": 19653852, + "node_id": "MDEwOlJlcG9zaXRvcnkxOTY1Mzg1Mg==", + "name": "GHContentIntegrationTest", + "full_name": "kohsuke2/GHContentIntegrationTest", + "private": false, + "owner": { + "login": "kohsuke2", + "id": 1329242, + "node_id": "MDQ6VXNlcjEzMjkyNDI=", + "avatar_url": "https://avatars.githubusercontent.com/u/1329242?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kohsuke2", + "html_url": "https://github.com/kohsuke2", + "followers_url": "https://api.github.com/users/kohsuke2/followers", + "following_url": "https://api.github.com/users/kohsuke2/following{/other_user}", + "gists_url": "https://api.github.com/users/kohsuke2/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kohsuke2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kohsuke2/subscriptions", + "organizations_url": "https://api.github.com/users/kohsuke2/orgs", + "repos_url": "https://api.github.com/users/kohsuke2/repos", + "events_url": "https://api.github.com/users/kohsuke2/events{/privacy}", + "received_events_url": "https://api.github.com/users/kohsuke2/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/kohsuke2/GHContentIntegrationTest", + "description": "Repository used for integration test of github-api", + "fork": true, + "url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest", + "forks_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/forks", + "keys_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/teams", + "hooks_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/hooks", + "issue_events_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/issues/events{/number}", + "events_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/events", + "assignees_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/assignees{/user}", + "branches_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/branches{/branch}", + "tags_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/tags", + "blobs_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/languages", + "stargazers_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/stargazers", + "contributors_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/contributors", + "subscribers_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/subscribers", + "subscription_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/subscription", + "commits_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/contents/{+path}", + "compare_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/merges", + "archive_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/downloads", + "issues_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/issues{/number}", + "pulls_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/labels{/name}", + "releases_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/releases{/id}", + "deployments_url": "https://api.github.com/repos/kohsuke2/GHContentIntegrationTest/deployments", + "created_at": "2014-05-10T22:50:30Z", + "updated_at": "2018-11-07T15:36:19Z", + "pushed_at": "2018-11-07T15:36:18Z", + "git_url": "git://github.com/kohsuke2/GHContentIntegrationTest.git", + "ssh_url": "git@github.com:kohsuke2/GHContentIntegrationTest.git", + "clone_url": "https://github.com/kohsuke2/GHContentIntegrationTest.git", + "svn_url": "https://github.com/kohsuke2/GHContentIntegrationTest", + "homepage": null, + "size": 111, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 1, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 1, + "open_issues": 0, + "watchers": 0, + "default_branch": "main" + }, + "source": { + "id": 14779458, + "node_id": "MDEwOlJlcG9zaXRvcnkxNDc3OTQ1OA==", + "name": "github-api-test-1", + "full_name": "farmdawgnation/github-api-test-1", + "private": false, + "owner": { + "login": "farmdawgnation", + "id": 620189, + "node_id": "MDQ6VXNlcjYyMDE4OQ==", + "avatar_url": "https://avatars.githubusercontent.com/u/620189?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/farmdawgnation", + "html_url": "https://github.com/farmdawgnation", + "followers_url": "https://api.github.com/users/farmdawgnation/followers", + "following_url": "https://api.github.com/users/farmdawgnation/following{/other_user}", + "gists_url": "https://api.github.com/users/farmdawgnation/gists{/gist_id}", + "starred_url": "https://api.github.com/users/farmdawgnation/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/farmdawgnation/subscriptions", + "organizations_url": "https://api.github.com/users/farmdawgnation/orgs", + "repos_url": "https://api.github.com/users/farmdawgnation/repos", + "events_url": "https://api.github.com/users/farmdawgnation/events{/privacy}", + "received_events_url": "https://api.github.com/users/farmdawgnation/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/farmdawgnation/github-api-test-1", + "description": "Repository used for integration test of github-api", + "fork": false, + "url": "https://api.github.com/repos/farmdawgnation/github-api-test-1", + "forks_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/forks", + "keys_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/teams", + "hooks_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/hooks", + "issue_events_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/issues/events{/number}", + "events_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/events", + "assignees_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/assignees{/user}", + "branches_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/branches{/branch}", + "tags_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/tags", + "blobs_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/statuses/{sha}", + "languages_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/languages", + "stargazers_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/stargazers", + "contributors_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/contributors", + "subscribers_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/subscribers", + "subscription_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/subscription", + "commits_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/contents/{+path}", + "compare_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/merges", + "archive_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/downloads", + "issues_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/issues{/number}", + "pulls_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/pulls{/number}", + "milestones_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/milestones{/number}", + "notifications_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/labels{/name}", + "releases_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/releases{/id}", + "deployments_url": "https://api.github.com/repos/farmdawgnation/github-api-test-1/deployments", + "created_at": "2013-11-28T14:46:38Z", + "updated_at": "2016-02-05T13:33:23Z", + "pushed_at": "2013-11-28T14:55:36Z", + "git_url": "git://github.com/farmdawgnation/github-api-test-1.git", + "ssh_url": "git@github.com:farmdawgnation/github-api-test-1.git", + "clone_url": "https://github.com/farmdawgnation/github-api-test-1.git", + "svn_url": "https://github.com/farmdawgnation/github-api-test-1", + "homepage": null, + "size": 89, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 59, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 59, + "open_issues": 0, + "watchers": 0, + "default_branch": "main" + }, + "network_count": 59, + "subscribers_count": 0 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/mappings/1-user.json new file mode 100644 index 0000000000..4bf18006d9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/mappings/1-user.json @@ -0,0 +1,46 @@ +{ + "id": "33bf871a-36a1-40d2-8a85-93241987a09a", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 26 Feb 2021 21:01:19 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"55ec271927b9b427b6dc1946829a82631f592d13765bb00fa4015784b3ef58bd\"", + "last-modified": "Thu, 25 Feb 2021 18:01:06 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4989", + "X-RateLimit-Reset": "1614376173", + "x-ratelimit-used": "11", + "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": "E09B:19E1:19D5FB:1BB32E:6039619F" + } + }, + "uuid": "33bf871a-36a1-40d2-8a85-93241987a09a", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/mappings/2-r_h_ghcontentintegrationtest.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/mappings/2-r_h_ghcontentintegrationtest.json new file mode 100644 index 0000000000..3f77397607 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/mappings/2-r_h_ghcontentintegrationtest.json @@ -0,0 +1,46 @@ +{ + "id": "87a2df39-f7a4-4ab1-b525-18280943063b", + "name": "repos_hub4j-test-org_ghcontentintegrationtest", + "request": { + "url": "/repos/hub4j-test-org/GHContentIntegrationTest", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-r_h_ghcontentintegrationtest.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 26 Feb 2021 21:01:20 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"81f9a2e101e45e0cf1d1a6dad02a3cd1b7fade390acc969b0be9ecf5f9baf78f\"", + "last-modified": "Thu, 02 Jul 2020 15:49:49 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4985", + "X-RateLimit-Reset": "1614376173", + "x-ratelimit-used": "15", + "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": "E09B:19E1:19D680:1BB3AE:603961A0" + } + }, + "uuid": "87a2df39-f7a4-4ab1-b525-18280943063b", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/mappings/3-repositories_40763577.json b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/mappings/3-repositories_40763577.json new file mode 100644 index 0000000000..5964ef3619 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetRepositoryWithTemplateRepositoryInfo/mappings/3-repositories_40763577.json @@ -0,0 +1,49 @@ +{ + "id": "e70b6cc9-f74f-4912-8d68-a7f86ac02fc5", + "name": "repositories_40763577", + "request": { + "url": "/repositories/40763577", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-repositories_40763577.json", + "headers": { + "Server": "GitHub.com", + "Date": "Fri, 26 Feb 2021 21:01:21 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"81f9a2e101e45e0cf1d1a6dad02a3cd1b7fade390acc969b0be9ecf5f9baf78f\"", + "last-modified": "Thu, 02 Jul 2020 15:49:49 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, workflow, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1614376173", + "x-ratelimit-used": "16", + "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": "E09B:19E1:19D697:1BB3C7:603961A0" + } + }, + "uuid": "e70b6cc9-f74f-4912-8d68-a7f86ac02fc5", + "persistent": true, + "scenarioName": "scenario-1-repositories-40763577", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-1-repositories-40763577-2", + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryFromTemplateRepositoryNull/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryFromTemplateRepositoryNull/__files/1-user.json new file mode 100644 index 0000000000..70e9be6e40 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryFromTemplateRepositoryNull/__files/1-user.json @@ -0,0 +1,45 @@ +{ + "login": "bitwiseman", + "id": 1958958, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": "https://twitter.com/bitwiseman", + "public_repos": 167, + "public_gists": 4, + "followers": 136, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2019-09-24T19:32:29Z", + "private_gists": 7, + "total_private_repos": 9, + "owned_private_repos": 0, + "disk_usage": 33697, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryFromTemplateRepositoryNull/__files/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryFromTemplateRepositoryNull/__files/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..1676ccbc3e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryFromTemplateRepositoryNull/__files/2-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "login": "hub4j-test-org", + "id": 7544738, + "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": 9, + "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": 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": 3, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryFromTemplateRepositoryNull/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryFromTemplateRepositoryNull/mappings/1-user.json new file mode 100644 index 0000000000..ca5459676d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryFromTemplateRepositoryNull/mappings/1-user.json @@ -0,0 +1,48 @@ +{ + "id": "d246cfb6-e28a-417b-8d74-29080bbc1c4c", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Thu, 03 Oct 2019 21:18:42 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4904", + "X-RateLimit-Reset": "1570140015", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"cf6199fecf47b59c42190e1e11147ee2\"", + "Last-Modified": "Tue, 24 Sep 2019 19:32:29 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "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": "CAF1:9576:6B11BA:80379D:5D9665B2" + } + }, + "uuid": "d246cfb6-e28a-417b-8d74-29080bbc1c4c", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryFromTemplateRepositoryNull/mappings/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryFromTemplateRepositoryNull/mappings/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..de3ff58e47 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryFromTemplateRepositoryNull/mappings/2-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "7b0ac54c-1ef0-453a-99db-a480b3b5a746", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-orgs_hub4j-test-org.json", + "headers": { + "Date": "Thu, 03 Oct 2019 21:18:43 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4900", + "X-RateLimit-Reset": "1570140015", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"d36965e157281b2a309c39e4c2343a55\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "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": "CAF1:9576:6B11DD:8037AC:5D9665B2" + } + }, + "uuid": "7b0ac54c-1ef0-453a-99db-a480b3b5a746", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/__files/1-user.json new file mode 100644 index 0000000000..70e9be6e40 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/__files/1-user.json @@ -0,0 +1,45 @@ +{ + "login": "bitwiseman", + "id": 1958958, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": "https://twitter.com/bitwiseman", + "public_repos": 167, + "public_gists": 4, + "followers": 136, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2019-09-24T19:32:29Z", + "private_gists": 7, + "total_private_repos": 9, + "owned_private_repos": 0, + "disk_usage": 33697, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/__files/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/__files/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..1676ccbc3e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/__files/2-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "login": "hub4j-test-org", + "id": 7544738, + "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": 9, + "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": 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": 3, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/__files/3-r_h_github-api-template-test.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/__files/3-r_h_github-api-template-test.json new file mode 100644 index 0000000000..b6c2158047 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/__files/3-r_h_github-api-template-test.json @@ -0,0 +1,127 @@ +{ + "id": 292666372, + "node_id": "MDEwOlJlcG9zaXRvcnkyOTI2NjYzNzI=", + "name": "github-api-template-test", + "full_name": "hub4j-test-org/github-api-template-test", + "private": true, + "is_template": false, + "owner": { + "login": "hub4j-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/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j-test-org/github-api-template-test", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test", + "forks_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/deployments", + "created_at": "2020-09-03T19:52:43Z", + "updated_at": "2020-09-03T19:52:47Z", + "pushed_at": "2020-09-03T20:10:17Z", + "git_url": "git://github.com/hub4j-test-org/github-api-template-test.git", + "ssh_url": "git@github.com:hub4j-test-org/github-api-template-test.git", + "clone_url": "https://github.com/hub4j-test-org/github-api-template-test.git", + "svn_url": "https://github.com/hub4j-test-org/github-api-template-test", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "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": 2, + "license": null, + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "temp_clone_token": "AOXG3USUU2SCOPVPSMHSQWC7KFIGQ", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "delete_branch_on_merge": false, + "organization": { + "login": "hub4j-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/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "network_count": 0, + "subscribers_count": 7 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/__files/4-o_h_repos.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/__files/4-o_h_repos.json new file mode 100644 index 0000000000..3391461e58 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/__files/4-o_h_repos.json @@ -0,0 +1,124 @@ +{ + "id": 212682278, + "node_id": "MDEwOlJlcG9zaXRvcnkyMTI2ODIyNzA=", + "name": "github-api-test", + "full_name": "hub4j-test-org/github-api-test", + "private": false, + "owner": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "http://localhost:51951/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "http://localhost:51951/users/hub4j-test-org/followers", + "following_url": "http://localhost:51951/users/hub4j-test-org/following{/other_user}", + "gists_url": "http://localhost:51951/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "http://localhost:51951/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "http://localhost:51951/users/hub4j-test-org/subscriptions", + "organizations_url": "http://localhost:51951/users/hub4j-test-org/orgs", + "repos_url": "http://localhost:51951/users/hub4j-test-org/repos", + "events_url": "http://localhost:51951/users/hub4j-test-org/events{/privacy}", + "received_events_url": "http://localhost:51951/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j-test-org/github-api-test", + "description": "a test repository used to test kohsuke's github-api", + "fork": false, + "url": "http://localhost:51951/repos/hub4j-test-org/github-api-test", + "forks_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/forks", + "keys_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/keys{/key_id}", + "collaborators_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/collaborators{/collaborator}", + "teams_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/teams", + "hooks_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/hooks", + "issue_events_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/issues/events{/number}", + "events_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/events", + "assignees_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/assignees{/user}", + "branches_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/branches{/branch}", + "tags_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/tags", + "blobs_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/git/blobs{/sha}", + "git_tags_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/git/tags{/sha}", + "git_refs_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/git/refs{/sha}", + "trees_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/git/trees{/sha}", + "statuses_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/statuses/{sha}", + "languages_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/languages", + "stargazers_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/stargazers", + "contributors_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/contributors", + "subscribers_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/subscribers", + "subscription_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/subscription", + "commits_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/commits{/sha}", + "git_commits_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/git/commits{/sha}", + "comments_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/comments{/number}", + "issue_comment_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/issues/comments{/number}", + "contents_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/contents/{+path}", + "compare_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/compare/{base}...{head}", + "merges_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/merges", + "archive_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/{archive_format}{/ref}", + "downloads_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/downloads", + "issues_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/issues{/number}", + "pulls_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/pulls{/number}", + "milestones_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/milestones{/number}", + "notifications_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/notifications{?since,all,participating}", + "labels_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/labels{/name}", + "releases_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/releases{/id}", + "deployments_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/deployments", + "created_at": "2019-10-03T21:18:43Z", + "updated_at": "2019-10-03T21:18:43Z", + "pushed_at": "2019-10-03T21:18:44Z", + "git_url": "git://github.com/hub4j-test-org/github-api-test.git", + "ssh_url": "git@github.com:hub4j-test-org/github-api-test.git", + "clone_url": "https://github.com/hub4j-test-org/github-api-test.git", + "svn_url": "https://github.com/hub4j-test-org/github-api-test", + "homepage": "http://github-api.kohsuke.org/", + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "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": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "http://localhost:51951/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "http://localhost:51951/users/hub4j-test-org/followers", + "following_url": "http://localhost:51951/users/hub4j-test-org/following{/other_user}", + "gists_url": "http://localhost:51951/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "http://localhost:51951/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "http://localhost:51951/users/hub4j-test-org/subscriptions", + "organizations_url": "http://localhost:51951/users/hub4j-test-org/orgs", + "repos_url": "http://localhost:51951/users/hub4j-test-org/repos", + "events_url": "http://localhost:51951/users/hub4j-test-org/events{/privacy}", + "received_events_url": "http://localhost:51951/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "network_count": 0, + "subscribers_count": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/__files/5-r_h_g_readme.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/__files/5-r_h_g_readme.json new file mode 100644 index 0000000000..73c5006a27 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/__files/5-r_h_g_readme.json @@ -0,0 +1,18 @@ +{ + "name": "README.md", + "path": "README.md", + "sha": "aa0e9008d8d8c4745d81d718b5d418f6a5529759", + "size": 70, + "url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/contents/README.md?ref=main", + "html_url": "https://github.com/hub4j-test-org/github-api-template-test/blob/main/README.md", + "git_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/blobs/aa0e9008d8d8c4745d81d718b5d418f6a5529759", + "download_url": "https://raw.githubusercontent.com/hub4j-test-org/github-api-template-test/main/README.md", + "type": "file", + "content": "IyBnaXRodWItYXBpLXRlc3QKYSB0ZXN0IHJlcG9zaXRvcnkgdXNlZCB0byB0\nZXN0IGtvaHN1a2UncyBnaXRodWItYXBpCg==\n", + "encoding": "base64", + "_links": { + "self": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/contents/README.md?ref=main", + "git": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/blobs/aa0e9008d8d8c4745d81d718b5d418f6a5529759", + "html": "https://github.com/hub4j-test-org/github-api-template-test/blob/main/README.md" + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/mappings/1-user.json new file mode 100644 index 0000000000..ca5459676d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/mappings/1-user.json @@ -0,0 +1,48 @@ +{ + "id": "d246cfb6-e28a-417b-8d74-29080bbc1c4c", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Thu, 03 Oct 2019 21:18:42 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4904", + "X-RateLimit-Reset": "1570140015", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"cf6199fecf47b59c42190e1e11147ee2\"", + "Last-Modified": "Tue, 24 Sep 2019 19:32:29 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "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": "CAF1:9576:6B11BA:80379D:5D9665B2" + } + }, + "uuid": "d246cfb6-e28a-417b-8d74-29080bbc1c4c", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/mappings/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/mappings/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..de3ff58e47 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/mappings/2-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "7b0ac54c-1ef0-453a-99db-a480b3b5a746", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-orgs_hub4j-test-org.json", + "headers": { + "Date": "Thu, 03 Oct 2019 21:18:43 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4900", + "X-RateLimit-Reset": "1570140015", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"d36965e157281b2a309c39e4c2343a55\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "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": "CAF1:9576:6B11DD:8037AC:5D9665B2" + } + }, + "uuid": "7b0ac54c-1ef0-453a-99db-a480b3b5a746", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/mappings/3-r_h_github-api-template-test.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/mappings/3-r_h_github-api-template-test.json new file mode 100644 index 0000000000..954b6f234e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/mappings/3-r_h_github-api-template-test.json @@ -0,0 +1,46 @@ +{ + "id": "6d003fb4-376d-48a6-8522-4ac6a23a36ec", + "name": "repos_hub4j-test-org_github-api-template-test", + "request": { + "url": "/repos/hub4j-test-org/github-api-template-test", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-r_h_github-api-template-test.json", + "headers": { + "Date": "Thu, 03 Sep 2020 20:17:01 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"04d5c9c3e946c3ff62a1e036800d9144\"", + "Last-Modified": "Thu, 03 Sep 2020 19:52:47 GMT", + "X-GitHub-Media-Type": "unknown, github.v3", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4949", + "X-RateLimit-Reset": "1599165440", + "X-RateLimit-Used": "51", + "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": "B4D8:7A59:BA70290:E1ACCB7:5F514F3C" + } + }, + "uuid": "6d003fb4-376d-48a6-8522-4ac6a23a36ec", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/mappings/4-o_h_repos.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/mappings/4-o_h_repos.json new file mode 100644 index 0000000000..5e710778ac --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/mappings/4-o_h_repos.json @@ -0,0 +1,55 @@ +{ + "id": "423c774e-3d61-423a-ad0d-ee166bf2b4de", + "name": "orgs_hub4j-test-org_repos", + "request": { + "url": "/repos/hub4j-test-org/github-api-template-test/generate", + "method": "POST", + "bodyPatterns": [ + { + "equalToJson": "{\"name\":\"github-api-test\",\"owner\":\"hub4j-test-org\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ], + "headers": { + "Accept": { + "equalTo": "application/vnd.github.baptiste-preview+json" + } + } + }, + "response": { + "status": 201, + "bodyFileName": "4-o_h_repos.json", + "headers": { + "Date": "Thu, 03 Oct 2019 21:18:45 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4898", + "X-RateLimit-Reset": "1570140015", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "\"2b3e3ea59f28d3dadc92e7bb9aa81918\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "public_repo, repo", + "Location": "https://api.github.com/repos/hub4j-test-org/github-api-test", + "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": "CAF1:9576:6B11EA:8037CF:5D9665B3" + } + }, + "uuid": "423c774e-3d61-423a-ad0d-ee166bf2b4de", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/mappings/5-r_h_g_readme.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/mappings/5-r_h_g_readme.json new file mode 100644 index 0000000000..1a6c3e67a6 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWhenRepositoryTemplateIsNotATemplate/mappings/5-r_h_g_readme.json @@ -0,0 +1,48 @@ +{ + "id": "12092c16-85de-454a-80ae-61c283738838", + "name": "repos_hub4j-test-org_github-api-test_readme", + "request": { + "url": "/repos/hub4j-test-org/github-api-test/readme", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "5-r_h_g_readme.json", + "headers": { + "Date": "Thu, 03 Oct 2019 21:18:45 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4897", + "X-RateLimit-Reset": "1570140015", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"cabb44de69d6ea06b2d8ca4bb5b01405\"", + "Last-Modified": "Thu, 03 Oct 2019 21:18:44 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "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": "CAF1:9576:6B1234:803821:5D9665B5" + } + }, + "uuid": "12092c16-85de-454a-80ae-61c283738838", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/__files/1-user.json new file mode 100644 index 0000000000..3a0de9fb36 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/__files/1-user.json @@ -0,0 +1,45 @@ +{ + "login": "bitwiseman", + "id": 1958958, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": "https://twitter.com/bitwiseman", + "public_repos": 167, + "public_gists": 4, + "followers": 136, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2019-09-24T19:32:29Z", + "private_gists": 7, + "total_private_repos": 9, + "owned_private_repos": 0, + "disk_usage": 33697, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/__files/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/__files/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..604d86d901 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/__files/2-orgs_hub4j-test-org.json @@ -0,0 +1,41 @@ +{ + "login": "hub4j-test-org", + "id": 7544738, + "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": 9, + "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": 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": 3, + "seats": 0 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/__files/3-r_h_github-api-template-test.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/__files/3-r_h_github-api-template-test.json new file mode 100644 index 0000000000..b9ea109f52 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/__files/3-r_h_github-api-template-test.json @@ -0,0 +1,127 @@ +{ + "id": 292666372, + "node_id": "MDEwOlJlcG9zaXRvcnkyOTI2NjYzNzI=", + "name": "github-api-template-test", + "full_name": "hub4j-test-org/github-api-template-test", + "private": true, + "is_template": true, + "owner": { + "login": "hub4j-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/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j-test-org/github-api-template-test", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test", + "forks_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/forks", + "keys_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/teams", + "hooks_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/hooks", + "issue_events_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/events", + "assignees_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/tags", + "blobs_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/languages", + "stargazers_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/stargazers", + "contributors_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/contributors", + "subscribers_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/subscribers", + "subscription_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/subscription", + "commits_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/merges", + "archive_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/downloads", + "issues_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/labels{/name}", + "releases_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/deployments", + "created_at": "2020-09-03T19:52:43Z", + "updated_at": "2020-09-03T19:52:47Z", + "pushed_at": "2020-09-03T20:10:17Z", + "git_url": "git://github.com/hub4j-test-org/github-api-template-test.git", + "ssh_url": "git@github.com:hub4j-test-org/github-api-template-test.git", + "clone_url": "https://github.com/hub4j-test-org/github-api-template-test.git", + "svn_url": "https://github.com/hub4j-test-org/github-api-template-test", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "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": 2, + "license": null, + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "temp_clone_token": "AOXG3USUU2SCOPVPSMHSQWC7KFIGQ", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "delete_branch_on_merge": false, + "organization": { + "login": "hub4j-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/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "https://api.github.com/users/hub4j-test-org/followers", + "following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/hub4j-test-org/orgs", + "repos_url": "https://api.github.com/users/hub4j-test-org/repos", + "events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "network_count": 0, + "subscribers_count": 7 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/__files/4-o_h_repos.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/__files/4-o_h_repos.json new file mode 100644 index 0000000000..1de8be6bfd --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/__files/4-o_h_repos.json @@ -0,0 +1,124 @@ +{ + "id": 212682278, + "node_id": "MDEwOlJlcG9zaXRvcnkyMTI2ODIyNzA=", + "name": "github-api-test", + "full_name": "hub4j-test-org/github-api-test", + "private": false, + "owner": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "http://localhost:51951/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "http://localhost:51951/users/hub4j-test-org/followers", + "following_url": "http://localhost:51951/users/hub4j-test-org/following{/other_user}", + "gists_url": "http://localhost:51951/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "http://localhost:51951/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "http://localhost:51951/users/hub4j-test-org/subscriptions", + "organizations_url": "http://localhost:51951/users/hub4j-test-org/orgs", + "repos_url": "http://localhost:51951/users/hub4j-test-org/repos", + "events_url": "http://localhost:51951/users/hub4j-test-org/events{/privacy}", + "received_events_url": "http://localhost:51951/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/hub4j-test-org/github-api-test", + "description": "a test repository used to test kohsuke's github-api", + "fork": false, + "url": "http://localhost:51951/repos/hub4j-test-org/github-api-test", + "forks_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/forks", + "keys_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/keys{/key_id}", + "collaborators_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/collaborators{/collaborator}", + "teams_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/teams", + "hooks_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/hooks", + "issue_events_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/issues/events{/number}", + "events_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/events", + "assignees_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/assignees{/user}", + "branches_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/branches{/branch}", + "tags_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/tags", + "blobs_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/git/blobs{/sha}", + "git_tags_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/git/tags{/sha}", + "git_refs_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/git/refs{/sha}", + "trees_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/git/trees{/sha}", + "statuses_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/statuses/{sha}", + "languages_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/languages", + "stargazers_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/stargazers", + "contributors_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/contributors", + "subscribers_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/subscribers", + "subscription_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/subscription", + "commits_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/commits{/sha}", + "git_commits_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/git/commits{/sha}", + "comments_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/comments{/number}", + "issue_comment_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/issues/comments{/number}", + "contents_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/contents/{+path}", + "compare_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/compare/{base}...{head}", + "merges_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/merges", + "archive_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/{archive_format}{/ref}", + "downloads_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/downloads", + "issues_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/issues{/number}", + "pulls_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/pulls{/number}", + "milestones_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/milestones{/number}", + "notifications_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/notifications{?since,all,participating}", + "labels_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/labels{/name}", + "releases_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/releases{/id}", + "deployments_url": "http://localhost:51951/repos/hub4j-test-org/github-api-test/deployments", + "created_at": "2019-10-03T21:18:43Z", + "updated_at": "2019-10-03T21:18:43Z", + "pushed_at": "2019-10-03T21:18:44Z", + "git_url": "git://github.com/hub4j-test-org/github-api-test.git", + "ssh_url": "git@github.com:hub4j-test-org/github-api-test.git", + "clone_url": "https://github.com/hub4j-test-org/github-api-test.git", + "svn_url": "https://github.com/hub4j-test-org/github-api-test", + "homepage": "http://github-api.kohsuke.org/", + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "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": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "main", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "organization": { + "login": "hub4j-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "http://localhost:51951/users/hub4j-test-org", + "html_url": "https://github.com/hub4j-test-org", + "followers_url": "http://localhost:51951/users/hub4j-test-org/followers", + "following_url": "http://localhost:51951/users/hub4j-test-org/following{/other_user}", + "gists_url": "http://localhost:51951/users/hub4j-test-org/gists{/gist_id}", + "starred_url": "http://localhost:51951/users/hub4j-test-org/starred{/owner}{/repo}", + "subscriptions_url": "http://localhost:51951/users/hub4j-test-org/subscriptions", + "organizations_url": "http://localhost:51951/users/hub4j-test-org/orgs", + "repos_url": "http://localhost:51951/users/hub4j-test-org/repos", + "events_url": "http://localhost:51951/users/hub4j-test-org/events{/privacy}", + "received_events_url": "http://localhost:51951/users/hub4j-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "network_count": 0, + "subscribers_count": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/__files/5-r_h_g_readme.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/__files/5-r_h_g_readme.json new file mode 100644 index 0000000000..79b540414a --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/__files/5-r_h_g_readme.json @@ -0,0 +1,18 @@ +{ + "name": "README.md", + "path": "README.md", + "sha": "aa0e9008d8d8c4745d81d718b5d418f6a5529759", + "size": 70, + "url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/contents/README.md?ref=main", + "html_url": "https://github.com/hub4j-test-org/github-api-template-test/blob/main/README.md", + "git_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/blobs/aa0e9008d8d8c4745d81d718b5d418f6a5529759", + "download_url": "https://raw.githubusercontent.com/hub4j-test-org/github-api-template-test/main/README.md", + "type": "file", + "content": "IyBnaXRodWItYXBpLXRlc3QKYSB0ZXN0IHJlcG9zaXRvcnkgdXNlZCB0byB0\nZXN0IGtvaHN1a2UncyBnaXRodWItYXBpCg==\n", + "encoding": "base64", + "_links": { + "self": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/contents/README.md?ref=main", + "git": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/blobs/aa0e9008d8d8c4745d81d718b5d418f6a5529759", + "html": "https://github.com/hub4j-test-org/github-api-template-test/blob/main/README.md" + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/mappings/1-user.json new file mode 100644 index 0000000000..315722a138 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/mappings/1-user.json @@ -0,0 +1,48 @@ +{ + "id": "d246cfb6-e28a-417b-8d74-29080bbc1c4c", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Thu, 03 Oct 2019 21:18:42 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4904", + "X-RateLimit-Reset": "1570140015", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"cf6199fecf47b59c42190e1e11147ee2\"", + "Last-Modified": "Tue, 24 Sep 2019 19:32:29 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "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": "CAF1:9576:6B11BA:80379D:5D9665B2" + } + }, + "uuid": "d246cfb6-e28a-417b-8d74-29080bbc1c4c", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/mappings/2-orgs_hub4j-test-org.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/mappings/2-orgs_hub4j-test-org.json new file mode 100644 index 0000000000..962f665342 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/mappings/2-orgs_hub4j-test-org.json @@ -0,0 +1,48 @@ +{ + "id": "7b0ac54c-1ef0-453a-99db-a480b3b5a746", + "name": "orgs_hub4j-test-org", + "request": { + "url": "/orgs/hub4j-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-orgs_hub4j-test-org.json", + "headers": { + "Date": "Thu, 03 Oct 2019 21:18:43 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4900", + "X-RateLimit-Reset": "1570140015", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"d36965e157281b2a309c39e4c2343a55\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "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": "CAF1:9576:6B11DD:8037AC:5D9665B2" + } + }, + "uuid": "7b0ac54c-1ef0-453a-99db-a480b3b5a746", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/mappings/3-r_h_github-api-template-test.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/mappings/3-r_h_github-api-template-test.json new file mode 100644 index 0000000000..c8d7ebf5ec --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/mappings/3-r_h_github-api-template-test.json @@ -0,0 +1,46 @@ +{ + "id": "6d003fb4-376d-48a6-8522-4ac6a23a36ec", + "name": "repos_hub4j-test-org_github-api-template-test", + "request": { + "url": "/repos/hub4j-test-org/github-api-template-test", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-r_h_github-api-template-test.json", + "headers": { + "Date": "Thu, 03 Sep 2020 20:17:01 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With", + "Accept-Encoding" + ], + "ETag": "W/\"04d5c9c3e946c3ff62a1e036800d9144\"", + "Last-Modified": "Thu, 03 Sep 2020 19:52:47 GMT", + "X-GitHub-Media-Type": "unknown, github.v3", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4949", + "X-RateLimit-Reset": "1599165440", + "X-RateLimit-Used": "51", + "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": "B4D8:7A59:BA70290:E1ACCB7:5F514F3C" + } + }, + "uuid": "6d003fb4-376d-48a6-8522-4ac6a23a36ec", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/mappings/4-o_h_repos.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/mappings/4-o_h_repos.json new file mode 100644 index 0000000000..6eee87673c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/mappings/4-o_h_repos.json @@ -0,0 +1,55 @@ +{ + "id": "423c774e-3d61-423a-ad0d-ee166bf2b4de", + "name": "orgs_hub4j-test-org_repos", + "request": { + "url": "/repos/hub4j-test-org/github-api-template-test/generate", + "method": "POST", + "bodyPatterns": [ + { + "equalToJson": "{\"name\":\"github-api-test\",\"owner\":\"hub4j-test-org\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ], + "headers": { + "Accept": { + "equalTo": "application/vnd.github.baptiste-preview+json" + } + } + }, + "response": { + "status": 201, + "bodyFileName": "4-o_h_repos.json", + "headers": { + "Date": "Thu, 03 Oct 2019 21:18:45 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4898", + "X-RateLimit-Reset": "1570140015", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "\"2b3e3ea59f28d3dadc92e7bb9aa81918\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "public_repo, repo", + "Location": "https://api.github.com/repos/hub4j-test-org/github-api-test", + "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": "CAF1:9576:6B11EA:8037CF:5D9665B3" + } + }, + "uuid": "423c774e-3d61-423a-ad0d-ee166bf2b4de", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/mappings/5-r_h_g_readme.json b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/mappings/5-r_h_g_readme.json new file mode 100644 index 0000000000..8d2485dda3 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHOrganizationTest/wiremock/testCreateRepositoryWithTemplateAndGHRepository/mappings/5-r_h_g_readme.json @@ -0,0 +1,48 @@ +{ + "id": "12092c16-85de-454a-80ae-61c283738838", + "name": "repos_hub4j-test-org_github-api-test_readme", + "request": { + "url": "/repos/hub4j-test-org/github-api-test/readme", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.v3+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "5-r_h_g_readme.json", + "headers": { + "Date": "Thu, 03 Oct 2019 21:18:45 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4897", + "X-RateLimit-Reset": "1570140015", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding" + ], + "ETag": "W/\"cabb44de69d6ea06b2d8ca4bb5b01405\"", + "Last-Modified": "Thu, 03 Oct 2019 21:18:44 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "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": "CAF1:9576:6B1234:803821:5D9665B5" + } + }, + "uuid": "12092c16-85de-454a-80ae-61c283738838", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file