mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-04 08:21:23 +00:00
Merge pull request #897 from bonnie-young/add-create-repo-with-template-support
add create repo with template support
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user