diff --git a/tests/helpers.py b/tests/helpers.py index 5019e88..f1783f6 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -38,7 +38,8 @@ def get_tempdir(): return tempfile.mkdtemp(suffix=TMPSUFFIX) -def create_random_file(directory, content=None, binary=False): +def create_random_file(directory, content=None, + binary=False, template=False): '''Create a new file in directory with random content.''' fname = get_string(8) mode = 'w' @@ -46,9 +47,15 @@ def create_random_file(directory, content=None, binary=False): mode = 'wb' if content is None: if binary: - content = bytes(get_string(100), 'ascii') + pre = bytes() + if template: + pre = bytes('{{@@ header() @@}}\n', 'ascii') + content = bytes('{}{}\n'.format(pre, get_string(100)), 'ascii') else: - content = get_string(100) + pre = '' + if template: + pre = '{{@@ header() @@}}\n' + content = '{}{}\n'.format(pre, get_string(100)) path = os.path.join(directory, fname) with open(path, mode) as f: f.write(content) diff --git a/tests/test_compare.py b/tests/test_compare.py index 3b0165a..c180bf3 100644 --- a/tests/test_compare.py +++ b/tests/test_compare.py @@ -100,6 +100,7 @@ class TestCompare(unittest.TestCase): create=self.CONFIG_CREATE) self.assertTrue(os.path.exists(confpath)) conf, opts = load_config(confpath, profile) + opts['longkey'] = True dfiles = [d1, d2, d3, d4, d5] # import the files diff --git a/tests/test_install.py b/tests/test_install.py index e1b15ec..acad9b5 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -119,7 +119,7 @@ exec bspwm self.addCleanup(clean, dir1) dst6 = os.path.join(dst, get_string(6)) # fill with files - sub1, _ = create_random_file(dir1) + sub1, _ = create_random_file(dir1, template=True) self.assertTrue(os.path.exists(sub1)) sub2, _ = create_random_file(dir1) self.assertTrue(os.path.exists(sub2))