aboutsummaryrefslogtreecommitdiffstats
path: root/test_dotfiles.py
diff options
context:
space:
mode:
authorGravatar Jon Bernard <jbernard@tuxion.com> 2013-12-17 19:27:58 -0500
committerGravatar Jon Bernard <jbernard@tuxion.com> 2013-12-17 19:27:58 -0500
commitc5e6a9b5e53e98fc063a970dc7069559b32e40ce (patch)
treedf6a4753bfc764b9aa26503e6c81f15e19ea1060 /test_dotfiles.py
parent3adefcc085f8cc4bdb3941927447d308bd301eb0 (diff)
downloaddotfiles-c5e6a9b5e53e98fc063a970dc7069559b32e40ce.tar.gz
dotfiles-c5e6a9b5e53e98fc063a970dc7069559b32e40ce.tar.bz2
dotfiles-c5e6a9b5e53e98fc063a970dc7069559b32e40ce.zip
Add unit test for removing a dotfile with a missing target
If the remove operation is issued on a dotfile pointing to a target that's already been removed from the repository, then the symlink should just be removed quietly. Re: #25
Diffstat (limited to 'test_dotfiles.py')
-rwxr-xr-xtest_dotfiles.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/test_dotfiles.py b/test_dotfiles.py
index 761496e..7d2605e 100755
--- a/test_dotfiles.py
+++ b/test_dotfiles.py
@@ -310,5 +310,26 @@ class DotfilesTestCase(unittest.TestCase):
os.path.join(self.homedir, dotfile)))
+ def test_missing_remove(self):
+ """Test removing a dotfile that's been removed from the repository."""
+
+ repo_file = os.path.join(self.repository, 'testdotfile')
+
+ touch(repo_file)
+
+ dotfiles = core.Dotfiles(
+ homedir=self.homedir, repository=self.repository,
+ prefix='', ignore=[], externals={}, packages=[],
+ dry_run=False)
+
+ dotfiles.sync()
+
+ # remove the dotfile from the repository, homedir symlink is now broken
+ os.remove(repo_file)
+
+ # remove the broken symlink
+ dotfiles.remove(['.testdotfile'])
+
+
if __name__ == '__main__':
unittest.main()