21 lines
791 B
Python
21 lines
791 B
Python
import unittest
|
|
|
|
class TestSwapLink(unittest.TestCase):
|
|
|
|
data_dir = "test/data/search_test"
|
|
|
|
def test_wrong_lnk_file(self):
|
|
with self.assertRaises(Exception):
|
|
swap_link(data_dir+"inexistent.txt", data_dir+"/subdir/match1.txt") # inexistent file
|
|
with self.assertRaises(Exception):
|
|
swap_link(data_dir+"/subdir1/match1.txt", data_dir+"/subdir/match1.txt") # non link file
|
|
with self.assertRaises(Exception):
|
|
swap_link(data_dir+"lnk_dir/ln_valid", data_dir+"/subdir/match1.txt") # not broken link
|
|
# TODO: no writing permission on file
|
|
|
|
def test_wrong_tgt_file(self):
|
|
# TODO: non-existing target
|
|
# TODO: target is link to lnk file (can't have 2 symlinks pointing at one another)
|
|
True
|
|
|