Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
bbd9921d
Commit
bbd9921d
authored
Oct 07, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding a negative test for new safe_load
parent
4cb7f654
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
test/v2/parsing/yaml/test_yaml.py
+12
-0
No files found.
test/v2/parsing/yaml/test_yaml.py
View file @
bbd9921d
# TODO: header
import
unittest
from
yaml.scanner
import
ScannerError
from
ansible.parsing.yaml
import
safe_load
from
ansible.parsing.yaml.objects
import
AnsibleMapping
...
...
@@ -36,6 +39,11 @@ data3 = '''---
list1key3: list1value3
'''
bad_data1
=
'''---
foo: bar
bam: baz
'''
class
TestSafeLoad
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
@@ -44,6 +52,10 @@ class TestSafeLoad(unittest.TestCase):
def
tearDown
(
self
):
pass
def
test_safe_load_bad
(
self
):
# test the loading of bad yaml data
self
.
assertRaises
(
ScannerError
,
safe_load
,
bad_data1
)
def
test_safe_load
(
self
):
# test basic dictionary
res
=
safe_load
(
data1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment