- Timestamp:
- 4 Oct 2012, 09:48:56 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/tests/test_imagestorage.py
r9283 r9286 35 35 IFileStoreNameChooser, IExtFileStore, IFileStoreHandler,) 36 36 37 class HelperFuncsTests(unittest.TestCase):38 39 def setUp(self):40 self.workdir = tempfile.mkdtemp()41 42 def tearDown(self):43 shutil.rmtree(self.workdir)44 45 37 class FileStoreNameChooserTests(FunctionalTestCase): 46 38 … … 93 85 verifyClass(IExtFileStore, ExtFileStore) 94 86 verifyObject(IExtFileStore, obj) 87 self.root = obj.root # for cleanup 95 88 return 96 89 … … 104 97 105 98 def test_create_instance(self): 99 # we can create file stores with or without a root dir set 106 100 storage1 = ExtFileStore() 107 101 storage2 = ExtFileStore(root=self.workdir) … … 227 221 super(FunctionalExtFileStoreTests, self).setUp() 228 222 self.workdir = tempfile.mkdtemp() 223 self.root = None 229 224 self.samplefile = os.path.join(self.workdir, 'sample') 230 225 self.otherfile = os.path.join(self.workdir, 'other') … … 251 246 self.fd2.close() 252 247 shutil.rmtree(self.workdir) 248 if self.root is not None and os.path.exists(self.root): 249 shutil.rmtree(self.root) 253 250 return 254 251 … … 325 322 # if we register a file name chooser, we can also get a file 326 323 # by context and attribute 327 fs = ExtFileStore(root=self.workdir)328 324 context = CustomContext() 329 325 file_id1 = IFileStoreNameChooser(context).chooseName() 330 326 file_id2 = IFileStoreNameChooser(context).chooseName(attr='img') 331 327 file_id3 = IFileStoreNameChooser(context).chooseName(attr='doc') 332 fs = ExtFileStore(root=self.workdir)333 # c reate three files for a single context, each which334 # different content328 # create three files for a single context, each with different 329 # content 330 fs = ExtFileStore(root=self.workdir) 335 331 fs.createFile(file_id1, StringIO('my sample 1')) 336 332 fs.createFile(file_id2, StringIO('my sample 2'))
Note: See TracChangeset for help on using the changeset viewer.