Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
CMFCore.tests.test_DirectoryView.DirectoryViewPathTests Class Reference
Inheritance diagram for CMFCore.tests.test_DirectoryView.DirectoryViewPathTests:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.tests.test_DirectoryView.DirectoryViewPathTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def tearDown
def test__generateKey
def test__findProductForPath
def test_getDirectoryInfo
def test_getDirectoryInfo1
def test_getDirectoryInfo2
def test_getDirectoryInfo3
def test_getDirectoryInfo4
def test_getDirectoryInfo5
def test_getDirectoryInfo6
def test_getDirectoryInfo7
def test_getDirectoryInfo8
def test_UnhandleableExpandPath
def test_UnhandleableMinimalPath
def test_registerDirectoryKeys

Public Attributes

 ob

Detailed Description

These test that, no matter what is stored in their dirpath,
FSDV's will do their best to find an appropriate skin
and only do nothing in the case where an appropriate skin
can't be found.

Definition at line 28 of file test_DirectoryView.py.


Member Function Documentation

Definition at line 36 of file test_DirectoryView.py.

00036 
00037     def setUp(self):
00038         self._trap_warning_output()
00039         from Products.CMFCore.DirectoryView import registerDirectory
00040         from Products.CMFCore.DirectoryView import addDirectoryViews
00041         registerDirectory('fake_skins', _globals)
00042         self.ob = DummyFolder()
00043         addDirectoryViews(self.ob, 'fake_skins', _globals)

Here is the call graph for this function:

Definition at line 44 of file test_DirectoryView.py.

00044 
00045     def tearDown(self):
00046         self._free_warning_output()

Here is the call graph for this function:

Definition at line 56 of file test_DirectoryView.py.

00056 
00057     def test__findProductForPath(self):
00058         from Products.CMFCore.DirectoryView import _findProductForPath
00059 
00060         cmfpath = sys.modules['Products.CMFCore'].__path__[0]
00061         self.assertEqual(_findProductForPath(cmfpath),
00062                          ('Products.CMFCore', ''))
00063 
00064         cmfpath = join(cmfpath, 'tests')
00065         self.assertEqual(_findProductForPath(cmfpath),
00066                 ('Products.CMFCore', 'tests'))

Here is the call graph for this function:

Definition at line 47 of file test_DirectoryView.py.

00047 
00048     def test__generateKey(self):
00049         from Products.CMFCore.DirectoryView import _generateKey
00050 
00051         key = _generateKey('Products.CMFCore', 'tests')
00052         self.assertEqual(key.split(':')[0], 'Products.CMFCore')
00053 
00054         subkey = _generateKey('Products.CMFCore', 'tests\foo')
00055         self.failUnless(subkey.startswith(key))

Here is the call graph for this function:

Definition at line 67 of file test_DirectoryView.py.

00067 
00068     def test_getDirectoryInfo(self):
00069         skin = self.ob.fake_skin
00070         skin.manage_properties('Products.CMFCore.tests:fake_skins/fake_skin')
00071         self.failUnless( hasattr(self.ob.fake_skin, 'test1'),
00072                          self.ob.fake_skin.getDirPath() )

Definition at line 77 of file test_DirectoryView.py.

00077 
00078     def test_getDirectoryInfo1(self):
00079         skin = self.ob.fake_skin
00080         skin.manage_properties(r'Products\CMFCore\tests\fake_skins\fake_skin')
00081         self.failUnless( hasattr(self.ob.fake_skin, 'test1'),
00082                          self.ob.fake_skin.getDirPath() )

Definition at line 84 of file test_DirectoryView.py.

00084 
00085     def test_getDirectoryInfo2(self):
00086         skin = self.ob.fake_skin
00087         skin.manage_properties(
00088                   r'C:\Zope\2.5.1\Products\CMFCore\tests\fake_skins\fake_skin')
00089         self.failUnless( hasattr(self.ob.fake_skin, 'test1'),
00090                          self.ob.fake_skin.getDirPath() )

Definition at line 92 of file test_DirectoryView.py.

00092 
00093     def test_getDirectoryInfo3(self):
00094         skin = self.ob.fake_skin
00095         skin.manage_properties('Products/CMFCore/tests/fake_skins/fake_skin')
00096         self.failUnless( hasattr(self.ob.fake_skin, 'test1'),
00097                          self.ob.fake_skin.getDirPath() )

Definition at line 99 of file test_DirectoryView.py.

00099 
00100     def test_getDirectoryInfo4(self):
00101         skin = self.ob.fake_skin
00102         skin.manage_properties(
00103            '/usr/local/zope/2.5.1/Products/CMFCore/tests/fake_skins/fake_skin')
00104         self.failUnless( hasattr(self.ob.fake_skin, 'test1'),
00105                          self.ob.fake_skin.getDirPath() )

Definition at line 107 of file test_DirectoryView.py.

00107 
00108     def test_getDirectoryInfo5(self):
00109         skin = self.ob.fake_skin
00110         skin.manage_properties( mktemp() +
00111                                r'\Products\CMFCore\tests\fake_skins\fake_skin')
00112         self.failUnless( hasattr(self.ob.fake_skin, 'test1'),
00113                          self.ob.fake_skin.getDirPath() )

Definition at line 115 of file test_DirectoryView.py.

00115 
00116     def test_getDirectoryInfo6(self):
00117         skin = self.ob.fake_skin
00118         skin.manage_properties( mktemp() +
00119                                 '/Products/CMFCore/tests/fake_skins/fake_skin')
00120         self.failUnless( hasattr(self.ob.fake_skin, 'test1'),
00121                          self.ob.fake_skin.getDirPath() )

Definition at line 123 of file test_DirectoryView.py.

00123 
00124     def test_getDirectoryInfo7(self):
00125         skin = self.ob.fake_skin
00126         skin.manage_properties(
00127            r'C:\CoolProducts\Zope\Products\CMFCore\tests\fake_skins\fake_skin')
00128         self.failUnless( hasattr(self.ob.fake_skin, 'test1'),
00129                          self.ob.fake_skin.getDirPath() )

Definition at line 132 of file test_DirectoryView.py.

00132 
00133     def test_getDirectoryInfo8(self):
00134         skin = self.ob.fake_skin
00135         skin.manage_properties('CMFCore/tests/fake_skins/fake_skin')
00136         self.failUnless( hasattr(self.ob.fake_skin, 'test1'),
00137                          self.ob.fake_skin.getDirPath() )

Definition at line 161 of file test_DirectoryView.py.

00161 
00162     def test_registerDirectoryKeys(self):
00163         from Products.CMFCore.DirectoryView import _dirreg
00164         dirs = _dirreg._directories
00165         self.failUnless( dirs.has_key('Products.CMFCore.tests:fake_skins/fake_skin'),
00166                          dirs.keys() )
00167         self.assertEqual( self.ob.fake_skin.getDirPath(),
00168                           'Products.CMFCore.tests:fake_skins/fake_skin' )
00169 

Definition at line 139 of file test_DirectoryView.py.

00139 
00140     def test_UnhandleableExpandPath( self ):
00141         from tempfile import mktemp
00142         self._trap_warning_output()
00143         file = mktemp()
00144         self.ob.fake_skin.manage_properties(file)
00145         self.assertEqual(self.ob.fake_skin.objectIds(),[])
00146         # Check that a warning was raised.
00147         from Products.CMFCore import DirectoryView
00148         warnings = [t[0] for t in DirectoryView.__warningregistry__]
00149         text = 'DirectoryView fake_skin refers to a non-existing path %r' % file
00150         self.assert_(text in warnings)
00151         self.failUnless(text in self._our_stderr_stream.getvalue())

Here is the call graph for this function:

Definition at line 152 of file test_DirectoryView.py.

00152 
00153     def test_UnhandleableMinimalPath( self ):
00154         from Products.CMFCore.utils import minimalpath, normalize
00155         from tempfile import mktemp
00156         weirdpath = mktemp()
00157         # we need to normalize 'cos minimalpath does, btu we're not testing
00158         # normalize in this unit test.
00159         self.assertEqual( normalize(weirdpath), minimalpath(weirdpath) )

Here is the call graph for this function:


Member Data Documentation

Definition at line 41 of file test_DirectoryView.py.


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