Skip to content

Commit

Permalink
#90 check calendar controller
Browse files Browse the repository at this point in the history
  • Loading branch information
syjer committed Dec 11, 2015
1 parent 3ce7e7d commit 1df8889
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/test/java/alfio/controller/ReservationFlowIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 1df8889

Please sign in to comment.