Add an `--unsafe` option to `check-yaml`
diff --git a/tests/check_yaml_test.py b/tests/check_yaml_test.py
index de3b383..aa357f1 100644
--- a/tests/check_yaml_test.py
+++ b/tests/check_yaml_test.py
@@ -22,7 +22,7 @@
f = tmpdir.join('test.yaml')
f.write('---\nfoo\n---\nbar\n')
- # should failw without the setting
+ # should fail without the setting
assert check_yaml((f.strpath,))
# should pass when we allow multiple documents
@@ -33,3 +33,22 @@
f = tmpdir.join('test.yaml')
f.write('[')
assert check_yaml(('--allow-multiple-documents', f.strpath))
+
+
+def test_check_yaml_unsafe(tmpdir):
+ f = tmpdir.join('test.yaml')
+ f.write(
+ 'some_foo: !vault |\n'
+ ' $ANSIBLE_VAULT;1.1;AES256\n'
+ ' deadbeefdeadbeefdeadbeef\n',
+ )
+ # should fail "safe" check
+ assert check_yaml((f.strpath,))
+ # should pass when we allow unsafe documents
+ assert not check_yaml(('--unsafe', f.strpath))
+
+
+def test_check_yaml_unsafe_still_fails_on_syntax_errors(tmpdir):
+ f = tmpdir.join('test.yaml')
+ f.write('[')
+ assert check_yaml(('--unsafe', f.strpath))