use of io.gravitee.rest.api.model.NewPageEntity in project gravitee-management-rest-api by gravitee-io.
the class PortalPagesResourceAdminTest method shouldNotCreateSystemFolder.
@Test
public void shouldNotCreateSystemFolder() {
NewPageEntity newPageEntity = new NewPageEntity();
newPageEntity.setType(PageType.SYSTEM_FOLDER);
final Response response = envTarget().request().post(Entity.json(newPageEntity));
assertEquals(BAD_REQUEST_400, response.getStatus());
}
use of io.gravitee.rest.api.model.NewPageEntity in project gravitee-management-rest-api by gravitee-io.
the class PortalPagesResourceAdminTest method shouldCreatePortalPage.
@Test
public void shouldCreatePortalPage() {
reset(pageService);
NewPageEntity newPageEntity = new NewPageEntity();
newPageEntity.setName("my-page-name");
newPageEntity.setType(PageType.MARKDOWN);
newPageEntity.setVisibility(Visibility.PUBLIC);
PageEntity returnedPage = new PageEntity();
returnedPage.setId("my-beautiful-page");
doReturn(returnedPage).when(pageService).createPage(any(), eq(GraviteeContext.getCurrentEnvironment()));
doReturn(0).when(pageService).findMaxPortalPageOrder(eq(GraviteeContext.getCurrentEnvironment()));
final Response response = envTarget().request().post(Entity.json(newPageEntity));
assertEquals(HttpStatusCode.CREATED_201, response.getStatus());
assertEquals(envTarget().path("my-beautiful-page").getUri().toString(), response.getHeaders().getFirst(HttpHeaders.LOCATION));
}
Aggregations