Search in sources :

Example 21 with Catalog

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

the class CatalogsCT method modifyCatalog_ShouldModifyCatalogAttributesAndPreserveRootCategoriesWhenNotProvided.

@Test
public void modifyCatalog_ShouldModifyCatalogAttributesAndPreserveRootCategoriesWhenNotProvided() {
    tester.setStoreAdminUser();
    Catalog detachedCatalogToModify = new Catalog(2L, "New name");
    tester.test_modify(detachedCatalogToModify);
    assertThat(detachedCatalogToModify.getName()).isEqualTo("New name");
    assertThat(detachedCatalogToModify.getRootCategories()).isNotEmpty();
}
Also used : Catalog(org.rembx.jeeshop.catalog.model.Catalog) TestCatalog(org.rembx.jeeshop.catalog.test.TestCatalog) Test(org.junit.jupiter.api.Test)

Example 22 with Catalog

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

the class CatalogsCT method modifyNonManagedCatalog_ShouldThrowForbiddenException.

@Test
public void modifyNonManagedCatalog_ShouldThrowForbiddenException() {
    tester.setSAnotherStoreAdminUser();
    Catalog detachedCatalogToModify = new Catalog(1L, "name");
    try {
        tester.test_modify(detachedCatalogToModify);
        fail("should have thrown ex");
    } catch (WebApplicationException e) {
        assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.FORBIDDEN);
    }
}
Also used : WebApplicationException(org.rembx.jeeshop.rest.WebApplicationException) Catalog(org.rembx.jeeshop.catalog.model.Catalog) TestCatalog(org.rembx.jeeshop.catalog.test.TestCatalog) Test(org.junit.jupiter.api.Test)

Aggregations

Catalog (org.rembx.jeeshop.catalog.model.Catalog)22 Test (org.junit.jupiter.api.Test)10 TestCatalog (org.rembx.jeeshop.catalog.test.TestCatalog)10 WebApplicationException (org.rembx.jeeshop.rest.WebApplicationException)9 RolesAllowed (javax.annotation.security.RolesAllowed)7 ArrayList (java.util.ArrayList)6 PermitAll (javax.annotation.security.PermitAll)4 Category (org.rembx.jeeshop.catalog.model.Category)4 Transactional (javax.transaction.Transactional)3 Store (org.rembx.jeeshop.catalog.model.Store)2 Test (org.junit.Test)1 Presentation (org.rembx.jeeshop.catalog.model.Presentation)1