Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
CMFPlone.tests.testExternalEditorEnabled.TestExternalEditorEnabled Class Reference
Inheritance diagram for CMFPlone.tests.testExternalEditorEnabled.TestExternalEditorEnabled:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testExternalEditorEnabled.TestExternalEditorEnabled:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testFailForAnonymous
def testFailOnDisabledMemberProperty
def testFailOnUnSupportedObjects
def testFailWithoutUseExtEditPermission
def testFailWhenObjectIsLocked
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 doc
 folder
 mtool
 lockbody

Detailed Description

Tests the externalEditorEnabled script

Definition at line 8 of file testExternalEditorEnabled.py.


Member Function Documentation

Definition at line 11 of file testExternalEditorEnabled.py.

00011 
00012     def afterSetUp(self):
00013         PloneTestCase.PloneTestCase.afterSetUp(self)
00014         self.folder.invokeFactory('Document','doc')
00015         self.doc = self.folder.doc
00016         self.folder.invokeFactory('Folder','folder2')
00017         self.folder = self.folder.folder2
00018         self.portal.acl_users._doAddUser('user1', 'secret', ['Member'], [])
00019         self.mtool = self.portal.portal_membership
00020         member = self.mtool.getAuthenticatedMember()
00021         member.setMemberProperties({'ext_editor' : 1})
00022 
00023         self.lockbody = ('<?xml version="1.0" encoding="utf-8"?>\n'
00024                 '<d:lockinfo xmlns:d="DAV:">\n'
00025                 '  <d:lockscope><d:exclusive/></d:lockscope>\n'
00026                 '  <d:locktype><d:write/></d:locktype>\n'
00027                 '  <d:depth>infinity</d:depth>\n'
00028                 '  <d:owner>\n'
00029                 '  <d:href>Zope External Editor</d:href>\n'
00030                 '  </d:owner>\n'
00031                 '</d:lockinfo>'
00032                 )

Definition at line 30 of file PloneTestCase.py.

00030 
00031     def getAuthenticator(self):
00032         tag = AuthenticatorView('context', 'request').authenticator()
00033         pattern = '<input .*name="(\w+)".*value="(\w+)"'
00034         return match(pattern, tag).groups()

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.PloneTestCase.PloneTestCase.setRequestMethod (   self,
  method 
) [inherited]
This is a stub now, but in case you want to try
   something fancy on Your Branch (tm), put it here.

Definition at line 26 of file PloneTestCase.py.

00026 
00027     def setRequestMethod(self, method):
00028         self.app.REQUEST.set('REQUEST_METHOD', method)
00029         self.app.REQUEST.method = method

Here is the caller graph for this function:

Definition at line 35 of file PloneTestCase.py.

00035 
00036     def setupAuthenticator(self):
00037         name, token = self.getAuthenticator()
00038         self.app.REQUEST.form[name] = token
00039 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 33 of file testExternalEditorEnabled.py.

00033 
00034     def testFailForAnonymous(self):
00035         self.failUnless(self.doc.externalEditorEnabled())
00036         self.logout()
00037         self.failIf(self.doc.externalEditorEnabled())

Here is the call graph for this function:

Definition at line 38 of file testExternalEditorEnabled.py.

00038 
00039     def testFailOnDisabledMemberProperty(self):
00040         self.failUnless(self.doc.externalEditorEnabled())
00041         member = self.mtool.getAuthenticatedMember()
00042         member.setMemberProperties({'ext_editor' : 0})
00043         self.failIf(self.doc.externalEditorEnabled())

Definition at line 44 of file testExternalEditorEnabled.py.

00044 
00045     def testFailOnUnSupportedObjects(self):
00046         # ATCT Folders are editable by default now
00047         self.failUnless(self.folder.externalEditorEnabled())
00048         # But if __dav_marshall__ is set to False then they aren't.
00049         self.folder.__dav_marshall__ = False
00050         self.failIf(self.folder.externalEditorEnabled())

Definition at line 57 of file testExternalEditorEnabled.py.

00057 
00058     def testFailWhenObjectIsLocked(self):
00059         # Should not show if someone already has a webdav lock on the object
00060         self.doc.REQUEST.set('BODY', self.lockbody)
00061         self.doc.LOCK(self.doc.REQUEST, self.doc.REQUEST.RESPONSE)
00062         self.failIf(self.doc.externalEditorEnabled())
00063         self.doc.wl_clearLocks()
00064         self.failUnless(self.doc.externalEditorEnabled())
00065 

Definition at line 51 of file testExternalEditorEnabled.py.

00051 
00052     def testFailWithoutUseExtEditPermission(self):
00053         self.portal.manage_permission('Use external editor',
00054                                       ('Owner','Manager'), 0)
00055         self.login('user1')
00056         self.failIf(self.doc.externalEditorEnabled())

Here is the call graph for this function:


Member Data Documentation

Definition at line 14 of file testExternalEditorEnabled.py.

Definition at line 16 of file testExternalEditorEnabled.py.

Definition at line 22 of file testExternalEditorEnabled.py.

Definition at line 18 of file testExternalEditorEnabled.py.


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