mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-06 04:23:01 +00:00
refactor links and add more tests
This commit is contained in:
@@ -50,15 +50,19 @@ class TestConfig(unittest.TestCase):
|
||||
self.assertTrue(conf.dump() != '')
|
||||
|
||||
def test_def_link(self):
|
||||
self._test_link_import('nolink', LinkTypes.PARENT, 'link')
|
||||
self._test_link_import('nolink', LinkTypes.LINK, 'link')
|
||||
self._test_link_import('nolink', LinkTypes.NOLINK, 'nolink')
|
||||
self._test_link_import('nolink', LinkTypes.CHILDREN, 'link_children')
|
||||
self._test_link_import('link', LinkTypes.PARENT, 'link')
|
||||
self._test_link_import('nolink',
|
||||
LinkTypes.LINK_CHILDREN,
|
||||
'link_children')
|
||||
self._test_link_import('link', LinkTypes.LINK, 'link')
|
||||
self._test_link_import('link', LinkTypes.NOLINK, 'nolink')
|
||||
self._test_link_import('link', LinkTypes.CHILDREN, 'link_children')
|
||||
self._test_link_import('link_children', LinkTypes.PARENT, 'link')
|
||||
self._test_link_import('link',
|
||||
LinkTypes.LINK_CHILDREN,
|
||||
'link_children')
|
||||
self._test_link_import('link_children', LinkTypes.LINK, 'link')
|
||||
self._test_link_import('link_children', LinkTypes.NOLINK, 'nolink')
|
||||
self._test_link_import('link_children', LinkTypes.CHILDREN,
|
||||
self._test_link_import('link_children', LinkTypes.LINK_CHILDREN,
|
||||
'link_children')
|
||||
self._test_link_import_fail('whatever')
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ class TestImport(unittest.TestCase):
|
||||
o.import_path = dfiles
|
||||
cmd_importer(o)
|
||||
# import symlink
|
||||
o.import_link = LinkTypes.PARENT
|
||||
o.import_link = LinkTypes.LINK
|
||||
sfiles = [dotfile6, dotfile7]
|
||||
o.import_path = sfiles
|
||||
cmd_importer(o)
|
||||
@@ -191,12 +191,6 @@ class TestImport(unittest.TestCase):
|
||||
sub4)
|
||||
self.assertTrue(os.path.exists(s4))
|
||||
|
||||
# test symlink on filesystem
|
||||
self.assertTrue(os.path.islink(dotfile6))
|
||||
self.assertTrue(os.path.realpath(dotfile6) == indt6)
|
||||
self.assertTrue(os.path.islink(dotfile7))
|
||||
self.assertTrue(os.path.realpath(dotfile7) == indt7)
|
||||
|
||||
cmd_list_profiles(o)
|
||||
cmd_list_files(o)
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ from dotdrop.installer import Installer
|
||||
from dotdrop.action import Action
|
||||
from dotdrop.dotdrop import cmd_install
|
||||
from dotdrop.options import BACKUP_SUFFIX
|
||||
from dotdrop.linktypes import LinkTypes
|
||||
from dotdrop.utils import header
|
||||
from dotdrop.linktypes import LinkTypes
|
||||
|
||||
|
||||
class TestInstall(unittest.TestCase):
|
||||
@@ -57,12 +57,7 @@ exec bspwm
|
||||
f.write(' {}:\n'.format(d.key))
|
||||
f.write(' dst: {}\n'.format(d.dst))
|
||||
f.write(' src: {}\n'.format(d.src))
|
||||
if d.link == LinkTypes.CHILDREN:
|
||||
f.write(' link_children: {}\n'
|
||||
.format(str(d.link == LinkTypes.CHILDREN).lower()))
|
||||
else:
|
||||
f.write(' link: {}\n'
|
||||
.format(str(d.link == LinkTypes.PARENT).lower()))
|
||||
f.write(' link: {}\n'.format(d.link.name.lower()))
|
||||
if len(d.actions) > 0:
|
||||
f.write(' actions:\n')
|
||||
for action in d.actions:
|
||||
@@ -122,7 +117,8 @@ exec bspwm
|
||||
f5, c5 = create_random_file(tmp)
|
||||
dst5 = os.path.join(dst, get_string(6))
|
||||
self.addCleanup(clean, dst5)
|
||||
d5 = Dotfile(get_string(6), dst5, os.path.basename(f5), link=True)
|
||||
d5 = Dotfile(get_string(6), dst5,
|
||||
os.path.basename(f5), link=LinkTypes.LINK)
|
||||
|
||||
# create the dotfile directories in dotdrop
|
||||
dir1 = create_dir(os.path.join(tmp, get_string(6)))
|
||||
@@ -148,7 +144,8 @@ exec bspwm
|
||||
sub4, _ = create_random_file(dir2)
|
||||
self.assertTrue(os.path.exists(sub4))
|
||||
# make up the dotfile
|
||||
d7 = Dotfile(get_string(6), dst7, os.path.basename(dir2), link=True)
|
||||
d7 = Dotfile(get_string(6), dst7,
|
||||
os.path.basename(dir2), link=LinkTypes.LINK)
|
||||
|
||||
# to test actions
|
||||
value = get_string(12)
|
||||
|
||||
Reference in New Issue
Block a user