Ignore:
Timestamp:
8 Nov 2011, 14:13:30 (13 years ago)
Author:
uli
Message:

Finish default file store name chooser and related tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/branches/ulif-extimgstore/src/waeup/sirp/tests/test_imagestorage.py

    r7002 r7032  
    310310        self.assertEqual(contents, 'Hi there!')
    311311
    312 class NameChooserTests(unittest.TestCase):
     312class FileStoreNameChooserTests(FunctionalTestCase):
     313
     314    layer = FunctionalLayer
    313315
    314316    def test_iface(self):
     317        # we provide the interfaces we promise to do
    315318        obj = FileStoreNameChooser(None)
    316319        verifyClass(IFileStoreNameChooser, FileStoreNameChooser)
    317320        verifyObject(IFileStoreNameChooser, obj)
     321        return
     322
     323    def test_accessible_as_adapter(self):
     324        # we can get a file name chooser via adapter
     325        chooser = IFileStoreNameChooser(object())
     326        self.assertTrue(
     327            isinstance(chooser, FileStoreNameChooser))
     328        return
     329
     330    def test_check_name(self):
     331        # default file name choosers accept any string
     332        chooser = FileStoreNameChooser(object())
     333        self.assertEqual(chooser.checkName('Hi there!'), True)
     334        self.assertEqual(chooser.checkName(None), False)
     335        return
     336
     337    def test_choose_name(self):
     338        # we get a simple string if we do not pass in a valid string
     339        chooser = FileStoreNameChooser(object())
     340        self.assertEqual(chooser.chooseName('myname'), 'myname')
     341        self.assertEqual(chooser.chooseName(None), u'unknown_file')
    318342        return
    319343
Note: See TracChangeset for help on using the changeset viewer.