#!perl
use Cassandane::Tiny;

sub test_put_huge_summary ($self)
{
    my $CalDAV = $self->{caldav};

    my $CalendarId = $CalDAV->NewCalendar({name => 'foo'});
    $self->assert_not_null($CalendarId);

    my $href = "$CalendarId/huge-summary.ics";
    my $summary = ('x') x 95000;
    my $card = <<EOF;
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Apple Inc.//Mac OS X 10.10.4//EN
CALSCALE:GREGORIAN
BEGIN:VEVENT
CREATED:20150806T234327Z
DTEND:20160831T183000Z
TRANSP:OPAQUE
SUMMARY:$summary
DTSTART:20160831T153000Z
DTSTAMP:20150806T234327Z
SEQUENCE:0
UID:xyz
END:VEVENT
END:VCALENDAR
EOF

    # Without the fix in Cyrus this will return a 500 (Internal Server Error)
    # due to an assert() on a NULL resource URI
    my $res = $CalDAV->SafeRequest('PUT', $href, $card,
                                   'Content-Type' => 'text/calendar');
    $self->assert_num_equals(201, $res->{http_response}{status});
}
