#
# MKTICKET request for a read/write ticket on a collection
#   - ticket should have no expiry
#
TYPE=MKTICKET
URL=http://regression.host/caldav.php/user3/home/
HEADER=User-Agent: Ticket Spec Tests
HEADER=Content-Type: text/xml; charset="UTF-8"
HEAD
AUTH=admin:nimda

BEGINDATA
<?xml version="1.0" encoding="utf-8" ?>
<T:ticketinfo xmlns:D="DAV:" xmlns:T="http://www.xythos.com/namespaces/StorageServer" >
  <D:privilege><D:read/><D:write/></D:privilege>
  <T:timeout>infinity</T:timeout>
</T:ticketinfo>
ENDDATA

QUERY
SELECT access_ticket.dav_owner_id,
       date_trunc( 'minute', ('55 seconds' + access_ticket.expires - current_timestamp)::interval(0)) AS timeout,
       access_ticket.privileges,
       target_collection_id,
       target_resource_id,
       collection.dav_name
  FROM access_ticket
       INNER JOIN collection ON (collection_id = target_collection_id)
 WHERE collection.dav_name = '/user3/home/'
ENDQUERY
# WHERE target_collection = 161

REPLACE=!ETag: "\S+"!ETag: "Some good etag"!
REPLACE=!<T:id>\S{8}</T:id>!<T:id>Good Ticket ID</T:id>!
REPLACE=!Ticket: \S{8}!Ticket:Good Ticket ID!
