Give the Manager role to the current user:

  >>> from Testing.ZopeTestCase import user_name, user_password, folder_name
  >>> self.setRoles(['Manager'])

Create an empty file:

  >>> portal_path = '/'.join(self.portal.getPhysicalPath())

  >>> print http(r"""
  ... PUT /%s/file.zip HTTP/1.1
  ... Authorization: Basic %s:%s
  ... """ % (portal_path, user_name, user_password), handle_errors=False)
  HTTP/1.1 201 Created...

  >>> print self.portal._getOb('file.zip').meta_type
  ATFile

Do a PROPFIND to check that the title is set to the filename:

  >>> print http(r"""
  ... PROPFIND /%s/file.zip HTTP/1.1
  ... Depth: 0
  ... Content-Type: text/xml; charset="utf-8"
  ... Authorization: Basic %s:%s
  ... """ % (portal_path, user_name, user_password), handle_errors=False)
  HTTP/1.1 207 Multi-Status
  ...
  Content-Type: text/xml; charset="utf-8"
  ...
  <BLANKLINE>
  ...<n:title>file.zip</n:title>...

Querying the catalog should give no results:

  >>> self.portal.portal_catalog(Title='Mosquito')
  []

Do a PROPATCH to set the title:

  >>> value = 'Mosquito'
  >>> print http(r"""
  ... PROPPATCH /%s/file.zip HTTP/1.1
  ... Content-Type: text/xml; charset="utf-8"
  ... Authorization: Basic %s:%s
  ... <?xml version="1.0" encoding="utf-8"?>
  ... <dav:propertyupdate xmlns:dav="DAV:"
  ...   xmlns:ns="http://www.zope.org/propsets/default">
  ...   <dav:set><dav:prop>
  ...    <ns:title>%s</ns:title>
  ...   </dav:prop></dav:set>
  ... </dav:propertyupdate>
  ... """ % (portal_path, user_name, user_password, value), handle_errors=False)
  HTTP/1.1 207 Multi-Status
  ...
  Content-Type: text/xml; charset="utf-8"
  ...

Querying the catalog should now find the object:

  >>> for r in self.portal.portal_catalog(Title='Mosquito'):
  ...     print r.getPath()
  /plone/file.zip

