Skip to content

Commit

Permalink
Release v1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobschaer committed Aug 27, 2023
1 parent a42d1dc commit fc8459b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

setuptools.setup(
name="doipclient",
version="1.1.0",
version="1.1.1",
description="A Diagnostic over IP (DoIP) client implementing ISO-13400-2.",
long_description=long_description,
long_description_content_type='text/x-rst',
long_description_content_type="text/x-rst",
author="Jacob Schaer",
url="https://github.com/jacobschaer/python-doipclient",
packages=setuptools.find_packages(),
Expand Down
17 changes: 13 additions & 4 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,9 @@ def test_exception_from_blocking_ssl_socket(mock_socket, mocker):

def test_use_secure_uses_default_ssl_context(mock_socket, mocker):
"""Wrap socket with default SSL-context when use_secure=True"""
mocked_default_context = mocker.patch.object(ssl, "create_default_context", autospec=True)
mocked_default_context = mocker.patch.object(
ssl, "create_default_context", autospec=True
)
sut = DoIPClient(
test_ip, test_logical_address, use_secure=True, activation_type=None
)
Expand All @@ -707,17 +709,24 @@ def test_use_secure_with_external_ssl_context(mock_socket, mocker):
"""Wrap socket with user provided SSL-context when use_secure=ssl_context"""
original_context = ssl.SSLContext
mocked_external_context = mocker.patch.object(ssl, "SSLContext", autospec=True)
mocked_default_context = mocker.patch.object(ssl, "create_default_context", autospec=True)
mocked_default_context = mocker.patch.object(
ssl, "create_default_context", autospec=True
)

# Unmock the SSLContext
ssl.SSLContext = original_context

sut = DoIPClient(
test_ip, test_logical_address, use_secure=mocked_external_context, activation_type=None
test_ip,
test_logical_address,
use_secure=mocked_external_context,
activation_type=None,
)

mocked_default_wrap_socket = mocked_default_context.return_value.wrap_socket
assert not mocked_default_wrap_socket.called, "Socket should *not* get wrapped using default context."
assert (
not mocked_default_wrap_socket.called
), "Socket should *not* get wrapped using default context."

mocked_external_wrap_socket = mocked_external_context.wrap_socket
mocked_external_wrap_socket.assert_called_once_with(mock_socket)

0 comments on commit fc8459b

Please sign in to comment.