Back to index

plone3  3.1.7
test_kss.py
Go to the documentation of this file.
00001 import unittest
00002 from zope import interface
00003 
00004 from kss.core.tests.base import KSSViewTestCaseMixin
00005 from plone.app.kss.tests.kss_and_plone_layer import KSSAndPloneLayer
00006 
00007 from plone.app.contentrules.tests.base import ContentRulesTestCase
00008 
00009 class KSSContentRulesTestCase(ContentRulesTestCase, KSSViewTestCaseMixin):
00010 
00011     layer = KSSAndPloneLayer
00012 
00013     def afterSetUp(self):
00014         self.setDebugRequest()
00015         self.setRoles(['Manager'])
00016         self.view = self.portal.restrictedTraverse('replaceRulesTable')
00017 
00018     def test_instantiation(self):
00019         view = self.view
00020         commands = view.getCommands()
00021         self.assertNotEquals(view, None)
00022 
00023     def test_replaceFilteredRulesForm(self):
00024         view = self.view
00025         commands = view.getCommands()
00026         res = view.replaceFilteredRulesForm(ruleType='state-enabled')
00027         # Adjust for different payload in newer kss versions
00028         html = res[0]['params']['html'].replace('<![CDATA[', '').replace(']]>', '')
00029         res[0]['params']['html'] = html
00030         self.assertEquals(res, [
00031             {'selectorType': '',    
00032              'params': {'html': u'\n<form style="display: inline" method="POST" id="rules_table_form" action="http://nohost/plone/@@rules-controlpanel">\n</form>\n', 
00033              'withKssSetup': u'True'}, 
00034              'name': 'replaceHTML', 
00035              'selector': '#rules_table_form'}
00036         ])
00037 
00038 def test_suite():
00039     return unittest.TestSuite((
00040         unittest.makeSuite(KSSContentRulesTestCase),
00041         ))