forked from wolfSSL/wolfssl
adds coverity tests
This commit is contained in:
3
wrapper/python/wolfssl/.gitignore
vendored
3
wrapper/python/wolfssl/.gitignore
vendored
@ -11,6 +11,9 @@ dist/
|
|||||||
|
|
||||||
# Unit test
|
# Unit test
|
||||||
.tox/
|
.tox/
|
||||||
|
htmlcov/
|
||||||
|
.coverage
|
||||||
|
|
||||||
# Sphinx documentation
|
# Sphinx documentation
|
||||||
docs/_build/
|
docs/_build/
|
||||||
|
|
||||||
|
@ -29,9 +29,8 @@ import pytest
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def tcp_socket():
|
def tcp_socket():
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
||||||
yield sock
|
yield sock
|
||||||
sock.close()
|
|
||||||
|
|
||||||
@pytest.fixture(params=[ssl, wolfssl], ids=["ssl", "wolfssl"])
|
@pytest.fixture(params=[ssl, wolfssl], ids=["ssl", "wolfssl"])
|
||||||
def ssl_provider(request):
|
def ssl_provider(request):
|
||||||
|
@ -121,6 +121,9 @@ def test_context_creation(ssl_context):
|
|||||||
assert ssl_context != None
|
assert ssl_context != None
|
||||||
|
|
||||||
def test_verify_mode(ssl_provider, ssl_context):
|
def test_verify_mode(ssl_provider, ssl_context):
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
ssl_context.verify_mode = -1
|
||||||
|
|
||||||
assert ssl_context.verify_mode == ssl_provider.CERT_NONE
|
assert ssl_context.verify_mode == ssl_provider.CERT_NONE
|
||||||
|
|
||||||
ssl_context.verify_mode = ssl_provider.CERT_REQUIRED
|
ssl_context.verify_mode = ssl_provider.CERT_REQUIRED
|
||||||
@ -129,6 +132,9 @@ def test_verify_mode(ssl_provider, ssl_context):
|
|||||||
def test_set_ciphers(ssl_context):
|
def test_set_ciphers(ssl_context):
|
||||||
ssl_context.set_ciphers("DHE-RSA-AES256-SHA256")
|
ssl_context.set_ciphers("DHE-RSA-AES256-SHA256")
|
||||||
|
|
||||||
|
with pytest.raises(Exception):
|
||||||
|
ssl_context.set_ciphers("foo")
|
||||||
|
|
||||||
def test_load_cert_chain_raises(ssl_context):
|
def test_load_cert_chain_raises(ssl_context):
|
||||||
with pytest.raises(TypeError):
|
with pytest.raises(TypeError):
|
||||||
ssl_context.load_cert_chain(None)
|
ssl_context.load_cert_chain(None)
|
||||||
|
@ -29,8 +29,8 @@ from wolfssl._methods import (WolfSSLMethod, PROTOCOL_SSLv3, PROTOCOL_SSLv23,
|
|||||||
from wolfssl._ffi import ffi as _ffi
|
from wolfssl._ffi import ffi as _ffi
|
||||||
|
|
||||||
@pytest.fixture(
|
@pytest.fixture(
|
||||||
params=[PROTOCOL_SSLv3, PROTOCOL_TLSv1, PROTOCOL_TLSv1_1],
|
params=[-1, PROTOCOL_SSLv3, PROTOCOL_TLSv1, PROTOCOL_TLSv1_1],
|
||||||
ids=["SSLv3", "TLSv1", "TLSv1_1"])
|
ids=["invalid", "SSLv3", "TLSv1", "TLSv1_1"])
|
||||||
def unsupported_method(request):
|
def unsupported_method(request):
|
||||||
yield request.param
|
yield request.param
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user