diff --git a/.bumpversion.cfg b/.bumpversion.cfg index f470f8f3..94c7d59c 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.13.1 +current_version = 3.14.0 commit = True tag = False diff --git a/.gitignore b/.gitignore index dd549bbf..fce8e163 100644 --- a/.gitignore +++ b/.gitignore @@ -111,3 +111,9 @@ ENV* .pytest_cache html/ .mutmut-cache +_test_scripts/ + +# Pants workspace files +/.pants.* +/dist/ +/.pids diff --git a/CHANGES.md b/CHANGES.md index d6b76ac2..8c2884f9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,6 @@ +# 3.14.0 +- Add publisher-only as a valid Video API client token role + # 3.13.1 - Fix content-type incorrect serialization diff --git a/setup.py b/setup.py index 00186696..333a43b4 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setup( name="vonage", - version="3.13.1", + version="3.14.0", description="Vonage Server SDK for Python", long_description=long_description, long_description_content_type="text/markdown", diff --git a/src/vonage/__init__.py b/src/vonage/__init__.py index 650b90dd..b0d49d3b 100644 --- a/src/vonage/__init__.py +++ b/src/vonage/__init__.py @@ -1,4 +1,4 @@ from .client import * from .ncco_builder.ncco import * -__version__ = "3.13.1" +__version__ = "3.14.0" diff --git a/src/vonage/video.py b/src/vonage/video.py index d1f84419..2625943c 100644 --- a/src/vonage/video.py +++ b/src/vonage/video.py @@ -20,7 +20,7 @@ class Video: auth_type = 'jwt' archive_mode_values = {'manual', 'always'} media_mode_values = {'routed', 'relayed'} - token_roles = {'subscriber', 'publisher', 'moderator'} + token_roles = {'subscriber', 'publisher', 'publisheronly', 'moderator'} def __init__(self, client: Client): self._client = client diff --git a/tests/test_video.py b/tests/test_video.py index d1c98945..a5b01a8b 100644 --- a/tests/test_video.py +++ b/tests/test_video.py @@ -44,7 +44,11 @@ def test_create_session_custom_archive_mode_and_location(client: Client): fixture_path="video/create_session.json", ) - session_options = {'archive_mode': 'always', 'location': '192.0.1.1', 'media_mode': 'routed'} + session_options = { + 'archive_mode': 'always', + 'location': '192.0.1.1', + 'media_mode': 'routed', + } session_info = client.video.create_session(session_options) assert isinstance(session_info, dict) assert session_info['session_id'] == session_id @@ -130,6 +134,12 @@ def test_generate_client_token_custom_options(client: Client): assert decoded_token['acl'] == ['1', '2', '3'] +def test_generate_client_token_publisher_only_role(client: Client): + token = client.video.generate_client_token(session_id, {'role': 'publisheronly'}) + decoded_token = jwt.decode(token, algorithms='RS256', options={'verify_signature': False}) + assert decoded_token['role'] == 'publisheronly' + + def test_check_client_token_headers(client: Client): token = client.video.generate_client_token(session_id) headers = jwt.get_unverified_header(token) @@ -197,7 +207,8 @@ def test_send_signal_to_all_participants(client: Client): ) assert isinstance( - client.video.send_signal(session_id, type='chat', data='hello from a test case'), dict + client.video.send_signal(session_id, type='chat', data='hello from a test case'), + dict, ) assert request_content_type() == "application/json" @@ -211,7 +222,10 @@ def test_send_signal_to_single_participant(client: Client): assert isinstance( client.video.send_signal( - session_id, type='chat', data='hello from a test case', connection_id=connection_id + session_id, + type='chat', + data='hello from a test case', + connection_id=connection_id, ), dict, )