1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-06 13:07:59 +00:00

adding more tests

This commit is contained in:
deadc0de6
2018-07-21 13:11:30 +02:00
parent 1222a75244
commit 5601abedda
3 changed files with 115 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ from dotdrop.dotdrop import importer
from dotdrop.dotdrop import compare
from dotdrop.dotfile import Dotfile
from dotdrop.installer import Installer
from dotdrop.comparator import Comparator
from dotdrop.templategen import Templategen
from tests.helpers import *
@@ -32,12 +33,20 @@ class TestCompare(unittest.TestCase):
t = Templategen(base=opts['dotpath'], debug=True)
inst = Installer(create=opts['create'], backup=opts['backup'],
dry=opts['dry'], base=opts['dotpath'], debug=True)
comp = Comparator()
results = {}
for dotfile in dotfiles:
same, _ = inst.compare(t, tmp, opts['profile'],
dotfile.src, dotfile.dst)
ret, insttmp = inst.install_to_temp(t, tmp, opts['profile'],
dotfile.src, dotfile.dst)
if not ret:
results[path] = False
continue
diff = comp.compare(insttmp, dotfile.dst)
print('XXXX diff for {} and {}:\n{}'.format(dotfile.src,
dotfile.dst,
diff))
path = os.path.expanduser(dotfile.dst)
results[path] = same
results[path] = diff == ''
return results
def edit_content(self, path, newcontent, binary=False):