Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes
archetypes.kss.tests.test_validation.ValidationViewTestCase Class Reference
Inheritance diagram for archetypes.kss.tests.test_validation.ValidationViewTestCase:
Inheritance graph
[legend]
Collaboration diagram for archetypes.kss.tests.test_validation.ValidationViewTestCase:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testValidateFormWithEvents
def testValidateForm
def testValidateFormFailed
def testValidateFormWithUploads
def loadCoreConfig
def createView
def setDebugRequest

Public Attributes

 view

Static Public Attributes

 layer = KSSAndPloneLayer

Detailed Description

Definition at line 25 of file test_validation.py.


Member Function Documentation

Definition at line 27 of file test_validation.py.

00027 
00028     def afterSetUp(self):
00029         PloneTestCase.PloneTestCase.afterSetUp(self)
00030         # commands will be rendered as data structures,
00031         self.setDebugRequest()
00032         self.loginAsPortalOwner()
00033         context = self.portal['front-page']
00034         # create content
00035         self.portal.invokeFactory(id='testfile', type_name='File')
00036         self.portal.invokeFactory(id='testdoc', type_name='Document')

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:

Test validating a form works

Definition at line 68 of file test_validation.py.

00068 
00069     def testValidateForm(self):
00070         """Test validating a form works
00071         """
00072         # Set up a view 
00073         context = self.portal.testdoc
00074         view = context.restrictedTraverse('kssValidateForm')
00075         # this form contains a file field that needs to be ignored. 
00076         data = {'': 'A kiv\xc3\xa1lasztott elemek elt\xc3\xa1vol\xc3\xadt\xc3\xa1sa', 'allowDiscussion': 'None',
00077             'cmfeditions_save_new_version': 'false', 'contributors': [],
00078             'creators': ['ree'], 'description': '', 'description_text_format':
00079             'text/plain', 'effectiveDate': '', 'effectiveDate_ampm': '',
00080             'effectiveDate_day': '00', 'effectiveDate_hour': '00',
00081             'effectiveDate_minute': '00', 'effectiveDate_month': '00',
00082             'effectiveDate_year': '2006', 'excludeFromNav': '0',
00083             'excludeFromNav_visible': 'false', 'expirationDate': '',
00084             'expirationDate_ampm': '', 'expirationDate_day': '00',
00085             'expirationDate_hour': '00', 'expirationDate_minute': '00',
00086             'expirationDate_month': '00', 'expirationDate_year': '2006',
00087             'fieldset': 'default', 'file_file':
00088             '', 'id':
00089             'file.2006-12-21.4001159106', 'language': 'Meghat\xc3\xa1rozatlan nyelv(a port\xc3\xa1l alap\xc3\xa9rtelmezett nyelve)', 'last_referer':
00090             'http://localhost:9888/new16/uacheckin.pdf/view?portal_status_message=Changes%20saved.',
00091             'relatedItems': [''], 'rights': '', 'rights_text_format': 'text/plain',
00092             'subject_existing_keywords': [''], 'subject_keywords': [], 'title': 'The new title', 
00093             'text': 'XXX'}
00094             
00095         result = view.kssValidateForm(data)
00096         
00097         self.assertEqual([(r['name'], r['selector'], r['selectorType'])
00098                              for r in result], [
00099                 ('plone-submitCurrentForm', '', 'samenode'),
00100             ])

Test validating a form works, with the title field not validatiing

Definition at line 101 of file test_validation.py.

00101 
00102     def testValidateFormFailed(self):
00103         """Test validating a form works, with the title field not validatiing
00104         """
00105         # Set up a view 
00106         context = self.portal.testdoc
00107         view = context.restrictedTraverse('kssValidateForm')
00108         # this form contains a file field that needs to be ignored. 
00109         data = {'': 'A kiv\xc3\xa1lasztott elemek elt\xc3\xa1vol\xc3\xadt\xc3\xa1sa', 'allowDiscussion': 'None',
00110             'cmfeditions_save_new_version': 'false', 'contributors': [],
00111             'creators': ['ree'], 'description': '', 'description_text_format':
00112             'text/plain', 'effectiveDate': '', 'effectiveDate_ampm': '',
00113             'effectiveDate_day': '00', 'effectiveDate_hour': '00',
00114             'effectiveDate_minute': '00', 'effectiveDate_month': '00',
00115             'effectiveDate_year': '2006', 'excludeFromNav': '0',
00116             'excludeFromNav_visible': 'false', 'expirationDate': '',
00117             'expirationDate_ampm': '', 'expirationDate_day': '00',
00118             'expirationDate_hour': '00', 'expirationDate_minute': '00',
00119             'expirationDate_month': '00', 'expirationDate_year': '2006',
00120             'fieldset': 'default', 'file_file':
00121             'thefile.txt', 'id':
00122             'file.2006-12-21.4001159106', 'language': 'Meghat\xc3\xa1rozatlan nyelv(a port\xc3\xa1l alap\xc3\xa9rtelmezett nyelve)', 'last_referer':
00123             'http://localhost:9888/new16/uacheckin.pdf/view?portal_status_message=Changes%20saved.',
00124             'relatedItems': [''], 'rights': '', 'rights_text_format': 'text/plain',
00125             'subject_existing_keywords': [''], 'subject_keywords': [], 'title': '', 'text': 'XXX'}
00126         
00127         result = view.kssValidateForm(data)
00128         
00129         self.assertEqual([(r['name'], r['selector'], r['selectorType'])
00130                              for r in result], [
00131                  ('setStyle', '.portalMessage', 'css'),
00132                  ('replaceInnerHTML', 'kssPortalMessage', 'htmlid'),
00133                  ('setAttribute', 'kssPortalMessage', 'htmlid'),
00134                  ('setStyle', 'kssPortalMessage', 'htmlid'),
00135                  ('clearChildNodes', 'div.field div.fieldErrorBox', 'css'),
00136                  ('replaceInnerHTML', 'div#archetypes-fieldname-title div.fieldErrorBox', 'css'), 
00137                  ('setAttribute', 'archetypes-fieldname-title', 'htmlid'),
00138             ])

Test validating a form works with events

Definition at line 41 of file test_validation.py.

00041 
00042     def testValidateFormWithEvents(self):
00043         """Test validating a form works with events
00044         """
00045         # Set up a view 
00046         context = self.portal.testdoc
00047         view = context.restrictedTraverse('kssValidateForm')
00048         # this form contains a file field that needs to be ignored. 
00049         data = {'': 'A kiv\xc3\xa1lasztott elemek elt\xc3\xa1vol\xc3\xadt\xc3\xa1sa', 'allowDiscussion': 'None',
00050             'cmfeditions_save_new_version': 'false', 'contributors': [],
00051             'creators': ['ree'], 'description': '', 'description_text_format':
00052             'text/plain', 'effectiveDate': '', 'effectiveDate_ampm': '',
00053             'effectiveDate_day': '00', 'effectiveDate_hour': '00',
00054             'effectiveDate_minute': '00', 'effectiveDate_month': '00',
00055             'effectiveDate_year': '2006', 'excludeFromNav': '0',
00056             'excludeFromNav_visible': 'false', 'expirationDate': '',
00057             'expirationDate_ampm': '', 'expirationDate_day': '00',
00058             'expirationDate_hour': '00', 'expirationDate_minute': '00',
00059             'expirationDate_month': '00', 'expirationDate_year': '2006',
00060             'fieldset': 'default', 'file_file':
00061             '', 'id':
00062             'file.2006-12-21.4001159106', 'language': 'Meghat\xc3\xa1rozatlan nyelv(a port\xc3\xa1l alap\xc3\xa9rtelmezett nyelve)', 'last_referer':
00063             'http://localhost:9888/new16/uacheckin.pdf/view?portal_status_message=Changes%20saved.',
00064             'relatedItems': [''], 'rights': '', 'rights_text_format': 'text/plain',
00065             'subject_existing_keywords': [''], 'subject_keywords': [], 'title': 'The new title'}
00066             
00067         result = view.kssValidateForm(data)
        
Test validating a form works with uploads

Definition at line 139 of file test_validation.py.

00139 
00140     def testValidateFormWithUploads(self):
00141         """Test validating a form works with uploads
00142         """
00143         # Set up a view 
00144         context = self.portal.testfile
00145         view = context.restrictedTraverse('kssValidateForm')
00146         # this form contains a file field that needs to be ignored. 
00147         data = {'': 'A kiv\xc3\xa1lasztott elemek elt\xc3\xa1vol\xc3\xadt\xc3\xa1sa', 'allowDiscussion': 'None',
00148         'cmfeditions_save_new_version': 'false', 'contributors': [],
00149         'creators': ['ree'], 'description': '', 'description_text_format':
00150         'text/plain', 'effectiveDate': '', 'effectiveDate_ampm': '',
00151         'effectiveDate_day': '00', 'effectiveDate_hour': '00',
00152         'effectiveDate_minute': '00', 'effectiveDate_month': '00',
00153         'effectiveDate_year': '2006', 'excludeFromNav': '0',
00154         'excludeFromNav_visible': 'false', 'expirationDate': '',
00155         'expirationDate_ampm': '', 'expirationDate_day': '00',
00156         'expirationDate_hour': '00', 'expirationDate_minute': '00',
00157         'expirationDate_month': '00', 'expirationDate_year': '2006',
00158         'fieldset': 'default', 'file_file':
00159         '/home/ree/docs/canon_biztosito/melleklet.odt', 'id':
00160         'file.2006-12-21.4001159106', 'language': 'Meghat\xc3\xa1rozatlan nyelv (a port\xc3\xa1l alap\xc3\xa9rtelmezett nyelve)', 'last_referer':
00161         'http://localhost:9888/new16/uacheckin.pdf/view?portal_status_message=Changes%20saved.',
00162         'relatedItems': [''], 'rights': '', 'rights_text_format': 'text/plain',
00163         'subject_existing_keywords': [''], 'subject_keywords': [], 'title': 'New title'}
00164         
00165         result = view.kssValidateForm(data)
00166         
00167         self.assertEqual([(r['name'], r['selector'], r['selectorType'])
00168                              for r in result], [
00169                 ('plone-submitCurrentForm', '', 'samenode'),
00170             ])


Member Data Documentation

Definition at line 25 of file kss_and_plone_layer.py.


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