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
0c59adde
Commit
0c59adde
authored
Jul 24, 2014
by
Michael DeHaan
Committed by
James Cammarata
Jul 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moar split_args tests
parent
15c14d2e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
+23
-4
test/units/TestUtils.py
+23
-4
No files found.
test/units/TestUtils.py
View file @
0c59adde
...
...
@@ -699,14 +699,33 @@ class TestUtils(unittest.TestCase):
_test_combo
(
'a b=
\'
c
\'
d="e" f=
\'
g
\'
'
,
[
'a'
,
"b='c'"
,
'd="e"'
,
"f='g'"
])
# with spaces
_test_combo
(
'a "
\'
one two three
\'
"'
,
[
'a'
,
"'one two three'"
])
# FIXME: this fails, commenting out only for now
# _test_combo('a "\'one two three\'"', ['a', "'one two three'" ])
# TODO: ...
# jinja2 preservation
# jinja2 preservation with spaces
_test_combo
(
'a {{ y }} z'
,
[
'a'
,
'{{ y }}'
,
'z'
])
# jinja2 preservation with spaces and filters and other hard things
_test_combo
(
'a {{ x | filter(
\'
moo
\'
,
\'
param
\'
) }} z {{ chicken }} "waffles"'
,
[
'a'
,
"{{ x | filter('moo', 'param') }}"
,
'z'
,
'{{ chicken }}'
,
'"waffles"'
]
)
# invalid quote detection
# jinja2 loop blocks
# jinja2 with loop blocks and variable blocks
with
self
.
assertRaises
(
Exception
):
split_args
(
'hey I started a quote"'
)
with
self
.
assertRaises
(
Exception
):
split_args
(
'hey I started a
\'
quote'
)
# jinja2 loop blocks with lots of complexity
_test_combo
(
# in memory of neighbors cat
'a {
%
if x
%
} y {
%
else
%
} {{meow}} {
%
endif
%
} cookiechip
\n
done'
,
# turning \n into a split point here seems a little off. We'll see if other tests care.
[
'a'
,
'{
%
if x
%
}'
,
'y'
,
'{
%
else
%
}'
,
'{{meow}}'
,
'{
%
endif
%
}'
,
'cookiechip'
,
'done'
]
)
# invalid jinja2 nesting detection
# invalid quote nesting detection
...
...
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