1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 22:04:44 +00:00

Move link from bool to enum

This commit is contained in:
Marcel Robitaille
2019-01-20 15:02:09 -04:00
parent 247653c2c2
commit 170df39c60
4 changed files with 23 additions and 11 deletions

View File

@@ -88,6 +88,7 @@ def load_config(confpath, profile):
opts['safe'] = True
opts['installdiff'] = True
opts['link'] = False
opts['link_children'] = False
opts['showdiff'] = True
opts['debug'] = True
opts['dopts'] = ''

View File

@@ -4,14 +4,18 @@ Copyright (c) 2017, deadc0de6
basic unittest for the install function
"""
import os
import unittest
import filecmp
from tests.helpers import *
from dotdrop.config import Cfg
from tests.helpers import create_dir, get_string, get_tempdir, clean, \
create_random_file, load_config
from dotdrop.dotfile import Dotfile
from dotdrop.installer import Installer
from dotdrop.action import Action
from dotdrop.dotdrop import cmd_install
from dotdrop.linktypes import LinkTypes
class TestInstall(unittest.TestCase):
@@ -50,7 +54,10 @@ exec bspwm
f.write(' {}:\n'.format(d.key))
f.write(' dst: {}\n'.format(d.dst))
f.write(' src: {}\n'.format(d.src))
f.write(' link: {}\n'.format(str(d.link).lower()))
f.write(' link: {}\n'
.format(str(d.link == LinkTypes.PARENTS).lower()))
f.write(' link_children: {}\n'
.format(str(d.link == LinkTypes.CHILDREN).lower()))
if len(d.actions) > 0:
f.write(' actions:\n')
for action in d.actions:
@@ -101,7 +108,7 @@ exec bspwm
# to test backup
f4, c4 = create_random_file(tmp)
dst4 = os.path.join(dst, get_string(6))
d4 = Dotfile(get_string(6), dst4, os.path.basename(f4))
d4 = Dotfile(key=get_string(6), dst=dst4, src=os.path.basename(f4))
with open(dst4, 'w') as f:
f.write(get_string(16))

View File

@@ -7,14 +7,12 @@ basic unittest for the update function
import unittest
import os
import yaml
from dotdrop.config import Cfg
from dotdrop.dotdrop import cmd_update
from dotdrop.dotdrop import cmd_importer
from dotdrop.dotfile import Dotfile
from tests.helpers import *
from tests.helpers import create_dir, get_string, get_tempdir, clean, \
create_random_file, create_fake_config, load_config, edit_content
class TestUpdate(unittest.TestCase):