Don't generate PDF when accessed with wrong token

Also, add a test case for this
Catch some exceptions for wrong UIDs

This catches the exceptions thrown when the UID either has the wrong value or
doesn't decode to an integer.
Properly test iCal generation with wrong tokens