From 5633375d267e57289597c1f4d5a3732f94adc996 Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx Date: Tue, 9 Aug 2011 15:01:15 -0700 Subject: [PATCH] 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 --- src/allmydata/test/test_drop_upload.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/allmydata/test/test_drop_upload.py b/src/allmydata/test/test_drop_upload.py index ab403a76..81fa51d8 100644 --- a/src/allmydata/test/test_drop_upload.py +++ b/src/allmydata/test/test_drop_upload.py @@ -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) -- 2.45.2