1
0
Fork 0
mirror of synced 2024-12-13 02:45:45 -05:00

Test support for double-star globs

This commit is contained in:
Tim Byrne 2019-11-26 16:24:36 -06:00
parent 5986cd7943
commit 24e6e81713
No known key found for this signature in database
GPG key ID: 14DB4FC2465A4B12

View file

@ -46,12 +46,8 @@ def test_empty(runner, paths, encrypt):
assert 'EIF_COUNT:0' in run.out, 'EIF should be empty' assert 'EIF_COUNT:0' in run.out, 'EIF should be empty'
@pytest.mark.usefixtures('ds1_repo_copy') def create_test_encrypt_data(paths):
def test_file_parse_encrypt(runner, paths): """Generate test data for testing encrypt"""
"""Test parse_encrypt
Test an array of supported features of the encrypt configuration.
"""
edata = '' edata = ''
expected = set() expected = set()
@ -126,6 +122,30 @@ def test_file_parse_encrypt(runner, paths):
expected.add('ex ex/file4') expected.add('ex ex/file4')
expected.add('ex ex/file6.text') expected.add('ex ex/file6.text')
# double star
edata += 'doublestar/**/file*\n'
edata += '!**/file3\n'
paths.work.join('doublestar/a/b/file1').write('', ensure=True)
paths.work.join('doublestar/c/d/file2').write('', ensure=True)
paths.work.join('doublestar/e/f/file3').write('', ensure=True)
paths.work.join('doublestar/g/h/nomatch').write('', ensure=True)
expected.add('doublestar/a/b/file1')
expected.add('doublestar/c/d/file2')
# doublestar/e/f/file3 is excluded
return edata, expected
@pytest.mark.usefixtures('ds1_repo_copy')
def test_file_parse_encrypt(runner, paths):
"""Test parse_encrypt
Test an array of supported features of the encrypt configuration.
"""
# generate test data & expectations
edata, expected = create_test_encrypt_data(paths)
# write encrypt file # write encrypt file
print(f'ENCRYPT:\n---\n{edata}---\n') print(f'ENCRYPT:\n---\n{edata}---\n')
paths.encrypt.write(edata) paths.encrypt.write(edata)