Add a test case for a path containing a symlink.

This commit is contained in:
gbn 2011-03-13 15:17:13 -04:00
parent 798893215c
commit eeaf4e8ffa
1 changed files with 19 additions and 1 deletions

View File

@ -4,7 +4,7 @@ from os import path as op
import send2trash.plat_other
from send2trash.plat_other import send2trash as s2t
from configparser import ConfigParser
from tempfile import mkdtemp, NamedTemporaryFile
from tempfile import mkdtemp, NamedTemporaryFile, mktemp
import shutil
import stat
# Could still use cleaning up. But no longer relies on ramfs.
@ -104,5 +104,23 @@ class TestTopdirFailure(TestExtVol):
os.chmod(self.trashTopdir, 0o700) # writable to allow deletion
# Make sure it will find the mount point properly for a file in a symlinked path
class TestSymlink(TestExtVol):
def setUp(self):
# Use mktemp (race conditioney but no symlink equivalent)
# Since is_parent uses realpath(), and our getdev uses is_parent,
# this should work
self.slDir = mktemp(prefix='s2t', dir=op.expanduser('~'))
os.symlink(self.trashTopdir, self.slDir)
def test_trash(self):
s2t(op.join(self.slDir, self.fileName))
def tearDown(self):
if __name__ == '__main__':