You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2015/05/12 12:42:12 UTC

svn commit: r1678910 - in /subversion/trunk/subversion/tests: cmdline/basic_tests.py cmdline/lock_tests.py svn_test_main.c

Author: philip
Date: Tue May 12 10:42:12 2015
New Revision: 1678910

URL: http://svn.apache.org/r1678910
Log:
Some of the regression tests did not trust the self-signed cert
used by davautocheck when USE_SSL=1 is set.  Make the C tests
and the python httplib tests accept self-signed certs so all the
regression tests PASS.

* subversion/tests/svn_test_main.c
  (svn_test__init_auth_baton): Trust unknown-ca.

* subversion/tests/cmdline/basic_tests.py
  (plaintext_password_storage_disabled): Trust unknown-ca.

* subversion/tests/cmdline/lock_tests.py
  (http_connection): New, create connection that does not verify certs.
  (create_dav_lock_timeout, dav_lock_refresh): Use http_connection.

Modified:
    subversion/trunk/subversion/tests/cmdline/basic_tests.py
    subversion/trunk/subversion/tests/cmdline/lock_tests.py
    subversion/trunk/subversion/tests/svn_test_main.c

Modified: subversion/trunk/subversion/tests/cmdline/basic_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/basic_tests.py?rev=1678910&r1=1678909&r2=1678910&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/basic_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/basic_tests.py Tue May 12 10:42:12 2015
@@ -3100,6 +3100,7 @@ def plaintext_password_storage_disabled(
     "-m", "committing with plaintext password storage disabled",
     "--username", svntest.main.wc_author,
     "--password", svntest.main.wc_passwd,
+    "--trust-server-cert-failures", "unknown-ca",
     "--non-interactive", wc_dir)
 
   # Verify that the password was not stored in plaintext

Modified: subversion/trunk/subversion/tests/cmdline/lock_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/lock_tests.py?rev=1678910&r1=1678909&r2=1678910&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/lock_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/lock_tests.py Tue May 12 10:42:12 2015
@@ -2076,22 +2076,36 @@ def dav_lock_timeout(sbox):
   expected_status.tweak('iota', writelocked='K')
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
+def http_connection(repo_url):
+
+  import httplib
+  from urlparse import urlparse
+
+  loc = urlparse(repo_url)
+  if loc.scheme == 'http':
+    h = httplib.HTTPConnection(loc.hostname, loc.port)
+  else:
+    try:
+      import ssl # new in python 2.6
+      c = ssl.create_default_context()
+      c.check_hostname = False
+      c.verify_mode = ssl.CERT_NONE
+      h = httplib.HTTPSConnection(loc.hostname, loc.port, context=c)
+    except:
+      h = httplib.HTTPSConnection(loc.hostname, loc.port)
+  return h
+
 @SkipUnless(svntest.main.is_ra_type_dav)
 def create_dav_lock_timeout(sbox):
   "create generic DAV lock with timeout"
 
   import httplib
-  from urlparse import urlparse
   import base64
 
   sbox.build()
   wc_dir = sbox.wc_dir
-  loc = urlparse(sbox.repo_url)
 
-  if loc.scheme == 'http':
-    h = httplib.HTTPConnection(loc.hostname, loc.port)
-  else:
-    h = httplib.HTTPSConnection(loc.hostname, loc.port)
+  h = http_connection(sbox.repo_url)
 
   lock_body = '<?xml version="1.0" encoding="utf-8" ?>' \
               '<D:lockinfo xmlns:D="DAV:">' \
@@ -2227,7 +2241,6 @@ def dav_lock_refresh(sbox):
   "refresh timeout of DAV lock"
 
   import httplib
-  from urlparse import urlparse
   import base64
 
   sbox.build(create_wc = False)
@@ -2237,12 +2250,7 @@ def dav_lock_refresh(sbox):
                                      sbox.repo_url + '/iota')
 
   # Try to refresh lock using 'If' header
-  loc = urlparse(sbox.repo_url)
-
-  if loc.scheme == 'http':
-    h = httplib.HTTPConnection(loc.hostname, loc.port)
-  else:
-    h = httplib.HTTPSConnection(loc.hostname, loc.port)
+  h = http_connection(sbox.repo_url)
 
   lock_token = svntest.actions.run_and_parse_info(sbox.repo_url + '/iota')[0]['Lock Token']
 

Modified: subversion/trunk/subversion/tests/svn_test_main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test_main.c?rev=1678910&r1=1678909&r2=1678910&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test_main.c (original)
+++ subversion/trunk/subversion/tests/svn_test_main.c Tue May 12 10:42:12 2015
@@ -754,7 +754,7 @@ svn_test__init_auth_baton(svn_auth_baton
                                          "jrandom", "rayjandom",
                                          NULL,
                                          TRUE  /* no_auth_cache */,
-                                         FALSE /* trust_server_cert */,
+                                         TRUE /* trust_server_cert_unkown_ca */,
                                          FALSE, FALSE, FALSE, FALSE,
                                          cfg_config, NULL, NULL, result_pool));