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
399d57a6
Commit
399d57a6
authored
Sep 21, 2013
by
Michael Scherer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add more tests :
- test part of ansible.runner.filter_plugins.core - test ansible.utils.unfrackpath
parent
4efdf0d4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
test/TestFilters.py
+23
-2
test/TestUtils.py
+6
-0
No files found.
test/TestFilters.py
View file @
399d57a6
...
...
@@ -4,6 +4,7 @@ Test bundled filters
import
unittest
,
tempfile
,
shutil
from
ansible
import
playbook
,
inventory
,
callbacks
import
ansible.runner.filter_plugins.core
INVENTORY
=
inventory
.
Inventory
([
'localhost'
])
...
...
@@ -62,6 +63,26 @@ class TestFilters(unittest.TestCase):
f
.
write
(
data
)
return
name
def
test_bool_none
(
self
):
a
=
ansible
.
runner
.
filter_plugins
.
core
.
bool
(
None
)
assert
a
==
None
def
test_bool_true
(
self
):
a
=
ansible
.
runner
.
filter_plugins
.
core
.
bool
(
True
)
assert
a
==
True
def
test_bool_yes
(
self
):
a
=
ansible
.
runner
.
filter_plugins
.
core
.
bool
(
'Yes'
)
assert
a
==
True
def
test_bool_no
(
self
):
a
=
ansible
.
runner
.
filter_plugins
.
core
.
bool
(
'Foo'
)
assert
a
==
False
def
test_quotes
(
self
):
a
=
ansible
.
runner
.
filter_plugins
.
core
.
quote
(
'ls | wc -l'
)
assert
a
==
"'ls | wc -l'"
#def test_filters(self):
# this test is pretty low level using a playbook, hence I am disabling it for now -- MPD.
...
...
@@ -80,6 +101,6 @@ class TestFilters(unittest.TestCase):
# stats = callbacks.AggregateStats(),
#).run()
out
=
open
(
dest
)
.
read
()
self
.
assertEqual
(
DEST
,
out
)
#
out = open(dest).read()
#
self.assertEqual(DEST, out)
test/TestUtils.py
View file @
399d57a6
...
...
@@ -15,6 +15,12 @@ class TestUtils(unittest.TestCase):
#####################################
### varReplace function tests
def
test_unfrackpath
(
self
):
os
.
symlink
(
"/etc"
,
"/tmp/etc"
)
a
=
ansible
.
utils
.
unfrackpath
(
'$HOME/../../tmp/etc/'
)
assert
a
==
'/etc'
os
.
unlink
(
'/tmp/etc'
)
def
test_varReplace_simple
(
self
):
template
=
'hello $who'
vars
=
{
...
...
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