Search in sources :

Example 16 with Category

use of org.rembx.jeeshop.catalog.model.Category in project jeeshop by remibantos.

the class CategoriesCT method find_withIdOfVisibleCategory_ShouldReturnExpectedCategory.

@Test
public void find_withIdOfVisibleCategory_ShouldReturnExpectedCategory() {
    tester.setAdminUser();
    Category category = localService.find(tester.getSecurityContext(), tester.getFixtures().aCategoryWithProducts().getId(), null);
    assertThat(category).isEqualTo(tester.getFixtures().aCategoryWithProducts());
    assertThat(category.isVisible()).isTrue();
}
Also used : Category(org.rembx.jeeshop.catalog.model.Category) Test(org.junit.jupiter.api.Test)

Example 17 with Category

use of org.rembx.jeeshop.catalog.model.Category in project jeeshop by remibantos.

the class CategoriesCT method delete_NonManagedEntry_shouldThrowForbiddenEx.

@Test
public void delete_NonManagedEntry_shouldThrowForbiddenEx() {
    try {
        tester.setStoreAdminUser();
        Category category = new Category("Test category", "");
        category.setOwner("test@test.com");
        tester.test_delete(category);
        fail("should have thrown ex");
    } catch (WebApplicationException e) {
        assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.FORBIDDEN);
    }
}
Also used : Category(org.rembx.jeeshop.catalog.model.Category) WebApplicationException(org.rembx.jeeshop.rest.WebApplicationException) Test(org.junit.jupiter.api.Test)

Aggregations

Category (org.rembx.jeeshop.catalog.model.Category)17 Test (org.junit.jupiter.api.Test)12 ArrayList (java.util.ArrayList)4 Catalog (org.rembx.jeeshop.catalog.model.Catalog)4 WebApplicationException (org.rembx.jeeshop.rest.WebApplicationException)4 Date (java.util.Date)2 PermitAll (javax.annotation.security.PermitAll)2 RolesAllowed (javax.annotation.security.RolesAllowed)2 Transactional (javax.transaction.Transactional)1 Test (org.junit.Test)1