def test_add_file(self): directory = model.DirHandler(self.path1) directory.connect() directory.add(os.path.abspath(__file__)) self.assertTrue( os.path.isfile("".join([self.path1, os.path.abspath(__file__)])))
def test_add_symlink_file(self): directory = model.DirHandler(self.path1) directory.connect() directory.add(os.path.abspath(self.symlink_path)) self.assertTrue( os.path.isfile("".join( [self.path1, os.path.abspath(self.symlink_path)])) and os.path.islink("".join( [self.path1, os.path.abspath(self.symlink_path)])))
def test_add_directory(self): directory = model.DirHandler(self.path1) directory.connect() directory.add(os.path.abspath(self.path2)) self.assertEqual( os.listdir("".join([self.path1, self.path2])).sort(), [ "symlink_to_file", "context.py", "model_test.py", "symlink_to_directory", "recursive_symlink", ].sort(), )
def test_is_connected(self): directory = model.DirHandler(self.path2) self.assertTrue(directory.is_connected())
def test_connect(self): directory = model.DirHandler(self.path1) directory.connect() self.assertTrue(os.access(self.path1, os.F_OK))