Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes
ATContentTypes.tests.test_criteria.TestATPortalTypeCriterion Class Reference
Inheritance diagram for ATContentTypes.tests.test_criteria.TestATPortalTypeCriterion:
Inheritance graph
[legend]
Collaboration diagram for ATContentTypes.tests.test_criteria.TestATPortalTypeCriterion:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_portaltype_query
def test_vocabulary
def test_vocabulary_sorts_by_type
def test_types_v_portaltypes
def test_type_ids_names
def afterSetUp
def createDummy
def test_000testsetup
def test_multipleCreateVariants
def test_typeInfo
def test_implements
def test_Z3implements

Public Attributes

 dummy

Static Public Attributes

 klass = ATPortalTypeCriterion
string title = 'Portal Types Criterion'
string meta_type = 'ATPortalTypeCriterion'
string portal_type = 'ATPortalTypeCriterion'

Detailed Description

Definition at line 507 of file test_criteria.py.


Member Function Documentation

Reimplemented in ATContentTypes.tests.test_criteria.TestATRelativePathCriterion, and ATContentTypes.tests.test_criteria.TestATCurrentAuthorCriterion.

Definition at line 68 of file test_criteria.py.

00068 
00069     def afterSetUp(self):
00070         atcttestcase.ATCTSiteTestCase.afterSetUp(self)
00071         self.dummy = self.createDummy(self.klass)

def ATContentTypes.tests.test_criteria.CriteriaTest.createDummy (   self,
  klass,
  id = 'dummy' 
) [inherited]

Definition at line 72 of file test_criteria.py.

00072 
00073     def createDummy(self, klass, id='dummy'):
00074         folder = self.folder
00075         if klass is not None:
00076             dummy = klass(id, 'dummyfield')
00077             # put dummy in context of portal
00078             folder._setObject(id, dummy)
00079             dummy = getattr(folder, id)
00080             dummy.initializeArchetype()
00081         else:
00082             dummy = None
00083         return dummy

Here is the call graph for this function:

Definition at line 84 of file test_criteria.py.

00084 
00085     def test_000testsetup(self):
00086         if self.klass is not None:
00087             self.failUnless(self.klass)
00088             self.failUnless(self.portal_type)
00089             self.failUnless(self.title)
00090             self.failUnless(self.meta_type)
        

Definition at line 119 of file test_criteria.py.

00119 
00120     def test_implements(self):
00121         if self.dummy is not None:
00122             self.failIf(IReferenceable.isImplementedBy(self.dummy))
00123             self.failIf(IExtensibleMetadata.isImplementedBy(self.dummy))
00124             self.failIf(self.dummy.isReferenceable)
00125             self.failUnless(IBaseContent.isImplementedBy(self.dummy))
00126             self.failUnless(IATTopicCriterion.isImplementedBy(self.dummy))
00127             self.failUnless(verifyObject(IBaseContent, self.dummy))
00128             self.failUnless(verifyObject(IATTopicCriterion, self.dummy))

Definition at line 91 of file test_criteria.py.

00091 
00092     def test_multipleCreateVariants(self):
00093         klass = self.klass
00094         id = 'dummy'
00095         field = 'dummyfield'
00096         if klass is not None:
00097             dummy = klass(id, field)
00098             self.failUnless(dummy.getId(), id)
00099             self.failUnless(dummy.Field(), field)
00100 
00101             dummy = klass(id=id, field=field)
00102             self.failUnless(dummy.getId(), id)
00103             self.failUnless(dummy.Field(), field)
00104 
00105             dummy = klass(field, oid=id)
00106             self.failUnless(dummy.getId(), id)
00107             self.failUnless(dummy.Field(), field)
00108 
00109             dummy = klass(field=field, oid=id)
00110             self.failUnless(dummy.getId(), id)
00111             self.failUnless(dummy.Field(), field)

Definition at line 514 of file test_criteria.py.

00514 
00515     def test_portaltype_query(self):
00516         self.dummy.Schema()['field'].set(self.dummy,'portal_type')
00517         self.dummy.setValue(('Document','Folder','Topic'))
00518         items = self.dummy.getCriteriaItems()
00519         self.assertEquals(len(items),1)
00520         query = items[0][1]
00521         field = items[0][0]
00522         self.assertEquals(field, 'portal_type')
00523         self.assertEquals(query, ('Document','Folder','Topic'))

Definition at line 553 of file test_criteria.py.

00553 
00554     def test_type_ids_names(self):
00555         # test introduced when fixing Plone bug #6981
00556         self.dummy.Schema()['field'].set(self.dummy,'Type')
00557         type_ids, type_names = self.dummy.getCurrentValues().keys(), self.dummy.getCurrentValues().values()
00558         self.failUnless('Page' in type_ids)
00559         self.failUnless('Page' in type_names)
00560         self.failIf('Document' in type_ids)
00561         self.failIf('Document' in type_names)
00562         # use type id everytime
00563         self.dummy.Schema()['field'].set(self.dummy,'portal_type')
00564         type_ids, type_names = self.dummy.getCurrentValues().keys(), self.dummy.getCurrentValues().values()
00565         self.failUnless('Document' in type_ids)
00566         self.failUnless('Document' in type_names)
00567         self.failIf('Page' in type_ids)
00568         self.failIf('Page' in type_names)
00569         
00570         
00571 tests.append(TestATPortalTypeCriterion)
00572 

Here is the call graph for this function:

Reimplemented in ATContentTypes.tests.test_criteria.TestATBaseCriterion.

Definition at line 112 of file test_criteria.py.

00112 
00113     def test_typeInfo(self):
00114         if self.dummy is not None:
00115             ti = self.dummy.getTypeInfo()
00116             self.failUnlessEqual(ti.getId(), self.portal_type)
00117             self.failUnlessEqual(ti.Title(), self.title)
00118             self.failUnlessEqual(ti.Metatype(), self.meta_type)
        

Definition at line 539 of file test_criteria.py.

00539 
00540     def test_types_v_portaltypes(self):
00541         #Using the Types index as field should cause the vocabulary to use the
00542         #type Title rather than the type name
00543         self.dummy.Schema()['field'].set(self.dummy,'portal_type')
00544         type_ids, type_names = self.dummy.getCurrentValues().keys(), self.dummy.getCurrentValues().values()
00545         self.failUnless('Large Plone Folder' in type_names)
00546         self.failUnless('Large Folder' not in type_names)
00547         self.dummy.Schema()['field'].set(self.dummy,'Type')
00548         type_ids, type_names = self.dummy.getCurrentValues().keys(), self.dummy.getCurrentValues().values()
00549         self.failUnless('Large Plone Folder' not in type_names)
00550         self.failUnless('Large Folder' in type_names)
00551         #ensure that blacklisted types aren't here either
00552         self.failUnless('Simple String Criterion' not in type_names)

Here is the call graph for this function:

Definition at line 524 of file test_criteria.py.

00524 
00525     def test_vocabulary(self):
00526         #Should return standard types, but not blacklisted types
00527         self.dummy.Schema()['field'].set(self.dummy,'portal_types')
00528         self.failUnless('Document' in self.dummy.getCurrentValues().keys())
00529         self.failUnless('ATSimpleStringCriterion' not in self.dummy.getCurrentValues().keys())

Definition at line 530 of file test_criteria.py.

00530 
00531     def test_vocabulary_sorts_by_type(self):
00532         #Should return standard types, but not blacklisted types
00533         self.dummy.Schema()['field'].set(self.dummy,'Type')
00534         type_ids, type_names = self.dummy.getCurrentValues().keys(), self.dummy.getCurrentValues().values()
00535         self.failUnless(type_names.index('Page') > type_names.index('Event'))
00536         self.dummy.Schema()['field'].set(self.dummy,'portal_types')
00537         type_ids, type_names = self.dummy.getCurrentValues().keys(), self.dummy.getCurrentValues().values()
00538         self.failUnless(type_names.index('Document')< type_names.index('Event'))

Here is the call graph for this function:

Definition at line 129 of file test_criteria.py.

00129 
00130     def test_Z3implements(self):
00131         if self.dummy is not None:
00132             iface = Z3IATTopicCriterion
00133             self.failUnless(Z3verifyObject(iface, self.dummy))


Member Data Documentation

Definition at line 70 of file test_criteria.py.

Reimplemented from ATContentTypes.tests.test_criteria.CriteriaTest.

Definition at line 508 of file test_criteria.py.

Reimplemented from ATContentTypes.tests.test_criteria.CriteriaTest.

Definition at line 510 of file test_criteria.py.

Reimplemented from ATContentTypes.tests.test_criteria.CriteriaTest.

Definition at line 511 of file test_criteria.py.

string ATContentTypes.tests.test_criteria.TestATPortalTypeCriterion.title = 'Portal Types Criterion' [static]

Reimplemented from ATContentTypes.tests.test_criteria.CriteriaTest.

Definition at line 509 of file test_criteria.py.


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