Give the Manager role to the current user:

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

Create a Folder for testing:

  >>> _= self.portal.invokeFactory('Folder', 'test_folder_')
  >>> folder = self.portal._getOb('test_folder_')
  >>> folder_path = '/'.join(folder.getPhysicalPath())

Make sure index_html doesn't exist yet:

  >>> 'index_html' in folder.objectIds()
  False

PUT index_html into a Plone Folder. Should work just fine.

  >>> body = 'I am the walrus'
  >>> length = len(body)
  >>> print http(r"""
  ... PUT %s/index_html HTTP/1.1
  ... Content-Length: %d
  ... Authorization: Basic %s:%s
  ... <BLANKLINE>
  ... %s
  ... """ % (folder_path, length,
  ...        user_name, user_password, body),
  ...        handle_errors=False)
  HTTP/1.1 201 Created...

  >>> print 'Document' in folder._getOb('index_html').meta_type
  True

Now, let's try the same at the Portal level.

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

Make sure index_html doesn't exist yet:

  >>> 'index_html' in self.portal.objectIds()
  False

But if you access it directly you should get a FSPageTemplate:

  >>> print self.portal.index_html.meta_type
  Filesystem Page Template

PUT index_html into Plone root. Should work just fine.

  >>> body = 'I am the walrus'
  >>> length = len(body)
  >>> print http(r"""
  ... PUT %s/index_html HTTP/1.1
  ... Content-Length: %d
  ... Authorization: Basic %s:%s
  ... <BLANKLINE>
  ... %s
  ... """ % (folder_path, length,
  ...        user_name, user_password, body),
  ...        handle_errors=False)
  HTTP/1.1 201 Created...

  >>> print 'Document' in self.portal._getOb('index_html').meta_type
  True
