1
0
Fork 0
mirror of synced 2024-11-16 22:35:35 -05:00

Create tests for underscores in distro/family

This commit is contained in:
Tim Byrne 2022-09-13 12:38:18 -05:00
parent 67c684473d
commit 0f8538d3e3
No known key found for this signature in database
GPG key ID: 14DB4FC2465A4B12

View file

@ -315,3 +315,37 @@ def test_template_recording(runner, yadm, cmd_generated):
assert run.success
assert run.err == ''
assert run.out.rstrip() == expected
def test_underscores_in_distro_and_family(runner, yadm):
"""Test replacing spaces in distro / distro_family with underscores"""
local_distro = 'test distro'
local_distro_family = 'test family'
filenames = {
'filename##distro.test distro': 1004,
'filename##distro.test-distro': 0,
'filename##distro.test_distro': 1004,
'filename##distro_family.test family': 1008,
'filename##distro_family.test-family': 0,
'filename##distro_family.test_family': 1008,
}
script = f"""
YADM_TEST=1 source {yadm}
score=0
local_distro="{local_distro}"
local_distro_family="{local_distro_family}"
"""
expected = ''
for filename in filenames:
script += f"""
score_file "{filename}"
echo "{filename}"
echo "$score"
"""
expected += filename + '\n'
expected += str(filenames[filename]) + '\n'
run = runner(command=['bash'], inp=script)
assert run.success
assert run.err == ''
assert run.out == expected