Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
937ebbc
github actions (deps): bump actions/upload-artifact from 5 to 6
dependabot[bot] Jan 23, 2026
0ffe13d
github actions (deps): bump mikepenz/action-junit-report
dependabot[bot] Jan 23, 2026
d92c9e3
Bump pytest from 8.4.2 to 9.0.2
dependabot[bot] Feb 1, 2026
b506ff5
Bump types-setuptools from 80.9.0.20251223 to 80.10.0.20260124
dependabot[bot] Feb 1, 2026
20f7eac
Bump boto3 from 1.42.33 to 1.42.39
dependabot[bot] Feb 1, 2026
a157115
Bump coverage from 7.13.1 to 7.13.2
dependabot[bot] Feb 1, 2026
8714b75
Bump black from 25.12.0 to 26.1.0
dependabot[bot] Feb 1, 2026
2aa2f85
Merge dependabot/pip/black-26.1.0 into mesh-2092-dependabot-combined
github-actions[bot] Feb 4, 2026
2cb142a
Merge dependabot/pip/coverage-7.13.2 into mesh-2092-dependabot-combined
github-actions[bot] Feb 4, 2026
ff09a3f
Merge dependabot/pip/boto3-1.42.39 into mesh-2092-dependabot-combined
github-actions[bot] Feb 4, 2026
31b4289
Merge dependabot/pip/types-setuptools-80.10.0.20260124 into mesh-2092…
github-actions[bot] Feb 4, 2026
edd3855
Merge dependabot/github_actions/mikepenz/action-junit-report-6.1.0 in…
github-actions[bot] Feb 4, 2026
1427525
Merge remote-tracking branch 'origin/dependabot/pip/pytest-9.0.2' int…
allenburgess1-nhs Feb 4, 2026
334b8f5
Merge remote-tracking branch 'origin/dependabot/github_actions/action…
allenburgess1-nhs Feb 4, 2026
b14716b
mesh-2092: update deps
allenburgess1-nhs Feb 4, 2026
d40b8f2
mesh-2092: black & ruff reformating
allenburgess1-nhs Feb 4, 2026
eb29269
mesh-2092: removed cert and verify check for unsupported types
allenburgess1-nhs Feb 5, 2026
e5f0485
mesh-2092: added test for code coverage
allenburgess1-nhs Feb 5, 2026
cab80c0
Revert "mesh-2092: added test for code coverage"
allenburgess1-nhs Feb 5, 2026
62f438f
mesh-2092: added unit test coverage
allenburgess1-nhs Feb 5, 2026
632e2de
mesh-2092: re-added check for verify as bytes and cert as list
allenburgess1-nhs Feb 5, 2026
156c98c
mesh-2092: added mypy ignores
allenburgess1-nhs Feb 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/merge-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:

- name: publish junit reports
if: success() || failure()
uses: mikepenz/action-junit-report@e08919a3b1fb83a78393dfb775a9c37f17d8eea6
uses: mikepenz/action-junit-report@a294a61c909bd8a4b563024a2faa28897fd53ebc
with:
check_name: junit reports
report_paths: reports/junit/*.xml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ jobs:

- name: archive reports
if: github.actor != 'dependabot[bot]' && (success() || failure())
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v6
with:
name: reports
path: reports/**/*

- name: publish junit reports
if: success() || failure()
uses: mikepenz/action-junit-report@e08919a3b1fb83a78393dfb775a9c37f17d8eea6
uses: mikepenz/action-junit-report@a294a61c909bd8a4b563024a2faa28897fd53ebc
with:
check_name: junit reports
report_paths: reports/junit/*.xml
Expand Down
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"."
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
4 changes: 2 additions & 2 deletions mesh_client/__init__.py
Comment thread
allenburgess1-nhs marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,11 @@ def create_ssl_context(self) -> ssl.SSLContext:

context.minimum_version = ssl.TLSVersion.TLSv1_2

if self.cert and isinstance(self.cert, (tuple, list)):
if self.cert and isinstance(self.cert, tuple | list):
context.load_cert_chain(*self.cert)

if self.verify:
if isinstance(self.verify, (str, bytes)):
if isinstance(self.verify, str | bytes):
context.load_verify_locations(self.verify)

if self.check_hostname is not None:
Expand Down
278 changes: 139 additions & 139 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ requests = ">=2.32.0,<3.0.0"
werkzeug = ">=3.0.3,<4.0.0"

[tool.poetry.group.dev.dependencies]
black = "^25"
black = ">=25,<27"
mypy = "^1.4.1"
types-six = "^1.16.21.8"
types-requests = "^2.31.0.1"
Expand All @@ -43,7 +43,7 @@ toml = "^0.10.2"
tox = "^4.6.3"
types-setuptools = "^80"
coverage = "^7.2.7"
pytest = ">=7.4,<9.0"
pytest = ">=7.4,<10.0"
importlib-metadata = {version = ">=4.11.4", python = "<3.12"}
pytest-httpserver = "^1.0.8"
ruff = "^0"
Expand Down
219 changes: 219 additions & 0 deletions requirements.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
this shim is required ... because the PyPI package name contains upper case chars . and pyproject.toml
will lowercase under PEP-518 build systems.
"""

import os
from os.path import dirname, join

Expand Down
65 changes: 65 additions & 0 deletions tests/ssl_context_adapter_tests.py
Comment thread
allenburgess1-nhs marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
from __future__ import annotations

from unittest.mock import Mock

import pytest

import mesh_client


class SSLContextStub:
def __init__(self) -> None:
self.load_cert_chain = Mock()
self.load_verify_locations = Mock()
self.minimum_version = None
self.check_hostname = None
self.verify_mode = None
self.hostname_checks_common_name = None


@pytest.mark.parametrize(
("certs", "loads_cert_chain_called"),
[
(("client.crt", "client.key"), True),
(None, False),
(["client.crt", "client.key"], True),
],
)
def test_create_ssl_context_loads_cert_chain(
monkeypatch, certs: tuple[str, str] | list[str] | None, loads_cert_chain_called: bool
):

dummy_context = SSLContextStub()
monkeypatch.setattr(mesh_client, "create_urllib3_context", lambda: dummy_context)

adapter = mesh_client.SSLContextAdapter(cert=certs, verify=None) # type: ignore[arg-type]
dummy_context.load_cert_chain.reset_mock()

context = adapter.create_ssl_context()

assert context is dummy_context

if loads_cert_chain_called:
assert certs is not None
dummy_context.load_cert_chain.assert_called_with(*certs)
else:
dummy_context.load_cert_chain.assert_not_called()


@pytest.mark.parametrize("verify", [True, False, "/path/to/ca.pem", b"/path/to/ca.pem", None])
def test_create_ssl_context_loads_verify_locations_when_verify_is_provided(
monkeypatch, verify: bool | str | bytes | None
):

dummy_context = SSLContextStub()
monkeypatch.setattr(mesh_client, "create_urllib3_context", lambda: dummy_context)

adapter = mesh_client.SSLContextAdapter(cert=None, verify=verify) # type: ignore[arg-type]
context = adapter.create_ssl_context()

assert context is dummy_context

if type(verify) in (str, bytes):
dummy_context.load_verify_locations.assert_called_with(verify)
else:
dummy_context.load_verify_locations.assert_not_called()
Loading