Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
kupu.plone.tests.kuputestcase.KupuTestCase Class Reference
Inheritance diagram for kupu.plone.tests.kuputestcase.KupuTestCase:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def loginPortalOwner
def create
def setup_content

Public Attributes

 kupu

Detailed Description

Base class for Kupu tests

Definition at line 52 of file kuputestcase.py.


Member Function Documentation

Definition at line 55 of file kuputestcase.py.

00055 
00056     def afterSetUp(self):
00057         portal = self.portal
00058         self.setRoles(['Manager',])
00059         self.kupu = portal.kupu_library_tool
00060         self.kupu.configure_kupu(captioning=True, linkbyuid=True)
00061         typestool = self.portal.portal_types
00062         if not hasattr(typestool, 'ATDocument'):
00063             # Use the type names without the AT prefix
00064             for k in TypeMapping:
00065                 TypeMapping[k] = k

Here is the call graph for this function:

def kupu.plone.tests.kuputestcase.KupuTestCase.create (   self,
  id,
  metatype = 'ATDocument',
  folder = None,
  kwds 
)
Create an object in the cms portal

Definition at line 72 of file kuputestcase.py.

00072 
00073     def create(self, id, metatype='ATDocument', folder=None, **kwds):
00074         '''Create an object in the cms portal'''
00075         if folder is None:
00076             folder = self.portal
00077 
00078         folder.invokeFactory(MapType(metatype), id)
00079         obj = getattr(folder, id)
00080 
00081         if metatype=='Folder' and constraintypes:
00082             obj.setConstrainTypesMode(constraintypes.DISABLED)
00083 
00084         if metatype=='Document':
00085             obj.setTitle('Simple document')
00086             obj.setText('Sample document text')
00087             for k, v in kwds.items():
00088                 field = obj.getField(k)
00089                 mutator = field.getMutator(obj)(v)
00090 
00091             obj.reindexObject()
00092 
00093         assert obj is not None
00094         return obj

Here is the call graph for this function:

Here is the caller graph for this function:

Use if you need to manipulate the portal itself.

Definition at line 66 of file kuputestcase.py.

00066 
00067     def loginPortalOwner(self):
00068         '''Use if you need to manipulate the portal itself.'''
00069         uf = self.app.acl_users
00070         user = uf.getUserById(portal_owner).__of__(uf)
00071         newSecurityManager(None, user)

Here is the caller graph for this function:

Definition at line 95 of file kuputestcase.py.

00095 
00096     def setup_content(self):
00097         self.setRoles(['Manager',])
00098         self.loginPortalOwner()
00099         f = self.create('folder', 'Folder')
00100 
00101         for id in ('alpha', 'beta'):
00102             self.create(id, 'Document', f, subject=['aspidistra'])
00103         self.create('gamma', 'Image', f)
00104         gamma = f.gamma
00105         gamma.setImage(open(join(PREFIX,'image.jpg'),'rb').read())
00106         gamma.setTitle('Kupu Test Image')
00107         gamma.setDescription('Test image caption')
00108         # The image needs a fixed uid for the transform tests.
00109         f.gamma._setUID('104ede98d4c7c8eaeaa3b984f7395979')
00110 
00111         self.create('umlauts', 'Image', f)
00112         umlauts = f.umlauts
00113         umlauts.setImage(open(join(PREFIX,'image.jpg'),'rb').read())
00114         title, description = open(join(PREFIX, 'umlauts-testdata.txt')).read().strip().split(';')
00115         umlauts.setTitle(title)
00116         umlauts.setDescription(description)
00117         # The image needs a fixed uid for the transform tests.
00118         f.umlauts._setUID('215fef98e5d7c9ebebb4c984f7395979')
00119 
00120         f.reindexObject()
00121 
00122         sub1 = self.create('sub1', 'Folder', f)
00123         sub1.setSubject(['aspidistra'])
00124         sub1.reindexObject()
00125         sub2 = self.create('sub2', 'Folder', f)
00126         self.create('delta', 'Folder', sub2)
00127 
00128         portal = self.portal
00129         tool = self.portal.kupu_library_tool
00130         types = tool.zmi_get_resourcetypes()
00131         #tool.deleteResource([ t.name for t in types])
00132         for k,v in RESOURCES.items():
00133             tool.addResourceType(k, [MapType(t) for t in v])

Here is the caller graph for this function:


Member Data Documentation

Definition at line 58 of file kuputestcase.py.


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