
Make a topic in our folder

    >>> self.setRoles(('Manager',))

    >>> folder = self.folder
    >>> oid = self.folder.invokeFactory('Folder', 'large', title='Large')
    >>> large = self.folder[oid]

Add geo-referenced content

    >>> oid = large.invokeFactory('Document', 'doc', title='A Document', description='A test document')
    >>> doc = large[oid]
    >>> from zope.interface import alsoProvides
    >>> from collective.geo.geographer.interfaces import IGeoreferenceable
    >>> alsoProvides(doc, IGeoreferenceable)

    >>> from collective.geo.geographer.interfaces import IWriteGeoreferenced
    >>> geo = IWriteGeoreferenced(doc)
    >>> geo.setGeoInterface('Point', (-105, 40))

Set the dates for the content so they are consistent and can be tested

    >>> import DateTime
    >>> testDate = DateTime.DateTime('2010/01/01 09:00:00.000 '+DateTime.DateTime().timezone())
    >>> doc.setCreationDate(testDate)
    >>> doc.setEffectiveDate(testDate)
    >>> doc.setModificationDate(testDate)
    >>> doc.indexObject()

Test the KML document view

    >>> from Products.PloneTestCase.setup import portal_owner, default_password
    >>> r = http(r"""
    ... GET /plone/Members/test_user_1_/large/@@kml-document HTTP/1.1
    ... Authorization: Basic %s:%s
    ... """ % (portal_owner, default_password), handle_errors=False)
    >>> r.getStatus()
    200
    >>> r.getHeader('Content-Type')
    'application/vnd.google-earth.kml+xml;charset=utf-8'

    >>> print r.getBody()
    <?xml version="1.0" encoding="utf-8"?>
    <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
    ...
            <Style id="defaultStyle">
              <IconStyle>
                <scale>0.7</scale>
               <Icon>
                <href>http://localhost/plone/img/marker.png</href>
               </Icon>
               <hotSpot x="0.5" y="0" xunits="fraction" yunits="fraction"/>
              </IconStyle>
              <LineStyle>
               <color>3c0000ff</color>
               <width>2.0</width>
              </LineStyle>
              <PolyStyle>
                <color>3c0000ff</color>
              </PolyStyle>
            </Style>
    ...
          <Placemark>
            <name>A Document</name>
            <atom:author>
               <atom:name>test_user_1_</atom:name>
            </atom:author>
            <atom:link href="http://localhost/plone/Members/test_user_1_/large/doc"/>
    ...
                <p>A test document</p>
    ...
                        <dt>Title</dt>
                        <dd>A Document</dd>
    <BLANKLINE>
    <BLANKLINE>
                        <dt>Description</dt>
                        <dd>A test document</dd>
    ...
                <p class="placemark-url">
                    <a href="http://localhost/plone/Members/test_user_1_/large/doc">See the original resource</a>
                </p>
    ...
                <styleUrl>#defaultStyle</styleUrl>
    ...
              <coordinates>-105.000000,40.000000,0.0</coordinates>
            </Point>
    ...
    </kml>
