Index: qPloneGoogleSitemaps/branches/contenttype/tests/testqPloneGoogleSitemaps.py
===================================================================
--- qPloneGoogleSitemaps/branches/contenttype/tests/testqPloneGoogleSitemaps.py	(revision 441)
+++ qPloneGoogleSitemaps/branches/contenttype/tests/testqPloneGoogleSitemaps.py	(revision 442)
@@ -3,4 +3,7 @@
 #
 
+from urllib import urlencode
+from StringIO import StringIO
+
 from Products.Five import zcml
 from Products.Five import fiveconfigure
@@ -8,5 +11,7 @@
 
 from Products.CMFPlone.utils import _createObjectByType
+
 import Products.qPloneGoogleSitemaps
+from Products.qPloneGoogleSitemaps.config import ping_googlesitemap
 
 from XMLParser import parse, hasURL
@@ -23,5 +28,5 @@
 PloneTestCase.setupPloneSite(extension_profiles=("Products.%s:default" % PRODUCT,))
 
-class TestqPloneGoogleSitemapsInstallation(PloneTestCase.FunctionalTestCase):
+class TestqPloneGoogleSitemapsInstallation(PloneTestCase.PloneTestCase):
 
     def afterSetUp(self):
@@ -97,4 +102,68 @@
 
 
+class TestSitemapType(PloneTestCase.FunctionalTestCase):
+
+    def afterSetUp(self):
+        self.loginAsPortalOwner()
+
+        self.membership = self.portal.portal_membership
+        self.workflow = self.portal.portal_workflow
+        self.auth = 'admin:admin'
+        self.contentSM = _createObjectByType('Sitemap', self.portal, id='google-sitemaps')
+        self.sitemapUrl = '/'+self.portal.absolute_url(1) + '/google-sitemaps'
+        self.membership.addMember('admin', 'admin', ('Manager',), [])
+
+        # Add testing document to portal
+        my_doc = self.portal.invokeFactory('Document', id='my_doc')
+        self.my_doc = self.portal['my_doc']
+        self.my_doc.edit(text_format='plain', text='hello world')
+
+    def testFields(self):
+        field_ids = map(lambda x:x.getName(), self.contentSM.Schema().fields())
+        # test old Sitemap settings fields
+        self.assert_('id' in field_ids)
+        self.assert_('portalTypes' in field_ids)
+        self.assert_('states' in field_ids)
+        self.assert_('blackout_list' in field_ids)
+        self.assert_('urls' in field_ids)
+        self.assert_('pingTransitions' in field_ids)
+        # test new sitemap type field
+        self.assert_('sitemapType' in field_ids)
+
+    def testSitemapTypes(self):
+        sitemap_types = self.contentSM.getField('sitemapType').Vocabulary().keys()
+        self.assert_('content' in sitemap_types)
+        self.assert_('mobile' in sitemap_types)
+        self.assert_('news' in sitemap_types)
+
+    def testAutoSetLayout(self):
+        response = self.publish('/%s/createObject?type_name=Sitemap' % \
+                                self.portal.absolute_url(1), basic=self.auth)
+        location = response.getHeader('location')
+        newurl = location[location.find('/'+self.portal.absolute_url(1)):]
+
+        msm_id = 'mobile_sitemap'
+        form = {'id': msm_id,
+                'sitemapType':'mobile',
+                'portalTypes':['Document',],
+                'states':['published'],
+                'form_submit':'Save',
+                'form.submitted':1,
+                }
+        post_data = StringIO(urlencode(form))
+        response = self.publish(newurl, request_method='POST', stdin=post_data, basic=self.auth)
+        msitemap = getattr(self.portal, msm_id)
+
+        self.assertEqual(msitemap.defaultView(), 'mobile-sitemap.xml')
+
+    def txestPingSetting(self):
+        pwf = self.portal.portal_workflow['plone_workflow']
+        self.assertEqual(self.contentSM.getPingTransitions(), ())
+
+        self.contentSM.setPingTransitions(('plone_workflow#publish',))
+        self.assertEqual(self.contentSM.getPingTransitions(), ('plone_workflow#publish',))
+        self.assert_(ping_googlesitemap in pwf.scripts.keys(),"Not add wf script")
+
+
 class TestqPloneGoogleSitemaps(PloneTestCase.FunctionalTestCase):
 
@@ -148,4 +217,5 @@
         self.assert_(not vf_created, 'Verification file not removed')
 
+
 class TestSettings(PloneTestCase.FunctionalTestCase):
 
@@ -233,6 +303,8 @@
     suite = TestSuite()
     suite.addTest(makeSuite(TestqPloneGoogleSitemapsInstallation))
+    suite.addTest(makeSuite(TestSitemapType))
     suite.addTest(makeSuite(TestqPloneGoogleSitemaps))
     suite.addTest(makeSuite(TestSettings))
+
     return suite
 
