Rev 6262: Fix the last test failure by providing the test ca certs via the config option framework. in file:///home/vila/src/bzr/reviews/urllib-verifies-ssl-certs/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Fri Jan 20 13:07:10 UTC 2012
At file:///home/vila/src/bzr/reviews/urllib-verifies-ssl-certs/
------------------------------------------------------------
revno: 6262
revision-id: v.ladeuil+lp at free.fr-20120120130710-rc4qtzx1mzwcx703
parent: v.ladeuil+lp at free.fr-20120120125605-6ocf9pfr7ufpfucj
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: urllib-verifies-ssl-certs
timestamp: Fri 2012-01-20 14:07:10 +0100
message:
Fix the last test failure by providing the test ca certs via the config option framework.
-------------- next part --------------
=== modified file 'bzrlib/plugins/launchpad/lp_registration.py'
--- a/bzrlib/plugins/launchpad/lp_registration.py 2011-12-19 10:58:39 +0000
+++ b/bzrlib/plugins/launchpad/lp_registration.py 2012-01-20 13:07:10 +0000
@@ -56,11 +56,7 @@
class XMLRPCTransport(xmlrpclib.Transport):
def __init__(self, scheme):
- # In python2.4 xmlrpclib.Transport is a old-style class, and does not
- # define __init__, so we check first
- init = getattr(xmlrpclib.Transport, '__init__', None)
- if init is not None:
- init(self)
+ xmlrpclib.Transport.__init__(self)
self._scheme = scheme
self._opener = _urllib2_wrappers.Opener()
self.verbose = 0
=== modified file 'bzrlib/plugins/launchpad/test_lp_directory.py'
--- a/bzrlib/plugins/launchpad/test_lp_directory.py 2011-10-06 06:45:46 +0000
+++ b/bzrlib/plugins/launchpad/test_lp_directory.py 2012-01-20 13:07:10 +0000
@@ -19,6 +19,7 @@
import os
import xmlrpclib
+import bzrlib
from bzrlib import (
debug,
errors,
@@ -29,6 +30,7 @@
from bzrlib.directory_service import directories
from bzrlib.tests import (
features,
+ ssl_certs,
TestCaseInTempDir,
TestCaseWithMemoryTransport
)
@@ -452,12 +454,15 @@
tests.TestCase.setUp(self)
self.server = self.server_class()
self.server.start_server()
+ self.addCleanup(self.server.stop_server)
# Ensure we don't clobber env
self.overrideEnv('BZR_LP_XMLRPC_URL', None)
-
- def tearDown(self):
- self.server.stop_server()
- tests.TestCase.tearDown(self)
+ # Ensure we use the right certificates for https.
+ # FIXME: There should be a better way but the only alternative I can
+ # think of involves carrying the ca_certs through the lp_registration
+ # infrastructure to _urllib2_wrappers... -- vila 2012-01-20
+ bzrlib.global_state.cmdline_overrides._from_cmdline(
+ ['ssl.ca_certs=%s' % ssl_certs.build_path('ca.crt')])
def set_canned_response(self, server, path):
response_format = '''HTTP/1.1 200 OK\r
More information about the bazaar-commits
mailing list