fixes unicode quotes and adds load_cert_chain test.

This commit is contained in:
Moisés Guimarães
2016-11-15 14:53:42 -03:00
parent 760ddd14f5
commit 015ffecbab
2 changed files with 10 additions and 6 deletions

View File

@@ -34,9 +34,13 @@ class TestSSLContext(unittest.TestCase):
def test_context_creation(self): def test_context_creation(self):
self.assertIsNotNone(self.ctx) self.assertIsNotNone(self.ctx)
def test_load_cert_chain(self): def test_load_cert_chain_raises(self):
self.assertRaises(TypeError, self.ctx.load_cert_chain, None) self.assertRaises(TypeError, self.ctx.load_cert_chain, None)
def test_load_cert_chain(self):
self.ctx.load_cert_chain("../../../certs/client-cert.pem",
"../../../certs/client-key.pem")
def test_load_verify_locations_raises(self): def test_load_verify_locations_raises(self):
self.assertRaises(TypeError, self.ctx.load_verify_locations, None) self.assertRaises(TypeError, self.ctx.load_verify_locations, None)

View File

@@ -18,8 +18,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
try: try:
from wolfssl._ffi import ffi as _ffi from wolfssl._ffi import ffi as _ffi
from wolfssl._ffi import lib as _lib from wolfssl._ffi import lib as _lib
except ImportError: except ImportError:
pass pass
@@ -77,7 +77,7 @@ class SSLContext:
Load a private key and the corresponding certificate. The certfile Load a private key and the corresponding certificate. The certfile
string must be the path to a single file in PEM format containing string must be the path to a single file in PEM format containing
the certificate as well as any number of CA certificates needed to the certificate as well as any number of CA certificates needed to
establish the certificates authenticity. establish the certificate's authenticity.
The keyfile string, if present, must point to a file containing the The keyfile string, if present, must point to a file containing the
private key in. private key in.
@@ -100,8 +100,8 @@ class SSLContext:
def load_verify_locations(self, cafile=None, capath=None, cadata=None): def load_verify_locations(self, cafile=None, capath=None, cadata=None):
""" """
Load a set of certification authority (CA) certificates used to Load a set of "certification authority" (CA) certificates used to
validate other peers certificates when verify_mode is other than validate other peers' certificates when verify_mode is other than
CERT_NONE. At least one of cafile or capath must be specified. CERT_NONE. At least one of cafile or capath must be specified.
The cafile string, if present, is the path to a file of concatenated The cafile string, if present, is the path to a file of concatenated