mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-04 20:19:46 +00:00
Merge branch 'master' into clear-on-install
This commit is contained in:
@@ -149,6 +149,7 @@ def _fake_args():
|
||||
args['profiles'] = False
|
||||
args['files'] = False
|
||||
args['install'] = False
|
||||
args['uninstall'] = False
|
||||
args['compare'] = False
|
||||
args['import'] = False
|
||||
args['update'] = False
|
||||
@@ -247,7 +248,7 @@ def create_yaml_keyval(pairs, parent_dir=None, top_key=None):
|
||||
|
||||
# pylint: disable=W0102
|
||||
def populate_fake_config(config, dotfiles={}, profiles={}, actions={},
|
||||
trans={}, trans_write={}, variables={},
|
||||
trans_install={}, trans_update={}, variables={},
|
||||
dynvariables={}):
|
||||
"""Adds some juicy content to config files"""
|
||||
is_path = isinstance(config, str)
|
||||
@@ -258,8 +259,8 @@ def populate_fake_config(config, dotfiles={}, profiles={}, actions={},
|
||||
config['dotfiles'] = dotfiles
|
||||
config['profiles'] = profiles
|
||||
config['actions'] = actions
|
||||
config['trans_read'] = trans
|
||||
config['trans_write'] = trans_write
|
||||
config['trans_install'] = trans_install
|
||||
config['trans_update'] = trans_update
|
||||
config['variables'] = variables
|
||||
config['dynvariables'] = dynvariables
|
||||
|
||||
|
||||
@@ -239,10 +239,10 @@ class TestImport(unittest.TestCase):
|
||||
},
|
||||
'a_log_ed': 'echo 2',
|
||||
},
|
||||
'trans': {
|
||||
'trans_install': {
|
||||
't_log_ed': 'echo 3',
|
||||
},
|
||||
'trans_write': {
|
||||
'trans_update': {
|
||||
'tw_log_ed': 'echo 4',
|
||||
},
|
||||
'variables': {
|
||||
@@ -273,10 +273,10 @@ class TestImport(unittest.TestCase):
|
||||
},
|
||||
'a_log_ing': 'echo a',
|
||||
},
|
||||
'trans': {
|
||||
'trans_install': {
|
||||
't_log_ing': 'echo b',
|
||||
},
|
||||
'trans_write': {
|
||||
'trans_update': {
|
||||
'tw_log_ing': 'echo c',
|
||||
},
|
||||
'variables': {
|
||||
@@ -352,10 +352,10 @@ class TestImport(unittest.TestCase):
|
||||
self.assertFalse(any(a.endswith('ing') for a in actions))
|
||||
|
||||
# testing transformations
|
||||
transformations = ycont['trans_read'].keys()
|
||||
transformations = ycont['trans_install'].keys()
|
||||
self.assertTrue(all(t.endswith('ed') for t in transformations))
|
||||
self.assertFalse(any(t.endswith('ing') for t in transformations))
|
||||
transformations = ycont['trans_write'].keys()
|
||||
transformations = ycont['trans_update'].keys()
|
||||
self.assertTrue(all(t.endswith('ed') for t in transformations))
|
||||
self.assertFalse(any(t.endswith('ing') for t in transformations))
|
||||
|
||||
@@ -394,10 +394,10 @@ class TestImport(unittest.TestCase):
|
||||
self.assertFalse(any(action.endswith('ed') for action in actions))
|
||||
|
||||
# testing transformations
|
||||
transformations = ycont['trans_read'].keys()
|
||||
transformations = ycont['trans_install'].keys()
|
||||
self.assertTrue(all(t.endswith('ing') for t in transformations))
|
||||
self.assertFalse(any(t.endswith('ed') for t in transformations))
|
||||
transformations = ycont['trans_write'].keys()
|
||||
transformations = ycont['trans_update'].keys()
|
||||
self.assertTrue(all(t.endswith('ing') for t in transformations))
|
||||
self.assertFalse(any(t.endswith('ed') for t in transformations))
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ def fake_config(path, dotfiles, profile,
|
||||
file.write('actions:\n')
|
||||
for action in actions:
|
||||
file.write(f' {action.key}: {action.action}\n')
|
||||
file.write('trans:\n')
|
||||
file.write('trans_install:\n')
|
||||
for trans in transs:
|
||||
file.write(f' {trans.key}: {trans.action}\n')
|
||||
file.write('config:\n')
|
||||
@@ -46,9 +46,9 @@ def fake_config(path, dotfiles, profile,
|
||||
file.write(' actions:\n')
|
||||
for action in dotfile.actions:
|
||||
file.write(f' - {action.key}\n')
|
||||
if dotfile.trans_r:
|
||||
for trans in dotfile.trans_r:
|
||||
file.write(f' trans_read: {trans.key}\n')
|
||||
if dotfile.trans_install:
|
||||
for trans in dotfile.trans_install:
|
||||
file.write(f' trans_install: {trans.key}\n')
|
||||
file.write('profiles:\n')
|
||||
file.write(f' {profile}:\n')
|
||||
file.write(' dotfiles:\n')
|
||||
@@ -174,7 +174,7 @@ exec bspwm
|
||||
fcontent9, _ = create_random_file(tmp, content=trans1)
|
||||
dst9 = os.path.join(dst, get_string(6))
|
||||
dotfile9 = Dotfile(get_string(6), dst9, os.path.basename(fcontent9),
|
||||
trans_r=[the_trans])
|
||||
trans_install=[the_trans])
|
||||
|
||||
# to test template
|
||||
f10, _ = create_random_file(tmp, content='{{@@ header() @@}}')
|
||||
|
||||
@@ -127,7 +127,7 @@ class TestImporter(unittest.TestCase):
|
||||
path, _ = create_random_file(tmpdir)
|
||||
|
||||
imp = Importer('profile', None, '', '', {})
|
||||
self.assertEqual(imp._apply_trans_w(path, trans), None)
|
||||
self.assertEqual(imp._apply_trans_update(path, trans), None)
|
||||
|
||||
|
||||
class TestActions(unittest.TestCase):
|
||||
|
||||
@@ -121,7 +121,7 @@ class TestUpdate(unittest.TestCase):
|
||||
# retrieve the path of the sub in the dotpath
|
||||
d1indotpath = os.path.join(opt.dotpath, dotfile.src)
|
||||
d1indotpath = os.path.expanduser(d1indotpath)
|
||||
dotfile.trans_w = trans
|
||||
dotfile.trans_update = trans
|
||||
|
||||
# update template
|
||||
opt.update_path = [d3t]
|
||||
|
||||
@@ -298,10 +298,10 @@ profiles:
|
||||
},
|
||||
'a_log_ed': 'echo 2',
|
||||
},
|
||||
'trans': {
|
||||
'trans_install': {
|
||||
't_log_ed': 'echo 3',
|
||||
},
|
||||
'trans_write': {
|
||||
'trans_update': {
|
||||
'tw_log_ed': 'echo 4',
|
||||
},
|
||||
'variables': {
|
||||
@@ -335,10 +335,10 @@ profiles:
|
||||
},
|
||||
'a_log_ing': 'echo a',
|
||||
},
|
||||
'trans': {
|
||||
'trans_install': {
|
||||
't_log_ing': 'echo b',
|
||||
},
|
||||
'trans_write': {
|
||||
'trans_update': {
|
||||
'tw_log_ing': 'echo c',
|
||||
},
|
||||
'variables': {
|
||||
@@ -406,8 +406,8 @@ profiles:
|
||||
self.assert_is_subset(post_ed, post_ing)
|
||||
|
||||
# test transactions
|
||||
self.assert_is_subset(imported_cfg.trans_r, importing_cfg.trans_r)
|
||||
self.assert_is_subset(imported_cfg.trans_w, importing_cfg.trans_w)
|
||||
self.assert_is_subset(imported_cfg.trans_install, importing_cfg.trans_install)
|
||||
self.assert_is_subset(imported_cfg.trans_update, importing_cfg.trans_update)
|
||||
|
||||
# test variables
|
||||
imported_vars = {
|
||||
@@ -504,10 +504,10 @@ profiles:
|
||||
},
|
||||
'a_log': 'echo 2',
|
||||
},
|
||||
'trans': {
|
||||
'trans_install': {
|
||||
't_log': 'echo 3',
|
||||
},
|
||||
'trans_write': {
|
||||
'trans_update': {
|
||||
'tw_log': 'echo 4',
|
||||
},
|
||||
'variables': {
|
||||
@@ -542,10 +542,10 @@ profiles:
|
||||
},
|
||||
'a_log': 'echo a',
|
||||
},
|
||||
'trans': {
|
||||
'trans_install': {
|
||||
't_log': 'echo b',
|
||||
},
|
||||
'trans_write': {
|
||||
'trans_update': {
|
||||
'tw_log': 'echo c',
|
||||
},
|
||||
'variables': {
|
||||
@@ -605,12 +605,12 @@ profiles:
|
||||
|
||||
# test transactions
|
||||
self.assertFalse(any(
|
||||
imported_cfg.trans_r[key] == importing_cfg.trans_r[key]
|
||||
for key in imported_cfg.trans_r
|
||||
imported_cfg.trans_install[key] == importing_cfg.trans_install[key]
|
||||
for key in imported_cfg.trans_install
|
||||
))
|
||||
self.assertFalse(any(
|
||||
imported_cfg.trans_w[key] == importing_cfg.trans_w[key]
|
||||
for key in imported_cfg.trans_w
|
||||
imported_cfg.trans_update[key] == importing_cfg.trans_update[key]
|
||||
for key in imported_cfg.trans_update
|
||||
))
|
||||
|
||||
# test variables
|
||||
|
||||
Reference in New Issue
Block a user