diff options
Diffstat (limited to 'tests/test_project.py')
| -rw-r--r-- | tests/test_project.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_project.py b/tests/test_project.py index 6d82da11..dc41f4c0 100644 --- a/tests/test_project.py +++ b/tests/test_project.py | |||
| @@ -314,6 +314,14 @@ class LinkFile(CopyLinkTestCase): | |||
| 314 | lf._Link() | 314 | lf._Link() |
| 315 | self.assertExists(os.path.join(self.topdir, 'foo')) | 315 | self.assertExists(os.path.join(self.topdir, 'foo')) |
| 316 | 316 | ||
| 317 | def test_src_self(self): | ||
| 318 | """Link to the project itself.""" | ||
| 319 | dest = os.path.join(self.topdir, 'foo', 'bar') | ||
| 320 | lf = self.LinkFile('.', 'foo/bar') | ||
| 321 | lf._Link() | ||
| 322 | self.assertExists(dest) | ||
| 323 | self.assertEqual('../git-project', os.readlink(dest)) | ||
| 324 | |||
| 317 | def test_dest_subdir(self): | 325 | def test_dest_subdir(self): |
| 318 | """Link a file to a subdir of a checkout.""" | 326 | """Link a file to a subdir of a checkout.""" |
| 319 | src = os.path.join(self.worktree, 'foo.txt') | 327 | src = os.path.join(self.worktree, 'foo.txt') |
| @@ -323,6 +331,21 @@ class LinkFile(CopyLinkTestCase): | |||
| 323 | lf._Link() | 331 | lf._Link() |
| 324 | self.assertExists(os.path.join(self.topdir, 'sub', 'dir', 'foo', 'bar')) | 332 | self.assertExists(os.path.join(self.topdir, 'sub', 'dir', 'foo', 'bar')) |
| 325 | 333 | ||
| 334 | def test_src_block_relative(self): | ||
| 335 | """Do not allow relative symlinks.""" | ||
| 336 | BAD_SOURCES = ( | ||
| 337 | './', | ||
| 338 | '..', | ||
| 339 | '../', | ||
| 340 | 'foo/.', | ||
| 341 | 'foo/./bar', | ||
| 342 | 'foo/..', | ||
| 343 | 'foo/../foo', | ||
| 344 | ) | ||
| 345 | for src in BAD_SOURCES: | ||
| 346 | lf = self.LinkFile(src, 'foo') | ||
| 347 | self.assertRaises(error.ManifestInvalidPathError, lf._Link) | ||
| 348 | |||
| 326 | def test_update(self): | 349 | def test_update(self): |
| 327 | """Make sure changed targets get updated.""" | 350 | """Make sure changed targets get updated.""" |
| 328 | dest = os.path.join(self.topdir, 'sym') | 351 | dest = os.path.join(self.topdir, 'sym') |
