Back to index

plone3  3.1.7
Classes | Public Member Functions | Public Attributes | Static Public Attributes
kss.core.tests.test_ttwapi.TTWTestCase Class Reference
Inheritance diagram for kss.core.tests.test_ttwapi.TTWTestCase:
Inheritance graph
[legend]
Collaboration diagram for kss.core.tests.test_ttwapi.TTWTestCase:
Collaboration graph
[legend]

List of all members.

Classes

class  layer

Public Member Functions

def afterSetUp
def test_scriptWithCore
def test_scriptWithEffect
def test_scriptWithEvents
def loadCoreConfig
def createView
def setDebugRequest

Public Attributes

 view

Static Public Attributes

 layer = KSSLayer

Detailed Description

Definition at line 19 of file test_ttwapi.py.


Member Function Documentation

Definition at line 33 of file test_ttwapi.py.

00033 
00034     def afterSetUp(self):
00035         KSSViewTestCase.afterSetUp(self)
00036         setHooks()
00037         self.app.manage_addProduct['PythonScripts'].manage_addPythonScript(
00038             'kss_test')
00039         self.setDebugRequest()

Here is the call graph for this function:

Definition at line 108 of file base.py.

00108 
00109     def createView(self):
00110         "Set up a fake view (with no content)"
00111         self.view = self.folder.restrictedTraverse('testMethod')
00112         return self.view

Here is the caller graph for this function:

def kss.core.tests.base.KSSViewTestCaseMixin.loadCoreConfig (   self,
  kss_core = True 
) [inherited]

Definition at line 102 of file base.py.

00102 
00103     def loadCoreConfig(self, kss_core=True):
00104         warnings.warn(
00105             "KSS tests are now using layers.  Please do not use "
00106             "loadCoreConfig anymore.",
00107             DeprecationWarning)
    

Definition at line 113 of file base.py.

00113 
00114     def setDebugRequest(self):
00115         'commands will be rendered as test friendly data structures'
00116         request = self.folder.REQUEST
00117         interface.directlyProvides(
00118             request,
00119             interface.directlyProvidedBy(request) + IDebugRequest)

Here is the caller graph for this function:

Definition at line 40 of file test_ttwapi.py.

00040 
00041     def test_scriptWithCore(self):
00042         pythonScriptCode = '''
00043 from kss.core.ttwapi import startKSSCommands
00044 from kss.core.ttwapi import getKSSCommandSet
00045 from kss.core.ttwapi import renderKSSCommands
00046 startKSSCommands(context, context.REQUEST)
00047 core = getKSSCommandSet('core')
00048 core.replaceInnerHTML('#test', '<p>Done</p>')
00049 return renderKSSCommands()
00050 '''
00051         self.app.kss_test.ZPythonScript_edit('', pythonScriptCode)
00052         result = self.app.kss_test() 
00053         self.assertEquals(len(result), 1)
00054         command = result[0]
00055         self.assertEquals(command['selector'], '#test')
00056         self.assertEquals(command['name'], 'replaceInnerHTML')

Definition at line 57 of file test_ttwapi.py.

00057 
00058     def test_scriptWithEffect(self):
00059         pythonScriptCode = '''
00060 from kss.core.ttwapi import startKSSCommands
00061 from kss.core.ttwapi import getKSSCommandSet
00062 from kss.core.ttwapi import renderKSSCommands
00063 startKSSCommands(context, context.REQUEST)
00064 commandSet = getKSSCommandSet('effects')
00065 commandSet.effect('#test', 'fade')
00066 return renderKSSCommands()
00067 '''
00068         self.app.kss_test.ZPythonScript_edit('', pythonScriptCode)
00069         result = self.app.kss_test() 
00070         self.assertEquals(len(result), 1)
00071         command = result[0]
00072         self.assertEquals(command['selector'], '#test')
00073         self.assertEquals(command['name'], 'effect')
00074         self.assertEquals(command['params']['type'], 'fade')

Definition at line 75 of file test_ttwapi.py.

00075 
00076     def test_scriptWithEvents(self):
00077         pythonScriptCode = '''
00078 from kss.core.ttwapi import startKSSCommands
00079 from kss.core.ttwapi import getKSSCommandSet
00080 from kss.core.ttwapi import renderKSSCommands
00081 from kss.core.tests.help_ttwapi import objectModified
00082 startKSSCommands(context, context.REQUEST)
00083 core = getKSSCommandSet('core')
00084 core.replaceInnerHTML('#test', '<p>Done</p>')
00085 objectModified(context)
00086 return renderKSSCommands()
00087 '''
00088         self.app.kss_test.ZPythonScript_edit('', pythonScriptCode)
00089         result = self.app.kss_test()
00090         self.assertEquals(len(result), 2)
00091         command = result[0]
00092         self.assertEquals(command['selector'], '#test')
00093         self.assertEquals(command['name'], 'replaceInnerHTML')
00094         command = result[1]
00095         self.assertEquals(command['selector'], '#event')
00096         self.assertEquals(command['name'], 'replaceInnerHTML')
00097 
@component.adapter(None, KSSView, ObjectModifiedEvent)

Member Data Documentation

kss.core.tests.base.KSSViewTestCase.layer = KSSLayer [static, inherited]

Definition at line 121 of file base.py.


The documentation for this class was generated from the following file: