use of org.rembx.jeeshop.catalog.model.Discount in project jeeshop by remibantos.
the class DiscountsCT method delete_shouldRemove_for_admin.
@Test
public void delete_shouldRemove_for_admin() {
tester.setAdminUser();
Discount discount = new Discount("discount888", "a discount", ORDER, DISCOUNT_RATE, QUANTITY, null, 0.1, 2.0, 1, true, null, null, false, "test@test.com");
tester.test_delete(discount);
assertThat(tester.getEntityManager().find(Discount.class, discount.getId())).isNull();
}
use of org.rembx.jeeshop.catalog.model.Discount in project jeeshop by remibantos.
the class DiscountsCT method create_shouldPersist_for_admin_user.
@Test
public void create_shouldPersist_for_admin_user() {
tester.setAdminUser();
Discount discount = new Discount("discount777", "a discount", ORDER, DISCOUNT_RATE, AMOUNT, null, 0.1, 2.0, 1, true, null, null, false, "test@test.com");
Discount createdDiscount = tester.test_create(discount);
assertThat(createdDiscount).isNotNull();
assertThat(createdDiscount.getOwner()).isEqualTo("test@test.com");
}
use of org.rembx.jeeshop.catalog.model.Discount in project jeeshop by remibantos.
the class DiscountsCT method find_withIdOfVisibleDiscount_ShouldReturnExpectedDiscount.
@Test
public void find_withIdOfVisibleDiscount_ShouldReturnExpectedDiscount() {
Discount catalogItem = localService.find(tester.getSecurityContext(), tester.getFixtures().aVisibleDisount().getId(), null);
assertThat(catalogItem).isEqualTo(tester.getFixtures().aVisibleDisount());
assertThat(catalogItem.isVisible()).isTrue();
}
use of org.rembx.jeeshop.catalog.model.Discount in project jeeshop by remibantos.
the class DiscountsCT method delete_shouldRemove_for_store_admin.
@Test
public void delete_shouldRemove_for_store_admin() {
tester.setStoreAdminUser();
Discount discount = new Discount("discount888", "a discount", ORDER, DISCOUNT_RATE, QUANTITY, null, 0.1, 2.0, 1, true, null, null, false, TestCatalog.OWNER);
tester.test_delete(discount);
assertThat(tester.getEntityManager().find(Discount.class, discount.getId())).isNull();
}
use of org.rembx.jeeshop.catalog.model.Discount in project jeeshop by remibantos.
the class DiscountsCT method delete_shouldThrowForbiddenException_for_store_admin.
@Test
public void delete_shouldThrowForbiddenException_for_store_admin() {
try {
tester.setStoreAdminUser();
Discount discount = new Discount("discount888", "a discount", ORDER, DISCOUNT_RATE, QUANTITY, null, 0.1, 2.0, 1, true, null, null, false, "test@test.com");
tester.test_delete(discount);
fail("Should have throw an exception");
} catch (WebApplicationException e) {
assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.FORBIDDEN);
}
}
Aggregations