use of io.jenkins.blueocean.rest.model.BlueScmConfig in project blueocean-plugin by jenkinsci.
the class GithubPipelineCreateRequestTest method createPipelineNoJenkinsFile.
@Test
public void createPipelineNoJenkinsFile() throws UnirestException, IOException {
// AbstractMultiBranchCreateRequest.JenkinsfileCriteria criteria = Mockito.mock(AbstractMultiBranchCreateRequest.JenkinsfileCriteria.class);
// when(criteria.isJenkinsfileFound()).thenReturn(true);
OrganizationImpl organization = new OrganizationImpl("jenkins", j.jenkins);
String credentialId = createGithubCredential(user);
JSONObject config = JSONObject.fromObject(MapsHelper.of("repoOwner", "vivek", "repository", "empty1"));
GithubPipelineCreateRequest request = new GithubPipelineCreateRequest("empty1", new BlueScmConfig(GithubScm.ID, githubApiUrl, credentialId, config));
request.create(organization, organization);
// verify(criteria, atLeastOnce()).isJenkinsfileFound();
}
use of io.jenkins.blueocean.rest.model.BlueScmConfig in project blueocean-plugin by jenkinsci.
the class GithubPipelineCreateRequestTest method shouldFailCreatePipelineNoJenkinsFile.
@Test
public void shouldFailCreatePipelineNoJenkinsFile() throws UnirestException, IOException {
boolean thrown = false;
OrganizationImpl organization = new OrganizationImpl("jenkins", j.jenkins);
String credentialId = createGithubCredential(user);
JSONObject config = JSONObject.fromObject(MapsHelper.of("repoOwner", "vivek", "repository", "empty1"));
GithubPipelineCreateRequest request = new GithubPipelineCreateRequest("empty1/empty2", new BlueScmConfig(GithubScm.ID, githubApiUrl, credentialId, config));
try {
request.create(organization, organization);
} catch (ServiceException.BadRequestException e) {
thrown = true;
}
assertTrue(thrown);
}
Aggregations