use of org.rembx.jeeshop.catalog.model.SKU in project jeeshop by remibantos.
the class SKUsCT method modify_ShouldThrowForbiddenException_for_store_admin.
@Test
public void modify_ShouldThrowForbiddenException_for_store_admin() {
tester.setSAnotherStoreAdminUser();
SKU sku = new SKU(tester.getFixtures().aVisibleSKU().getId(), "New name");
try {
tester.test_modify(sku);
;
fail("should have thrown ex");
} catch (WebApplicationException e) {
assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.FORBIDDEN);
}
}
use of org.rembx.jeeshop.catalog.model.SKU in project jeeshop by remibantos.
the class SKUsCT method delete_shouldRemove_for_admin.
@Test
public void delete_shouldRemove_for_admin() {
tester.setAdminUser();
SKU sku = new SKU("Test", "");
sku.setOwner("an@owner.fr");
tester.test_delete(sku);
assertThat(tester.getEntityManager().find(SKU.class, sku.getId())).isNull();
}
use of org.rembx.jeeshop.catalog.model.SKU in project jeeshop by remibantos.
the class SKUsCT method create_shouldThrow_BadRequest_for_Admin.
@Test
public void create_shouldThrow_BadRequest_for_Admin() {
try {
tester.setAdminUser();
SKU sku = new SKU("Test", "");
tester.test_create(sku);
fail("should have throw an exception");
} catch (WebApplicationException e) {
assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.BAD_REQUEST);
}
}
use of org.rembx.jeeshop.catalog.model.SKU in project jeeshop by remibantos.
the class SKUsCT method modifyUnknownSKU_ShouldThrowNotFoundException.
@Test
public void modifyUnknownSKU_ShouldThrowNotFoundException() {
SKU detachedProductToModify = new SKU(9999L, null, null, null, null, null, null, null, null, null);
try {
localService.modify(tester.getSecurityContext(), detachedProductToModify);
fail("should have thrown ex");
} catch (WebApplicationException e) {
assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
}
}
use of org.rembx.jeeshop.catalog.model.SKU in project jeeshop by remibantos.
the class SKUsCT method find_withIdOfVisibleSKU_ShouldReturnExpectedSKU.
@Test
public void find_withIdOfVisibleSKU_ShouldReturnExpectedSKU() {
SKU catalogItem = localService.find(tester.getSecurityContext(), tester.getFixtures().aVisibleSKU().getId(), null);
assertThat(catalogItem).isEqualTo(tester.getFixtures().aVisibleSKU());
assertThat(catalogItem.isVisible()).isTrue();
}
Aggregations