use of org.jvnet.hudson.test.MockFolder in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method findAllPipelineTest.
@Test
public void findAllPipelineTest() throws IOException, ExecutionException, InterruptedException {
MockFolder folder1 = j.createFolder("folder1");
j.createFolder("afolder");
Project p1 = folder1.createProject(FreeStyleProject.class, "test1");
MockFolder folder2 = folder1.createProject(MockFolder.class, "folder2");
folder1.createProject(MockFolder.class, "folder3");
folder2.createProject(FreeStyleProject.class, "test2");
FreeStyleBuild b1 = (FreeStyleBuild) p1.scheduleBuild2(0).get();
List<Map> resp = get("/search?q=type:pipeline", List.class);
assertEquals(6, resp.size());
}
use of org.jvnet.hudson.test.MockFolder in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method PipelineSecureWithLoggedInUserPermissionTest.
@Test
public void PipelineSecureWithLoggedInUserPermissionTest() throws IOException, UnirestException {
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
hudson.model.User user = j.jenkins.getUser("alice");
user.setFullName("Alice Cooper");
MockFolder folder = j.createFolder("folder1");
Project p = folder.createProject(FreeStyleProject.class, "test1");
String token = getJwtToken(j.jenkins, "alice", "alice");
assertNotNull(token);
Map response = new RequestBuilder(baseUrl).get("/organizations/jenkins/pipelines/folder1/pipelines/test1").jwtToken(token).build(Map.class);
validatePipeline(p, response);
Map<String, Boolean> permissions = (Map<String, Boolean>) response.get("permissions");
assertTrue(permissions.get("create"));
assertTrue(permissions.get("start"));
assertTrue(permissions.get("stop"));
assertTrue(permissions.get("read"));
}
Aggregations