Package in.partake.controller

Examples of in.partake.controller.ActionProxy


        assertResultInvalid(proxy, UserErrorCode.MISSING_COMMENT);
    }

    @Test
    public void testToCommentWithTooLongComment() throws Exception {
        ActionProxy proxy = getActionProxy(POST, "/api/event/postComment");
        loginAs(proxy, TestDataProvider.EVENT_OWNER_ID);

        StringBuffer buffer = new StringBuffer();
        for (int i = 0; i < PostCommentAPI.MAX_COMMENT_LENGTH * 2; ++i)
            buffer.append((char)((i % 26) + 'a'));

        addValidSessionTokenToParameter(proxy);
        addFormParameter(proxy, "eventId", TestDataProvider.DEFAULT_EVENT_ID);
        addFormParameter(proxy, "comment", buffer.toString());

        proxy.execute();
        assertResultInvalid(proxy, UserErrorCode.INVALID_COMMENT_TOOLONG);
    }
View Full Code Here


import in.partake.controller.ActionProxy;

public class RemoveAPITest extends APIControllerTest {
    @Test
    public void testToRemove() throws Exception {
        ActionProxy proxy = getActionProxy(POST, "/api/event/remove");
        loginAs(proxy, EVENT_OWNER_ID);
        addParameter(proxy, "eventId", DEFAULT_EVENT_ID);
        addValidSessionTokenToParameter(proxy);

        proxy.execute();
        assertResultOK(proxy);
    }
View Full Code Here

        assertResultOK(proxy);
    }

    @Test
    public void testToRemoveByEventEditor() throws Exception {
        ActionProxy proxy = getActionProxy(POST, "/api/event/remove");
        loginAs(proxy, EVENT_EDITOR_ID);
        addParameter(proxy, "eventId", DEFAULT_EVENT_ID);
        addValidSessionTokenToParameter(proxy);

        proxy.execute();
        assertResultForbidden(proxy);
    }
View Full Code Here

        assertResultForbidden(proxy);
    }

    @Test
    public void testToRemoveWithoutValidSessionToken() throws Exception {
        ActionProxy proxy = getActionProxy(POST, "/api/event/remove");
        loginAs(proxy, EVENT_OWNER_ID);
        addParameter(proxy, "eventId", DEFAULT_EVENT_ID);

        proxy.execute();
        assertResultInvalid(proxy, UserErrorCode.INVALID_SECURITY_CSRF);
    }
View Full Code Here

        assertResultInvalid(proxy, UserErrorCode.INVALID_SECURITY_CSRF);
    }

    @Test
    public void testToRemoveWithoutLogin() throws Exception {
        ActionProxy proxy = getActionProxy(POST, "/api/event/remove");
        addParameter(proxy, "eventId", DEFAULT_EVENT_ID);

        proxy.execute();
        assertResultLoginRequired(proxy);
    }
View Full Code Here

        assertResultLoginRequired(proxy);
    }

    @Test
    public void testToRemoveWithalidSessionToken() throws Exception {
        ActionProxy proxy = getActionProxy(POST, "/api/event/remove");
        loginAs(proxy, EVENT_OWNER_ID);
        addParameter(proxy, "eventId", INVALID_EVENT_ID);
        addValidSessionTokenToParameter(proxy);

        proxy.execute();
        assertResultInvalid(proxy, UserErrorCode.INVALID_EVENT_ID);
    }
View Full Code Here

public class ModifyTicketAPITest extends APIControllerTest {

    @Test
    public void testToModifyTicket() throws Exception {
        ActionProxy proxy = getActionProxy(POST, API_EVENT_MODIFY_TICKET);
        loginAs(proxy, EVENT_OWNER_ID);
        addValidSessionTokenToParameter(proxy);

        addFormParameter(proxy, "eventId", UNPUBLISHED_EVENT_ID);
        addFormParameter(proxy, "id[]", new String[] { "" });
        addFormParameter(proxy, "name[]", new String[] { "name" });
        addFormParameter(proxy, "applicationStart[]", new String[] { "anytime" });
        addFormParameter(proxy, "applicationStartDayBeforeEvent[]", new String[] { "0" });
        addFormParameter(proxy, "customApplicationStartDate[]", new String[] { "2012-01-01 00:00" });
        addFormParameter(proxy, "applicationEnd[]", new String[] { "till_time_before_event" });
        addFormParameter(proxy, "applicationEndDayBeforeEvent[]", new String[] { "0" });
        addFormParameter(proxy, "customApplicationEndDate[]", new String[] { "2012-01-01 00:00" });
        addFormParameter(proxy, "reservationEnd[]", new String[] { "till_time_before_application" });
        addFormParameter(proxy, "reservationEndHourBeforeApplication[]", new String[] { "0" });
        addFormParameter(proxy, "customReservationEndDate[]", new String[] { "2012-01-01 00:00" });
        addFormParameter(proxy, "priceType[]", new String[] { "free" });
        addFormParameter(proxy, "price[]", new String[] { "0" });
        addFormParameter(proxy, "amountType[]", new String[] { "unlimited" });
        addFormParameter(proxy, "amount[]", new String[] { "0" });

        proxy.execute();
        assertResultOK(proxy);

        EventEx modified = loadEventEx(UNPUBLISHED_EVENT_ID);
        List<EventTicket> tickets = modified.getTickets();
View Full Code Here

        assertThat(tickets.get(0).getAmountType(), is(TicketAmountType.UNLIMITED));
    }

    @Test
    public void shouldModifyTicketAmountForUnpublishedEvent() throws Exception {
        ActionProxy proxy = getActionProxy(POST, API_EVENT_MODIFY_TICKET);
        loginAs(proxy, EVENT_OWNER_ID);
        addValidSessionTokenToParameter(proxy);

        addFormParameter(proxy, "eventId", UNPUBLISHED_EVENT_ID);
        addFormParameter(proxy, "id[]", new String[] { UNPUBLISHED_EVENT_TICKET_ID.toString() });
        addFormParameter(proxy, "name[]", new String[] { "name" });
        addFormParameter(proxy, "applicationStart[]", new String[] { "anytime" });
        addFormParameter(proxy, "applicationStartDayBeforeEvent[]", new String[] { "0" });
        addFormParameter(proxy, "customApplicationStartDate[]", new String[] { "2012-01-01 00:00" });
        addFormParameter(proxy, "applicationEnd[]", new String[] { "till_time_before_event" });
        addFormParameter(proxy, "applicationEndDayBeforeEvent[]", new String[] { "0" });
        addFormParameter(proxy, "customApplicationEndDate[]", new String[] { "2012-01-01 00:00" });
        addFormParameter(proxy, "reservationEnd[]", new String[] { "till_time_before_application" });
        addFormParameter(proxy, "reservationEndHourBeforeApplication[]", new String[] { "0" });
        addFormParameter(proxy, "customReservationEndDate[]", new String[] { "2012-01-01 00:00" });
        addFormParameter(proxy, "priceType[]", new String[] { "free" });
        addFormParameter(proxy, "price[]", new String[] { "0" });

        // Changed to limited.
        addFormParameter(proxy, "amountType[]", new String[] { "limited" });
        addFormParameter(proxy, "amount[]", new String[] { "10" });

        proxy.execute();
        assertResultOK(proxy);

        EventEx modified = loadEventEx(UNPUBLISHED_EVENT_ID);
        List<EventTicket> tickets = modified.getTickets();
View Full Code Here

        assertThat(tickets.get(0).getAmount(), is(10));
    }

    @Test
    public void shouldModifyTicketAmountForPublishedEvent() throws Exception {
        ActionProxy proxy = getActionProxy(POST, API_EVENT_MODIFY_TICKET);
        loginAs(proxy, EVENT_OWNER_ID);
        addValidSessionTokenToParameter(proxy);

        addFormParameter(proxy, "eventId", DEFAULT_EVENT_ID);
        addFormParameter(proxy, "id[]", new String[] { DEFAULT_EVENT_TICKET_ID.toString() });
        addFormParameter(proxy, "name[]", new String[] { "name" });
        addFormParameter(proxy, "applicationStart[]", new String[] { "anytime" });
        addFormParameter(proxy, "applicationStartDayBeforeEvent[]", new String[] { "0" });
        addFormParameter(proxy, "customApplicationStartDate[]", new String[] { "2012-01-01 00:00" });
        addFormParameter(proxy, "applicationEnd[]", new String[] { "till_time_before_event" });
        addFormParameter(proxy, "applicationEndDayBeforeEvent[]", new String[] { "0" });
        addFormParameter(proxy, "customApplicationEndDate[]", new String[] { "2012-01-01 00:00" });
        addFormParameter(proxy, "reservationEnd[]", new String[] { "till_time_before_application" });
        addFormParameter(proxy, "reservationEndHourBeforeApplication[]", new String[] { "0" });
        addFormParameter(proxy, "customReservationEndDate[]", new String[] { "2012-01-01 00:00" });
        addFormParameter(proxy, "priceType[]", new String[] { "free" });
        addFormParameter(proxy, "price[]", new String[] { "0" });

        // Changed to limited.
        addFormParameter(proxy, "amountType[]", new String[] { "limited" });
        addFormParameter(proxy, "amount[]", new String[] { "10" });

        proxy.execute();
        assertResultOK(proxy);

        EventEx modified = loadEventEx(DEFAULT_EVENT_ID);
        List<EventTicket> tickets = modified.getTickets();
View Full Code Here

    @Test
    public void shouldDeleteTickdetIfNoParticipants() throws Exception {
        removeUserTicketsByEventId(DEFAULT_EVENT_ID);

        ActionProxy proxy = getActionProxy(POST, API_EVENT_MODIFY_TICKET);
        loginAs(proxy, EVENT_OWNER_ID);
        addValidSessionTokenToParameter(proxy);

        addFormParameter(proxy, "eventId", DEFAULT_EVENT_ID);
        addFormParameter(proxy, "id[]", new String[] {});
        addFormParameter(proxy, "name[]", new String[] {});
        addFormParameter(proxy, "applicationStart[]", new String[] {});
        addFormParameter(proxy, "applicationStartDayBeforeEvent[]", new String[] {});
        addFormParameter(proxy, "customApplicationStartDate[]", new String[] {});
        addFormParameter(proxy, "applicationEnd[]", new String[] {});
        addFormParameter(proxy, "applicationEndDayBeforeEvent[]", new String[] {});
        addFormParameter(proxy, "customApplicationEndDate[]", new String[] {});
        addFormParameter(proxy, "reservationEnd[]", new String[] {});
        addFormParameter(proxy, "reservationEndHourBeforeApplication[]", new String[] {});
        addFormParameter(proxy, "customReservationEndDate[]", new String[] {});
        addFormParameter(proxy, "priceType[]", new String[] {});
        addFormParameter(proxy, "price[]", new String[] {});

        // Changed to limited.
        addFormParameter(proxy, "amountType[]", new String[] {});
        addFormParameter(proxy, "amount[]", new String[] {});

        proxy.execute();
        assertResultOK(proxy);

        EventEx modified = loadEventEx(DEFAULT_EVENT_ID);
        List<EventTicket> tickets = modified.getTickets();
View Full Code Here

TOP

Related Classes of in.partake.controller.ActionProxy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.