Skip to content

Commit 596d30c

Browse files
authored
CAIP-8 extended jwt tests and add support for the latest versions (#356)
* CAIP-8 extended jwt tests * CAIP-8 re-lock setuptools * CAIP-7 added build for latest versions * CAIP-7 fix borken test for 3.13 * CAIP-8 fix python versions * CAIP-8 update urllib3 * CAIP-8 downgrade urlib * CAIP-8 update url lib to validated version
1 parent 1a2c6d2 commit 596d30c

6 files changed

Lines changed: 42 additions & 23 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14-
python-version: [ '3.9', '3.10' ]
14+
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ]
1515
os: [ ubuntu-latest, macos-latest, windows-latest ]
1616
include:
1717
- os: ubuntu-latest

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![FINOS - Active](https://cdn.jsdelivr.net/gh/finos/contrib-toolbox@master/images/badge-active.svg)](https://community.finos.org/docs/governance/Software-Projects/stages/active)
22
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
3-
[![Python](https://img.shields.io/badge/python-3.8%20%7C%203.9-blue)](https://www.python.org/downloads/release/python-3)
3+
[![Python](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue)](https://www.python.org/downloads/)
44
[![Pypi](https://img.shields.io/pypi/v/symphony-bdk-python)](https://pypi.org/project/symphony-bdk-python/)
55
![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/finos/symphony-bdk-python/build/main)
66

@@ -14,7 +14,7 @@ Symphony BDK for Python provides tools for building bots and integrating with Sy
1414

1515
## Prerequisites
1616

17-
- Python 3.8 or higher
17+
- Python 3.9 or higher
1818
- [Poetry](https://python-poetry.org/docs/#installation)
1919

2020
## Installation Steps

poetry.lock

Lines changed: 17 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ packages = [
1515
python = ">3.9.0,<3.9.1 || >3.9.1,<4.0"
1616
nulltype = "^2.3.1"
1717
python-dateutil = "^2.8.2"
18-
urllib3 = "^1.26.19"
18+
urllib3 = ">2.0.0,<2.4.0"
1919
aiohttp = "^3.10.2"
2020
pyyaml = "^6.0"
2121
PyJWT = "^2.10.0"
@@ -24,7 +24,7 @@ tenacity = "^8.0.1"
2424
defusedxml = "^0.7.1"
2525
docutils = "0.16"
2626

27-
[tool.poetry.dev-dependencies]
27+
[tool.poetry.group.dev.dependencies]
2828
pytest = "^8.3.3"
2929
pylint = "^2.6.0"
3030
pytest-cov = "^5.0.0"
@@ -34,7 +34,8 @@ jinja2 = "^3.1.6"
3434
recommonmark = "^0.7.1"
3535
furo = "^2022.3.4"
3636
hazelcast-python-client = "^5.0.1"
37-
safety = "^2.2.0"
37+
safety = "^2.3.5"
38+
setuptools = "^79.0.0"
3839
liccheck = "^0.6.2"
3940
coverage = {version = "^6.0b1", extras = ["toml"]}
4041

tests/core/activity/parsing/input_tokenizer_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from lib2to3.pgen2.tokenize import tokenize
21
from symphony.bdk.core.activity.parsing.message_entities import Cashtag, Hashtag, Mention
32
from symphony.bdk.core.activity.parsing.input_tokenizer import InputTokenizer
43
from symphony.bdk.gen.agent_model.v4_message import V4Message

tests/core/auth/jwt_helper_test.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,24 @@ def test_validate_jwt(jwt_payload, certificate, rsa_key):
4949
assert claims == jwt_payload
5050

5151

52+
53+
def test_validate_expired_jwt(jwt_payload, certificate, rsa_key):
54+
jwt_payload["exp"] = (datetime.datetime.now(datetime.timezone.utc).timestamp() - 10)
55+
signed_jwt = create_signed_jwt_with_claims(rsa_key, jwt_payload)
56+
57+
with pytest.raises(AuthInitializationError):
58+
validate_jwt(signed_jwt, certificate, AUDIENCE)
59+
60+
61+
62+
def test_validate_jwt_with_empty_sub(jwt_payload, certificate, rsa_key):
63+
jwt_payload["sub"] = None
64+
signed_jwt = create_signed_jwt_with_claims(rsa_key, jwt_payload)
65+
66+
claims = validate_jwt(signed_jwt, certificate, AUDIENCE)
67+
assert claims == jwt_payload
68+
69+
5270
def test_validate_jwt_with_wrong_audience(jwt_payload, certificate, rsa_key):
5371
signed_jwt = create_signed_jwt_with_claims(rsa_key, jwt_payload)
5472

0 commit comments

Comments
 (0)