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
e00d6573
Commit
e00d6573
authored
Oct 01, 2014
by
Toshio Kuratomi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make unittest compatible with python <= 2.6
parent
313f26f8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
test/units/TestModuleUtilsBasic.py
+18
-6
No files found.
test/units/TestModuleUtilsBasic.py
View file @
e00d6573
...
...
@@ -294,12 +294,20 @@ class TestModuleUtilsBasicHelpers(unittest.TestCase):
ssh_output
=
self
.
module
.
_heuristic_log_sanitize
(
ssh_data
)
# Basic functionality: Successfully hid the password
self
.
assertNotIn
(
'pas:word'
,
url_output
)
self
.
assertNotIn
(
'pas:word'
,
ssh_output
)
try
:
self
.
assertNotIn
(
'pas:word'
,
url_output
)
self
.
assertNotIn
(
'pas:word'
,
ssh_output
)
# Slightly more advanced, we hid all of the password despite the ":"
self
.
assertNotIn
(
'pas'
,
url_output
)
self
.
assertNotIn
(
'pas'
,
ssh_output
)
except
AttributeError
:
# python2.6 or less's unittest
self
.
assertFalse
(
'pas:word'
in
url_output
,
'
%
s is present in
%
s'
%
(
'"pas:word"'
,
url_output
))
self
.
assertFalse
(
'pas:word'
in
ssh_output
,
'
%
s is present in
%
s'
%
(
'"pas:word"'
,
ssh_output
))
# Slightly more advanced, we hid all of the password despite the ":"
self
.
assertNotIn
(
'pas'
,
url_output
)
self
.
assertNotIn
(
'pas'
,
ssh_output
)
self
.
assertFalse
(
'pas'
in
url_output
,
'
%
s is present in
%
s'
%
(
'"pas"'
,
url_output
))
self
.
assertFalse
(
'pas'
in
ssh_output
,
'
%
s is present in
%
s'
%
(
'"pas"'
,
ssh_output
))
# In this implementation we replace the password with 8 "*" which is
# also the length of our password. The url fields should be able to
...
...
@@ -313,7 +321,11 @@ class TestModuleUtilsBasicHelpers(unittest.TestCase):
# the data, though:
self
.
assertTrue
(
ssh_output
.
startswith
(
"{'"
))
self
.
assertTrue
(
ssh_output
.
endswith
(
"'}}}}"
))
self
.
assertIn
(
":********@foo.com/data',"
,
ssh_output
)
try
:
self
.
assertIn
(
":********@foo.com/data',"
,
ssh_output
)
except
AttributeError
:
# python2.6 or less's unittest
self
.
assertTrue
(
":********@foo.com/data',"
in
ssh_output
,
'
%
s is not present in
%
s'
%
(
":********@foo.com/data',"
,
ssh_output
))
# The overzealous-ness here may lead to us changing the algorithm in
# the future. We could make it consume less of the data (with the
...
...
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