From 1df8889f6d20dd5a8691a08bb79953d430dc2fe7 Mon Sep 17 00:00:00 2001 From: Sylvain Jermini Date: Fri, 11 Dec 2015 14:57:09 +0100 Subject: [PATCH] #90 check calendar controller --- .../controller/ReservationFlowIntegrationTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/java/alfio/controller/ReservationFlowIntegrationTest.java b/src/test/java/alfio/controller/ReservationFlowIntegrationTest.java index c704b642e6..1f3f988c7b 100644 --- a/src/test/java/alfio/controller/ReservationFlowIntegrationTest.java +++ b/src/test/java/alfio/controller/ReservationFlowIntegrationTest.java @@ -195,6 +195,10 @@ public void reservationFlowTest() throws Exception{ Assert.assertEquals("/event/show-event", showEvent); // + // check calendar + checkCalendar(eventName); + // + String redirectResult = reserveTicket(eventName); String redirectStart = "redirect:/event/" + eventName + "/reservation/"; // check reservation success @@ -298,6 +302,16 @@ updateTicketOwnerForm, new BeanPropertyBindingResult(updateTicketOwnerForm, "upd } + private void checkCalendar(String eventName) throws IOException { + MockHttpServletResponse resIcal = new MockHttpServletResponse(); + eventController.calendar(eventName, "en", null, resIcal); + Assert.assertEquals("text/calendar", resIcal.getContentType()); + + MockHttpServletResponse resGoogleCal = new MockHttpServletResponse(); + eventController.calendar(eventName, "en", "google", resGoogleCal); + Assert.assertTrue(resGoogleCal.getRedirectedUrl().startsWith("https://www.google.com/calendar/event")); + } + private TicketDecorator checkReservationComplete(String eventName, String reservationIdentifier) { Model confirmationPageModel = new BindingAwareModelMap(); String confirmationPageSuccess = reservationController.showConfirmationPage(eventName, reservationIdentifier, false, false, confirmationPageModel, new MockHttpServletRequest());