adds coverity tests
This commit is contained in:
parent
2d56f09320
commit
0a9f66338c
3
wrapper/python/wolfssl/.gitignore
vendored
3
wrapper/python/wolfssl/.gitignore
vendored
@ -11,6 +11,9 @@ dist/
|
||||
|
||||
# Unit test
|
||||
.tox/
|
||||
htmlcov/
|
||||
.coverage
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
|
@ -29,9 +29,8 @@ import pytest
|
||||
|
||||
@pytest.fixture
|
||||
def tcp_socket():
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
yield sock
|
||||
sock.close()
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
||||
yield sock
|
||||
|
||||
@pytest.fixture(params=[ssl, wolfssl], ids=["ssl", "wolfssl"])
|
||||
def ssl_provider(request):
|
||||
|
@ -121,6 +121,9 @@ def test_context_creation(ssl_context):
|
||||
assert ssl_context != None
|
||||
|
||||
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
|
||||
|
||||
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):
|
||||
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):
|
||||
with pytest.raises(TypeError):
|
||||
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
|
||||
|
||||
@pytest.fixture(
|
||||
params=[PROTOCOL_SSLv3, PROTOCOL_TLSv1, PROTOCOL_TLSv1_1],
|
||||
ids=["SSLv3", "TLSv1", "TLSv1_1"])
|
||||
params=[-1, PROTOCOL_SSLv3, PROTOCOL_TLSv1, PROTOCOL_TLSv1_1],
|
||||
ids=["invalid", "SSLv3", "TLSv1", "TLSv1_1"])
|
||||
def unsupported_method(request):
|
||||
yield request.param
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user