From 8d60e0ca5c0a91f0513f7e8ef635b783599ffaac Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Tue, 25 Sep 2018 08:35:57 +0200 Subject: [PATCH] more test for update on directory --- tests/test_update.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/test_update.py b/tests/test_update.py index 06b0343..3a226b8 100644 --- a/tests/test_update.py +++ b/tests/test_update.py @@ -58,6 +58,11 @@ class TestUpdate(unittest.TestCase): self.assertTrue(os.path.exists(d1)) self.addCleanup(clean, d1) + # create the directory to test + dpath = os.path.join(fold_config, get_string(5)) + dir1 = create_dir(dpath) + dirf1, _ = create_random_file(dpath) + # create the config file profile = get_string(5) confpath = create_fake_config(dotfilespath, @@ -67,21 +72,29 @@ class TestUpdate(unittest.TestCase): create=self.CONFIG_CREATE) self.assertTrue(os.path.exists(confpath)) conf, opts = load_config(confpath, profile) - dfiles = [d1] + dfiles = [d1, dir1] # import the files importer(opts, conf, dfiles) conf, opts = load_config(confpath, profile) - # edit the file + # edit the files self.edit_content(d1, 'newcontent') + self.edit_content(dirf1, 'newcontent') + + # add more file + dirf2, _ = create_random_file(dpath) # update it - update(opts, conf, d1) + opts['safe'] = False + opts['debug'] = True + update(opts, conf, [d1, dir1]) # test content newcontent = open(d1, 'r').read() self.assertTrue(newcontent == 'newcontent') + newcontent = open(dirf1, 'r').read() + self.assertTrue(newcontent == 'newcontent') def main():