[CMF-checkins] CVS: CMF - test_ContentTypeRegistry.py:1.5

tseaver@digicool.com tseaver@digicool.com
Tue, 5 Jun 2001 14:36:42 -0400 (EDT)


Update of /cvs-repository/CMF/CMFCore/tests
In directory korak.digicool.com:/tmp/cvs-serv8904/tests

Modified Files:
	test_ContentTypeRegistry.py 
Log Message:


 - Ensure that ContentTypeRegistry's "Test" tab doesn't puke if no
   MIMEtype is entered, or if one is entered which doesn't have a
   '/' in it (Tracker #292).



--- Updated File test_ContentTypeRegistry.py in package CMF --
--- test_ContentTypeRegistry.py	2001/06/02 03:45:02	1.4
+++ test_ContentTypeRegistry.py	2001/06/05 18:36:41	1.5
@@ -18,6 +18,8 @@
         assert pred.getMinorType() == 'plain'
         assert pred( 'foo', 'text/plain', 'asdfljksadf' )
         assert not pred( 'foo', 'text/html', 'asdfljksadf' )
+        assert not pred( '', '', '' )
+        assert not pred( '', 'asdf', '' )
 
     def test_wildcard( self ):
         pred = MajorMinorPredicate( 'alltext' )
@@ -131,12 +133,16 @@
 
     def test_lookup( self ):
         reg = ContentTypeRegistry()
+        reg.addPredicate( 'image', 'major_minor' )
+        reg.getPredicate( 'image' ).edit( 'image', '' )
         reg.addPredicate( 'onlyfoo', 'name_regex' )
         reg.getPredicate( 'onlyfoo' ).edit( 'foo' )
         reg.assignTypeName( 'onlyfoo', 'Foo' )
         assert reg.findTypeName( 'foo', 'text/plain', 'asdfljksadf' ) == 'Foo'
         assert not reg.findTypeName( 'fargo', 'text/plain', 'asdfljksadf' )
         assert not reg.findTypeName( 'bar', 'text/plain', 'asdfljksadf' )
+        assert reg.findTypeName( 'foo', '', '' ) == 'Foo'
+        assert reg.findTypeName( 'foo', None, None ) == 'Foo'
 
 def test_suite():
     suite = unittest.TestSuite()