From: Zooko O'Whielacronx Date: Tue, 9 Aug 2011 22:01:15 +0000 (-0700) Subject: drop-upload test for non-existent local dir separately from test for non-directory... X-Git-Url: https://git.rkrishnan.org/pf/content/en/footer/statistics?a=commitdiff_plain;h=5633375d267e57289597c1f4d5a3732f94adc996;p=tahoe-lafs%2Ftahoe-lafs.git 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 --- 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)