Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Private Member Functions
CMFCore.tests.test_ContentTypeRegistry.ContentTypeRegistryTests Class Reference

List of all members.

Public Member Functions

def setUp
def test_z2interfaces
def test_z3interfaces
def test_empty
def test_reorder
def test_lookup

Public Attributes

 reg

Private Member Functions

def _makeOne

Detailed Description

Definition at line 220 of file test_ContentTypeRegistry.py.


Member Function Documentation

Definition at line 222 of file test_ContentTypeRegistry.py.

00222 
00223     def _makeOne(self, *args, **kw):
00224         from Products.CMFCore.ContentTypeRegistry import ContentTypeRegistry
00225 
00226         return ContentTypeRegistry(*args, **kw)

Definition at line 227 of file test_ContentTypeRegistry.py.

00227 
00228     def setUp( self ):
00229         self.reg = self._makeOne()

Definition at line 245 of file test_ContentTypeRegistry.py.

00245 
00246     def test_empty( self ):
00247         reg=self.reg
00248         assert reg.findTypeName( 'foo', 'text/plain', 'asdfljksadf' ) is None
00249         assert reg.findTypeName( 'fargo', 'text/plain', 'asdfljksadf' ) is None
00250         assert reg.findTypeName( 'bar', 'text/plain', 'asdfljksadf' ) is None
00251         assert not reg.listPredicates()
00252         self.assertRaises( KeyError, reg.removePredicate, 'xyzzy' )

Definition at line 264 of file test_ContentTypeRegistry.py.

00264 
00265     def test_lookup( self ):
00266         reg=self.reg
00267         reg.addPredicate( 'image', 'major_minor' )
00268         reg.getPredicate( 'image' ).edit( 'image', '' )
00269         reg.addPredicate( 'onlyfoo', 'name_regex' )
00270         reg.getPredicate( 'onlyfoo' ).edit( 'foo' )
00271         reg.assignTypeName( 'onlyfoo', 'Foo' )
00272         assert reg.findTypeName( 'foo', 'text/plain', 'asdfljksadf' ) == 'Foo'
00273         assert not reg.findTypeName( 'fargo', 'text/plain', 'asdfljksadf' )
00274         assert not reg.findTypeName( 'bar', 'text/plain', 'asdfljksadf' )
00275         assert reg.findTypeName( 'foo', '', '' ) == 'Foo'
00276         assert reg.findTypeName( 'foo', None, None ) == 'Foo'
00277 

Here is the call graph for this function:

Definition at line 253 of file test_ContentTypeRegistry.py.

00253 
00254     def test_reorder( self ):
00255         reg=self.reg
00256         predIDs = ( 'foo', 'bar', 'baz', 'qux' )
00257         for predID in predIDs:
00258             reg.addPredicate( predID, 'name_regex' )
00259         ids = tuple( map( lambda x: x[0], reg.listPredicates() ) )
00260         assert ids == predIDs
00261         reg.reorderPredicate( 'bar', 3 )
00262         ids = tuple( map( lambda x: x[0], reg.listPredicates() ) )
00263         assert ids == ( 'foo', 'baz', 'qux', 'bar' )

Definition at line 230 of file test_ContentTypeRegistry.py.

00230 
00231     def test_z2interfaces(self):
00232         from Interface.Verify import verifyClass
00233         from Products.CMFCore.ContentTypeRegistry import ContentTypeRegistry
00234         from Products.CMFCore.interfaces.ContentTypeRegistry \
00235                 import ContentTypeRegistry as IContentTypeRegistry
00236 
00237         verifyClass(IContentTypeRegistry, ContentTypeRegistry)

Definition at line 238 of file test_ContentTypeRegistry.py.

00238 
00239     def test_z3interfaces(self):
00240         from zope.interface.verify import verifyClass
00241         from Products.CMFCore.ContentTypeRegistry import ContentTypeRegistry
00242         from Products.CMFCore.interfaces import IContentTypeRegistry
00243 
00244         verifyClass(IContentTypeRegistry, ContentTypeRegistry)


Member Data Documentation

Definition at line 228 of file test_ContentTypeRegistry.py.


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