drop-upload test for non-existent local dir separately from test for non-directory local dir

A candidate patch for #1429 has a bug when it is using FilePath.is_dir() to detect whether the configured local dir exists and is a directory. FilePath.is_dir() raises exception, instead of returning False, if the thing doesn't exist. This test is to make sure that DropUploader.__init__ raise different exceptions for those two cases.
refs #1429
This commit is contained in:
Zooko O'Whielacronx 2011-08-09 15:01:15 -07:00
parent 720bc2433b
commit 5633375d26

View File

@ -167,10 +167,15 @@ class MockTest(DropUploadTestMixin, unittest.TestCase):
self.shouldFail(AssertionError, 'invalid local dir', 'could not be represented',
DropUploader, client, upload_dircap, '\xFF', inotify=fake_inotify)
self.shouldFail(AssertionError, 'non-existant local dir', 'not an existing directory',
self.shouldFail(AssertionError, 'non-existant local dir', 'there is no directory',
DropUploader, client, upload_dircap, os.path.join(self.basedir, "Laputa"), inotify=fake_inotify)
self.shouldFail(AssertionError, 'bad URI', 'not a directory URI',
fp = filepath.FilePath(self.basedir).child('IM_NOT_A_DIR')
fp.touch()
self.shouldFail(AssertionError, 'non-existant local dir', 'is not a directory',
DropUploader, client, upload_dircap, fp.path, inotify=fake_inotify)
self.shouldFail(AssertionError, 'bad cap', 'does not refer to a directory',
DropUploader, client, 'bad', errors_dir, inotify=fake_inotify)
self.shouldFail(AssertionError, 'non-directory cap', 'does not refer to a directory',
DropUploader, client, 'URI:LIT:foo', errors_dir, inotify=fake_inotify)