Test support for double-star globs
This commit is contained in:
parent
5986cd7943
commit
24e6e81713
1 changed files with 26 additions and 6 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue