Patchwork [2,of,4,V2] test-https: enable dummycert test only if Apple python is used (issue4500)

login
register
mail settings
Submitter Yuya Nishihara
Date March 12, 2015, 3:41 p.m.
Message ID <e86c238e627c36dde5ed.1426174915@mimosa>
Download mbox | patch
Permalink /patch/8022/
State Accepted
Commit 07fafcd4bc74b42e7b8bbba2f8538de487b3f7f2
Headers show

Comments

Yuya Nishihara - March 12, 2015, 3:41 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1425476508 -32400
#      Wed Mar 04 22:41:48 2015 +0900
# Node ID e86c238e627c36dde5ed32a34442d5eacc63a839
# Parent  7ed8cbb3b76b9e15940e967d4620c2eac028fad1
test-https: enable dummycert test only if Apple python is used (issue4500)

The dummycert trick works only if Python is linked to Apple's patched OpenSSL.

Patch

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -320,6 +320,11 @@  def has_ssl():
     except ImportError:
         return False
 
+@check("defaultcacerts", "can verify SSL certs by system's CA certs store")
+def has_defaultcacerts():
+    from mercurial import sslutil
+    return sslutil._defaultcacerts()
+
 @check("windows", "Windows")
 def has_windows():
     return os.name == 'nt'
diff --git a/tests/test-https.t b/tests/test-https.t
--- a/tests/test-https.t
+++ b/tests/test-https.t
@@ -119,7 +119,7 @@  OS X has a dummy CA cert that enables us
 Apple's OpenSSL. This trick do not work with plain OpenSSL.
 
   $ DISABLEOSXDUMMYCERT=
-#if osx
+#if defaultcacerts
   $ hg clone https://localhost:$HGPORT/ copy-pull
   abort: error: *certificate verify failed* (glob)
   [255]