Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
MimetypesRegistry.tests.test_magic.TestGuessMagic Class Reference
Inheritance diagram for MimetypesRegistry.tests.test_magic.TestGuessMagic:
Inheritance graph
[legend]
Collaboration diagram for MimetypesRegistry.tests.test_magic.TestGuessMagic:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def test_guessMime

Public Attributes

 registry

Detailed Description

Definition at line 15 of file test_magic.py.


Member Function Documentation

Definition at line 17 of file test_magic.py.

00017 
00018     def afterSetUp(self):
00019         ATSiteTestCase.afterSetUp(self)
00020         self.registry = self.portal.mimetypes_registry

Definition at line 21 of file test_magic.py.

00021 
00022     def test_guessMime(self):
00023         for filename, expected in samplefiles:
00024             file = open(input_file_path(filename))
00025             data = file.read()
00026             file.close()
00027             
00028             # use method direct
00029             got = guessMime(data)
00030             self.failUnlessEqual(got, expected)
00031             
00032             # use mtr-tool
00033             got_from_tool = self.registry.classify(data)
00034             self.failUnlessEqual(got_from_tool, expected)            
00035             
00036             # now cut it to the first 8k if greater
00037             if len(data) > 8192:
00038                 data=data[:8192]
00039                 got_cutted = self.registry.classify(data)
00040                 self.failUnlessEqual(got_cutted, expected)          
00041 

Here is the call graph for this function:


Member Data Documentation

Definition at line 19 of file test_magic.py.


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