1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-05 20:12:57 +00:00

handle not existing included profile

This commit is contained in:
deadc0de6
2017-09-16 10:11:36 +02:00
parent 1700176c70
commit 538944fb35
2 changed files with 20 additions and 3 deletions

View File

@@ -79,9 +79,6 @@ class TestConfig(unittest.TestCase):
pf2key: {'dotfiles': [df1key]}
}
print(content)
print(content['profiles'])
# save the new config
with open(confpath, 'w') as f:
yaml.dump(content, f, default_flow_style=False, indent=2)
@@ -105,6 +102,23 @@ class TestConfig(unittest.TestCase):
self.assertTrue(df1key in [x.key for x in dotfiles])
self.assertFalse(df2key in [x.key for x in dotfiles])
# test not existing included profile
# edit the config
with open(confpath, 'r') as f:
content = yaml.load(f)
content['profiles'] = {
pf1key: {'dotfiles': [df2key], 'include': ['host2']},
pf2key: {'dotfiles': [df1key], 'include': ['host3']}
}
# save the new config
with open(confpath, 'w') as f:
yaml.dump(content, f, default_flow_style=False, indent=2)
# do the tests
conf = Cfg(confpath)
self.assertTrue(conf is not None)
def main():
unittest.main()