def test_symlink_outside_tree(self): os.symlink('../foo', self._abspath('outside')) with self.assertRaises(AssertionError): filemod_db._resolve_symlinks('outside')
def test_symlink_outside_tree_in_directory_component(self): os.symlink('../foo', self._abspath('outside_dir')) with self.assertRaises(AssertionError): filemod_db._resolve_symlinks('outside_dir/bar')
def test_absolute_symlink_in_directory_component(self): os.symlink('/etc', self._abspath('absdir')) with self.assertRaises(AssertionError): filemod_db._resolve_symlinks('absdir/issue')
def test_absolute_symlink(self): os.symlink('/etc/issue', self._abspath('abs')) with self.assertRaises(AssertionError): filemod_db._resolve_symlinks('abs')
def test_symlink_loop(self): os.symlink('loop', self._abspath('loop')) with self.assertRaises(OSError): filemod_db._resolve_symlinks('loop')
def test_symlink_in_a_directory_component(self): self.assertEqual( os.path.join('third_party', 'werkzeug-src', 'werkzeug', 'foo.js'), filemod_db._resolve_symlinks( os.path.join('third_party', 'werkzeug', 'foo.js')))
def test_not_a_symlinks(self): self.assertEqual('i1', filemod_db._resolve_symlinks('i1'))