Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Gambier
slapos.core
Commits
6f56d51b
Commit
6f56d51b
authored
Sep 15, 2014
by
Cédric de Saint Martin
Committed by
Rafael Monnerat
Nov 10, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slap test: make sure mocks/stubs are NOT leaking.
parent
6d2ce7d9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
slapos/tests/slap.py
slapos/tests/slap.py
+11
-0
No files found.
slapos/tests/slap.py
View file @
6f56d51b
...
...
@@ -34,6 +34,9 @@ import urlparse
import
slapos.slap
import
xml_marshaller
ORIGINAL_HTTPLIB_HTTPCONNECTION
=
httplib
.
HTTPConnection
ORIGINAL_HTTPLIB_HTTPSCONNECTION
=
httplib
.
HTTPSConnection
ORIGINAL_HTTPLIB_HTTPRESPONSE
=
httplib
.
HTTPResponse
class
UndefinedYetException
(
Exception
):
"""To catch exceptions which are not yet defined"""
...
...
@@ -70,10 +73,17 @@ class SlapMixin(unittest.TestCase):
def
_unpatchHttplib
(
self
):
"""Restores httplib overriding"""
import
httplib
# XXX not reliable
for
name
,
original_value
in
self
.
saved_httplib
.
items
():
setattr
(
httplib
,
name
,
original_value
)
del
self
.
saved_httplib
# XXX this fixes upper code, to be sure it is reliable
httplib
.
HTTPConnection
=
ORIGINAL_HTTPLIB_HTTPCONNECTION
httplib
.
HTTPSConnection
=
ORIGINAL_HTTPLIB_HTTPSCONNECTION
httplib
.
HTTPResponse
=
ORIGINAL_HTTPLIB_HTTPRESPONSE
def
_getTestComputerId
(
self
):
"""
Returns the computer id used by the test
...
...
@@ -987,3 +997,4 @@ if __name__ == '__main__':
print
'You can point to any SLAP server by setting TEST_SLAP_SERVER_URL '
\
'environment variable'
unittest
.
main
()
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