summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Vagelpohl <jens@netz.ooo>2005-09-11 12:55:33 +0000
committerJens Vagelpohl <jens@netz.ooo>2005-09-11 12:55:33 +0000
commitbf4bfc618ec5bc862ebebf96f5bc01b45246303c (patch)
treec79d1fb365b5160d608a8d107fc135f205fa848f
parent1d69b2cab13c909f437109d5d7848840566d685f (diff)
downloadCMFFSContent-bf4bfc618ec5bc862ebebf96f5bc01b45246303c.zip
CMFFSContent-bf4bfc618ec5bc862ebebf96f5bc01b45246303c.tar.gz
- use the real CMFSetup way to set up a test portal
- clean out unused imports
-rw-r--r--tests/base/testcase.py45
-rw-r--r--tests/test_FSFolder.py2
2 files changed, 14 insertions, 33 deletions
diff --git a/tests/base/testcase.py b/tests/base/testcase.py
index 7dd6058..619bdfc 100644
--- a/tests/base/testcase.py
+++ b/tests/base/testcase.py
@@ -1,25 +1,10 @@
from os import curdir
from os.path import join, abspath, dirname
-from Products.CMFCore.TypesTool import ContentFactoryMetadata
-from Products.CMFCore.TypesTool import TypesTool
-from Products.CMFCore.SkinsTool import SkinsTool
-from Products.CMFCore.DirectoryView import addDirectoryViews
from Products.CMFCore.tests.base.testcase import FSDVTest
from Products.CMFCore.tests.base.testcase import RequestTest
-from Products.CMFCore.tests.base.testcase import TransactionalTest
-from Products.CMFCore.tests.base.dummy import DummyFolder
-from Products.CMFFSContent import cmffscontent_globals
from Products.CMFFSContent.FSFolder import FSFolder
-from Products.CMFFSContent import FSDocument
-from Products.CMFFSContent import FSImage
-from Products.CMFFSContent import FSFile
-
-FTIS = ( FSDocument.factory_type_information
- + FSImage.factory_type_information
- + FSFile.factory_type_information
- )
try:
__file__
@@ -40,18 +25,24 @@ class FSContentTest(FSDVTest, RequestTest):
_skinname = 'fscontent'
_layername = 'content'
- def _makeSite( self, id='testsite' ):
+ def _makeSite( self, site_id='testsite' ):
factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite
- factory(id, 'CMFDefault:default', snapshot=False)
+ factory( site_id
+ , 'CMFDefault:default'
+ , snapshot=False
+ , extension_ids=('CMFFSContent:default',)
+ )
- return getattr( self.root, id )
+ return getattr(self.root, site_id)
- def _registerDirectory(self,object=None):
+ def _registerDirectory(self, site_object=None):
from Products.CMFFSContent.FSFolder import registerContentDirectory
from Products.CMFFSContent.FSFolder import addFSFolders
registerContentDirectory(self._skinname, self.tempname)
- if object is not None:
+ if site_object is None:
ob = self.ob = self._makeSite()
+ else:
+ self.ob = site_object
addFSFolders(self.ob, self._skinname, self.tempname)
@@ -60,19 +51,9 @@ class FSContentTest(FSDVTest, RequestTest):
RequestTest.setUp(self)
FSDVTest.setUp(self)
registerContentMetaType('FOLDER', FSFolder)
- self._registerDirectory(self)
- skins_tool = getattr(self.ob, 'portal_skins')
- types_tool = getattr(self.ob, 'portal_types')
-
- addDirectoryViews(skins_tool, 'skins', cmffscontent_globals)
-
- for t in FTIS:
- cfm = apply(ContentFactoryMetadata, (), t)
- if t['id'] not in types_tool.objectIds():
- types_tool._setObject(t['id'], cfm)
+ self._registerDirectory()
def tearDown(self):
FSDVTest.tearDown(self)
- TransactionalTest.tearDown(self)
-
+ RequestTest.tearDown(self)
diff --git a/tests/test_FSFolder.py b/tests/test_FSFolder.py
index c0a774d..6d96930 100644
--- a/tests/test_FSFolder.py
+++ b/tests/test_FSFolder.py
@@ -225,7 +225,7 @@ class FSFolderFolderTests(FSContentTest):
# In order to regenerate the FSDV data we need to remove and
# register again, that way the newly registered meta_type is used
self.ob._delObject('content')
- self._registerDirectory()
+ self._registerDirectory(self.ob)
testfolder = self.ob.content.test_directory
self.failUnless(isinstance(testfolder, DummyFSFolderSurrogate))