Back to index

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

List of all members.

Public Member Functions

def test_z2interfaces
def test_z3interfaces
def test_empty
def test_simple
def test_wildcard

Private Member Functions

def _makeOne

Detailed Description

Definition at line 22 of file test_ContentTypeRegistry.py.


Member Function Documentation

Definition at line 24 of file test_ContentTypeRegistry.py.

00024 
00025     def _makeOne(self, *args, **kw):
00026         from Products.CMFCore.ContentTypeRegistry import MajorMinorPredicate
00027 
00028         return MajorMinorPredicate(*args, **kw)

Definition at line 45 of file test_ContentTypeRegistry.py.

00045 
00046     def test_empty( self ):
00047         pred = self._makeOne('empty')
00048         assert pred.getMajorType() == 'None'
00049         assert pred.getMinorType() == 'None'
00050         assert not pred( 'foo', 'text/plain', 'asdfljksadf' )

Here is the call graph for this function:

Definition at line 51 of file test_ContentTypeRegistry.py.

00051 
00052     def test_simple( self ):
00053         pred = self._makeOne('plaintext')
00054         pred.edit( 'text', 'plain' )
00055         assert pred.getMajorType() == 'text'
00056         assert pred.getMinorType() == 'plain'
00057         assert pred( 'foo', 'text/plain', 'asdfljksadf' )
00058         assert not pred( 'foo', 'text/html', 'asdfljksadf' )
00059         assert not pred( '', '', '' )
00060         assert not pred( '', 'asdf', '' )

Here is the call graph for this function:

Definition at line 61 of file test_ContentTypeRegistry.py.

00061 
00062     def test_wildcard( self ):
00063         pred = self._makeOne('alltext')
00064         pred.edit( 'text', '' )
00065         assert pred.getMajorType() == 'text'
00066         assert pred.getMinorType() == ''
00067         assert pred( 'foo', 'text/plain', 'asdfljksadf' )
00068         assert pred( 'foo', 'text/html', 'asdfljksadf' )
00069         assert not pred( 'foo', 'image/png', 'asdfljksadf' )
00070 
00071         pred.edit( '', 'html' )
00072         assert pred.getMajorType() == ''
00073         assert pred.getMinorType() == 'html'
00074         assert not pred( 'foo', 'text/plain', 'asdfljksadf' )
00075         assert pred( 'foo', 'text/html', 'asdfljksadf' )
00076         assert not pred( 'foo', 'image/png', 'asdfljksadf' )
00077 

Here is the call graph for this function:

Definition at line 29 of file test_ContentTypeRegistry.py.

00029 
00030     def test_z2interfaces(self):
00031         from Interface.Verify import verifyClass
00032         from Products.CMFCore.ContentTypeRegistry import MajorMinorPredicate
00033         from Products.CMFCore.interfaces.ContentTypeRegistry \
00034                 import ContentTypeRegistryPredicate \
00035                 as IContentTypeRegistryPredicate
00036 
00037         verifyClass(IContentTypeRegistryPredicate, MajorMinorPredicate)

Definition at line 38 of file test_ContentTypeRegistry.py.

00038 
00039     def test_z3interfaces(self):
00040         from zope.interface.verify import verifyClass
00041         from Products.CMFCore.ContentTypeRegistry import MajorMinorPredicate
00042         from Products.CMFCore.interfaces import IContentTypeRegistryPredicate
00043 
00044         verifyClass(IContentTypeRegistryPredicate, MajorMinorPredicate)


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