use of io.gravitee.rest.api.portal.rest.model.PagesResponse in project gravitee-management-rest-api by gravitee-io.
the class PagesResourceTest method shouldGetNoPageIfAuthorizeAndNotPublished.
@Test
public void shouldGetNoPageIfAuthorizeAndNotPublished() {
doReturn(Collections.emptyList()).when(pageService).search(any(), isNull(), eq(GraviteeContext.getCurrentEnvironment()));
Response response = target().request().get();
assertEquals(OK_200, response.getStatus());
PagesResponse pagesResponse = response.readEntity(PagesResponse.class);
List<Page> pages = pagesResponse.getData();
assertNotNull(pages);
assertEquals(0, pages.size());
}
use of io.gravitee.rest.api.portal.rest.model.PagesResponse in project gravitee-management-rest-api by gravitee-io.
the class PagesResourceTest method shouldGetNoPageIfNotAuthorizeAndPublishedPageAndNotSystemFolder.
@Test
public void shouldGetNoPageIfNotAuthorizeAndPublishedPageAndNotSystemFolder() {
PageEntity publishedPage = new PageEntity();
publishedPage.setPublished(true);
doReturn(singletonList(publishedPage)).when(pageService).search(any(), isNull(), eq(GraviteeContext.getCurrentEnvironment()));
Response response = target().request().get();
assertEquals(OK_200, response.getStatus());
PagesResponse pagesResponse = response.readEntity(PagesResponse.class);
List<Page> pages = pagesResponse.getData();
assertNotNull(pages);
assertEquals(0, pages.size());
}
use of io.gravitee.rest.api.portal.rest.model.PagesResponse in project gravitee-management-rest-api by gravitee-io.
the class PagesResourceTest method shouldGetPagesIfAuthorizeAndPublishedPageAndNotSystemFolder.
@Test
public void shouldGetPagesIfAuthorizeAndPublishedPageAndNotSystemFolder() {
PageEntity publishedPage = new PageEntity();
publishedPage.setPublished(true);
PageEntity markdownTemplatePage = new PageEntity();
markdownTemplatePage.setPublished(true);
markdownTemplatePage.setType(PageType.MARKDOWN_TEMPLATE.name());
doReturn(Arrays.asList(publishedPage, markdownTemplatePage)).when(pageService).search(any(), isNull(), eq(GraviteeContext.getCurrentEnvironment()));
when(accessControlService.canAccessPageFromPortal(any(PageEntity.class))).thenAnswer(invocationOnMock -> {
PageEntity page = invocationOnMock.getArgument(0);
return !PageType.MARKDOWN_TEMPLATE.name().equals(page.getType());
});
final Response response = target().request().get();
assertEquals(OK_200, response.getStatus());
final PagesResponse pagesResponse = response.readEntity(PagesResponse.class);
List<Page> pages = pagesResponse.getData();
assertNotNull(pages);
assertEquals(1, pages.size());
assertNotNull(pages.get(0).getLinks());
}
use of io.gravitee.rest.api.portal.rest.model.PagesResponse in project gravitee-management-rest-api by gravitee-io.
the class PagesResourceTest method shouldGetNoPageIfAuthorizeAndPublishedPageAndSystemFolder.
@Test
public void shouldGetNoPageIfAuthorizeAndPublishedPageAndSystemFolder() {
PageEntity publishedPage = new PageEntity();
publishedPage.setPublished(true);
publishedPage.setType("SYSTEM_FOLDER");
doReturn(singletonList(publishedPage)).when(pageService).search(any(), isNull(), eq(GraviteeContext.getCurrentEnvironment()));
Response response = target().request().get();
assertEquals(OK_200, response.getStatus());
PagesResponse pagesResponse = response.readEntity(PagesResponse.class);
List<Page> pages = pagesResponse.getData();
assertNotNull(pages);
assertEquals(0, pages.size());
}
Aggregations