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
bdbb3bb4
Commit
bdbb3bb4
authored
Apr 14, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing unit tests for synchronize due to earlier changes
parent
40b958e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
test/units/TestSynchronize.py
+19
-10
No files found.
test/units/TestSynchronize.py
View file @
bdbb3bb4
...
...
@@ -19,12 +19,20 @@ class FakeRunner(object):
self
.
private_key_file
=
None
self
.
check
=
False
def
_execute_module
(
self
,
conn
,
tmp
,
module_name
,
args
,
inject
=
None
):
def
_execute_module
(
self
,
conn
,
tmp
,
module_name
,
args
,
async_jid
=
None
,
async_module
=
None
,
async_limit
=
None
,
inject
=
None
,
persist_files
=
False
,
complex_args
=
None
,
delete_remote_tmp
=
True
):
self
.
executed_conn
=
conn
self
.
executed_tmp
=
tmp
self
.
executed_module_name
=
module_name
self
.
executed_args
=
args
self
.
executed_async_jid
=
async_jid
self
.
executed_async_module
=
async_module
self
.
executed_async_limit
=
async_limit
self
.
executed_inject
=
inject
self
.
executed_persist_files
=
persist_files
self
.
executed_complex_args
=
complex_args
self
.
executed_delete_remote_tmp
=
delete_remote_tmp
def
noop_on_check
(
self
,
inject
):
return
self
.
check
...
...
@@ -60,7 +68,7 @@ class TestSynchronize(unittest.TestCase):
x
.
run
(
conn
,
"/tmp"
,
"synchronize"
,
"src=/tmp/foo dest=/tmp/bar"
,
inject
)
assert
runner
.
executed_inject
[
'delegate_to'
]
==
"127.0.0.1"
,
"was not delegated to 127.0.0.1"
assert
runner
.
executed_
args
==
"dest=root@el6.lab.net:/tmp/bar src=/tmp/foo"
,
"wrong args used"
assert
runner
.
executed_
complex_args
==
{
"dest"
:
"root@el6.lab.net:/tmp/bar"
,
"src"
:
"/tmp/foo"
}
,
"wrong args used"
assert
runner
.
sudo
==
None
,
"sudo was not reset to None"
def
test_synchronize_action_sudo
(
self
):
...
...
@@ -86,8 +94,9 @@ class TestSynchronize(unittest.TestCase):
x
.
run
(
conn
,
"/tmp"
,
"synchronize"
,
"src=/tmp/foo dest=/tmp/bar"
,
inject
)
assert
runner
.
executed_inject
[
'delegate_to'
]
==
"127.0.0.1"
,
"was not delegated to 127.0.0.1"
assert
runner
.
executed_args
==
'dest=root@el6.lab.net:/tmp/bar src=/tmp/foo rsync_path="sudo rsync"'
,
\
"wrong args used:
%
s"
%
runner
.
executed_args
assert
runner
.
executed_complex_args
==
{
'dest'
:
'root@el6.lab.net:/tmp/bar'
,
'src'
:
'/tmp/foo'
,
'rsync_path'
:
'"sudo rsync"'
},
"wrong args used"
assert
runner
.
sudo
==
True
,
"sudo was not reset to True"
...
...
@@ -117,9 +126,9 @@ class TestSynchronize(unittest.TestCase):
assert
runner
.
transport
==
"paramiko"
,
"runner transport was changed"
assert
runner
.
remote_user
==
"jtanner"
,
"runner remote_user was changed"
assert
runner
.
executed_inject
[
'delegate_to'
]
==
"127.0.0.1"
,
"was not delegated to 127.0.0.1"
assert
"dest_port"
not
in
runner
.
executed_args
,
"dest_port should not have been set"
assert
"src=/tmp/foo"
in
runner
.
executed_args
,
"source was set incorrectly"
assert
"dest=/tmp/bar"
in
runner
.
executed_args
,
"dest was set incorrectly"
assert
"dest_port"
not
in
runner
.
executed_
complex_
args
,
"dest_port should not have been set"
assert
runner
.
executed_complex_args
.
get
(
"src"
)
==
"/tmp/foo"
,
"source was set incorrectly"
assert
runner
.
executed_complex_args
.
get
(
"dest"
)
==
"/tmp/bar"
,
"dest was set incorrectly"
def
test_synchronize_action_vagrant
(
self
):
...
...
@@ -158,7 +167,7 @@ class TestSynchronize(unittest.TestCase):
assert
runner
.
remote_user
==
"jtanner"
,
"runner remote_user was changed"
assert
runner
.
executed_inject
[
'delegate_to'
]
==
"127.0.0.1"
,
"was not delegated to 127.0.0.1"
assert
runner
.
executed_inject
[
'ansible_ssh_user'
]
==
"vagrant"
,
"runner user was changed"
assert
"dest_port=2222"
in
runner
.
executed_args
,
"remote port was not set to 2222"
assert
"src=/tmp/foo"
in
runner
.
executed_args
,
"source was set incorrectly"
assert
"dest=vagrant@127.0.0.1:/tmp/bar"
in
runner
.
executed_args
,
"dest was set incorrectly"
assert
runner
.
executed_complex_args
.
get
(
"dest_port"
)
==
"2222"
,
"remote port was not set to 2222"
assert
runner
.
executed_complex_args
.
get
(
"src"
)
==
"/tmp/foo"
,
"source was set incorrectly"
assert
runner
.
executed_complex_args
.
get
(
"dest"
)
==
"vagrant@127.0.0.1:/tmp/bar"
,
"dest was set incorrectly"
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