Merge pull request #897 from bonnie-young/add-create-repo-with-template-support

add create repo with template support
This commit is contained in:
Liam Newman
2020-08-12 08:43:17 -07:00
committed by GitHub
23 changed files with 1091 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ import java.util.List;
public class GHOrganizationTest extends AbstractGitHubWireMockTest {
public static final String GITHUB_API_TEST = "github-api-test";
public static final String GITHUB_API_TEMPLATE_TEST = "github-api-template-test";
public static final String TEAM_NAME_CREATE = "create-team-test";
@Before
@@ -56,6 +57,36 @@ public class GHOrganizationTest extends AbstractGitHubWireMockTest {
Assert.assertNotNull(repository.getReadme());
}
@Test
public void testCreateRepositoryWithParameterIsTemplate() throws IOException {
cleanupRepository(GITHUB_API_TEST_ORG + '/' + GITHUB_API_TEST);
GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG);
GHRepository repository = org.createRepository(GITHUB_API_TEMPLATE_TEST)
.description("a test template repository used to test kohsuke's github-api")
.homepage("http://github-api.kohsuke.org/")
.team(org.getTeamByName("Core Developers"))
.autoInit(true)
.templateRepository(true)
.create();
Assert.assertNotNull(repository);
Assert.assertNotNull(repository.getReadme());
}
@Test
public void testCreateRepositoryWithTemplate() throws IOException {
cleanupRepository(GITHUB_API_TEST_ORG + '/' + GITHUB_API_TEST);
GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG);
GHRepository repository = org.createRepository(GITHUB_API_TEST)
.fromTemplateRepository(GITHUB_API_TEST_ORG, GITHUB_API_TEMPLATE_TEST)
.owner(GITHUB_API_TEST_ORG)
.create();
Assert.assertNotNull(repository);
Assert.assertNotNull(repository.getReadme());
}
@Test
public void testInviteUser() throws IOException {
GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG);