def test_fileformatyaml_pass_no_substitutions():
"""Relative path to file should succeed.
Strictly speaking not a unit test.
"""
context = Context({
'ok1': 'ov1',
'fileFormatYamlIn': './tests/testfiles/test.yaml',
'fileFormatYamlOut': './tests/testfiles/out/out.yaml'})
fileformat.run_step(context)
assert context, "context shouldn't be None"
assert len(context) == 3, "context should have 2 items"
assert context['ok1'] == 'ov1'
assert context['fileFormatYamlIn'] == './tests/testfiles/test.yaml'
assert context['fileFormatYamlOut'] == './tests/testfiles/out/out.yaml'
with open('./tests/testfiles/out/out.yaml') as outfile:
outcontents = yaml.load(outfile, Loader=yaml.RoundTripLoader)
assert len(outcontents) == 3
assert outcontents['key'] == 'value1 !£$%# *'
assert outcontents['key2'] == 'blah'
assert outcontents['key3'] == ['l1',
'!£$% *',
'l2',
[
'l31',
{'l32': ['l321', 'l322']}
]
]
# atrociously lazy test clean-up
os.remove('./tests/testfiles/out/out.yaml')
评论列表
文章目录