Exemplo n.º 1
0
 def test_create_symlinks(self, os):
     source, target = self.setup_symlink(os)
     source_directory = os.path.dirname(source)
     assert os.path.exists(source)
     assert not os.path.exists(target)
     self.config.overwrite = True
     core.create_symlinks(self.config, source_directory, self.home)
     self.verify_symlink(os, source, target)
Exemplo n.º 2
0
 def test_create_symlinks_with_single_directory_includes(self, os):
     include = self.setup_file(self.dotfiles_directory, '.foo')
     target = os.path.join(self.home, '.foo')
     self.config.includes = [include]
     core.create_symlinks(self.config, self.dotfiles_directory, self.home)
     assert os.path.exists(target)
     assert os.path.islink(target)
     assert os.readlink(target) == include
Exemplo n.º 3
0
 def test_create_symlinks_with_single_directory_includes(self, os):
     include = self.setup_file(self.dotfiles_directory, '.foo')
     target = os.path.join(self.home, '.foo')
     self.config.includes = [include]
     core.create_symlinks(self.config, self.dotfiles_directory, self.home)
     assert os.path.exists(target)
     assert os.path.islink(target)
     assert os.readlink(target) == include
Exemplo n.º 4
0
 def test_create_symlinks(self, os):
     source, target = self.setup_symlink(os)
     source_directory = os.path.dirname(source)
     assert os.path.exists(source)
     assert not os.path.exists(target)
     self.config.overwrite = True
     core.create_symlinks(self.config, source_directory, self.home)
     self.verify_symlink(os, source, target)
Exemplo n.º 5
0
 def test_create_symlinks_with_no_overwrite(self, os):
     source, target = self.setup_symlink(os)
     source_directory = os.path.dirname(source)
     self.setup_file(target)
     self.config.overwrite = False
     core.create_symlinks(self.config, source_directory, self.home)
     assert os.path.exists(source)
     assert os.path.exists(target)
     assert not os.path.islink(target)
Exemplo n.º 6
0
 def test_create_symlinks_with_no_overwrite(self, os):
     source, target = self.setup_symlink(os)
     source_directory = os.path.dirname(source)
     self.setup_file(target)
     self.config.overwrite = False
     core.create_symlinks(self.config, source_directory, self.home)
     assert os.path.exists(source)
     assert os.path.exists(target)
     assert not os.path.islink(target)
Exemplo n.º 7
0
 def test_create_symlinks_with_multiple_sources(self, os):
     source_files = ['.bash_profile', '.gitignore', '.gvimrc', '.vimrc']
     source_directories = ['bin', '.git', '.vim']
     self.config.excludes = ['.git', '.gitignore']
     self.config.overwrite = True
     for item in source_files:
         self.setup_file(self.dotfiles_directory, item)
         self.setup_file(self.home, item)
     for item in source_directories:
         self.setup_directory(self.dotfiles_directory, item)
         self.setup_file(self.home, item)
     core.create_symlinks(self.config, self.dotfiles_directory, self.home)
     for item in source_files:
         if item in self.config.excludes:
             assert not os.path.islink(os.path.join(self.home, item))
         else:
             source = os.path.join(self.dotfiles_directory, item)
             target = os.path.join(self.home, item)
             self.verify_symlink(os, source, target)
Exemplo n.º 8
0
 def test_create_symlinks_with_multiple_sources(self, os):
     source_files = ['.bash_profile', '.gitignore', '.gvimrc', '.vimrc']
     source_directories = ['bin', '.git', '.vim']
     self.config.excludes = ['.git', '.gitignore']
     self.config.overwrite = True
     for item in source_files:
         self.setup_file(self.dotfiles_directory, item)
         self.setup_file(self.home, item)
     for item in source_directories:
         self.setup_directory(self.dotfiles_directory, item)
         self.setup_file(self.home, item)
     core.create_symlinks(self.config, self.dotfiles_directory, self.home)
     for item in source_files:
         if item in self.config.excludes:
             assert not os.path.islink(os.path.join(self.home, item))
         else:
             source = os.path.join(self.dotfiles_directory, item)
             target = os.path.join(self.home, item)
             self.verify_symlink(os, source, target)
Exemplo n.º 9
0
 def test_create_with_bad_includes(self, os):
     self.config.includes = ['', 'non-existing', os.sep]
     core.create_symlinks(self.config, self.dotfiles_directory, self.home)
     assert not os.path.exists(os.path.join(self.dotfiles_directory,
                                            'non-existing'))
Exemplo n.º 10
0
 def test_create_symlinks_with_no_source_directory(self, os):
     self.setup_directory(self.home)
     source_directory = os.path.join(self.home, 'non-existant-directory')
     core.create_symlinks(self.config, source_directory, self.home)
     for item in os.listdir(self.home):
         assert not os.path.islink(item)
Exemplo n.º 11
0
 def test_create_symlinks_with_same_source_and_target(self, os):
     core.create_symlinks(self.config, self.home, self.home)
     for item in os.listdir(self.home):
         assert not os.path.islink(os.path.join(self.home, item))
Exemplo n.º 12
0
 def test_create_with_bad_includes(self, os):
     self.config.includes = ['', 'non-existing', os.sep]
     core.create_symlinks(self.config, self.dotfiles_directory, self.home)
     assert not os.path.exists(
         os.path.join(self.dotfiles_directory, 'non-existing'))
Exemplo n.º 13
0
 def test_create_symlinks_with_no_source_directory(self, os):
     self.setup_directory(self.home)
     source_directory = os.path.join(self.home, 'non-existant-directory')
     core.create_symlinks(self.config, source_directory, self.home)
     for item in os.listdir(self.home):
         assert not os.path.islink(item)
Exemplo n.º 14
0
 def test_create_symlinks_with_same_source_and_target(self, os):
     core.create_symlinks(self.config, self.home, self.home)
     for item in os.listdir(self.home):
         assert not os.path.islink(os.path.join(self.home, item))