use of org.rembx.jeeshop.catalog.model.SKU in project jeeshop by remibantos.
the class SKUsCT method delete_shouldRemove.
@Test
public void delete_shouldRemove() {
entityManager.getTransaction().begin();
SKU sku = new SKU("Test", "", null, null, null, null, null, null, null);
entityManager.persist(sku);
entityManager.getTransaction().commit();
entityManager.getTransaction().begin();
service.delete(sku.getId());
entityManager.getTransaction().commit();
assertThat(entityManager.find(SKU.class, sku.getId())).isNull();
}
use of org.rembx.jeeshop.catalog.model.SKU in project jeeshop by remibantos.
the class SKUsCT method delete_shouldThrow_Forbidden_for_store_Admin.
@Test
public void delete_shouldThrow_Forbidden_for_store_Admin() {
try {
tester.setStoreAdminUser();
SKU sku = new SKU("Test", "");
sku.setOwner("test@test.org");
tester.test_delete(sku);
fail("should have throw an exception");
} 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_store_Admin.
@Test
public void delete_shouldRemove_for_store_Admin() {
tester.setStoreAdminUser();
SKU sku = new SKU("Test", "");
sku.setOwner(TestCatalog.OWNER);
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_shouldPersistAndAttachOwner_for_store_admin.
@Test
public void create_shouldPersistAndAttachOwner_for_store_admin() {
tester.setStoreAdminUser();
SKU sku = new SKU("name", "description", 1.0, 2, "reference", new Date(), new Date(), false, 1, null);
SKU createdSKU = tester.test_create(sku);
assertThat(createdSKU).isNotNull();
assertThat(createdSKU.getOwner()).isEqualTo(TestCatalog.OWNER);
}
use of org.rembx.jeeshop.catalog.model.SKU in project jeeshop by remibantos.
the class SKUsCT method create_shouldPersistAndAttachOwner_for_admin.
@Test
public void create_shouldPersistAndAttachOwner_for_admin() {
tester.setAdminUser();
SKU sku = new SKU("name", "description", 1.0, 2, "reference", new Date(), new Date(), false, 1, "test@test.com");
SKU createdSKU = tester.test_create(sku);
assertThat(createdSKU).isNotNull();
assertThat(createdSKU.getOwner()).isEqualTo("test@test.com");
}
Aggregations