Skip to content

Commit 5f7b5f5

Browse files
committed
fix: added guard for empty video filter parameters
1 parent 82a02e4 commit 5f7b5f5

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

video/src/vonage_video/video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ def _list_video_objects(
724724
i.e.
725725
objects: list[object], count: int, next_page_offset: Optional[int]
726726
"""
727-
index = request_filter.offset + 1 or 1
727+
index = 1 if request_filter is not None else request_filter.offset + 1
728728
page_size = request_filter.page_size
729729
objects = []
730730

video/tests/test_archive.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,32 @@ def test_list_archives():
132132
assert archives[1].url == 'https://example.com/archive.mp4'
133133
assert archives[1].max_bitrate == 2_000_000
134134

135+
@responses.activate
136+
def test_list_archives():
137+
build_response(
138+
path,
139+
'GET',
140+
'https://video.api.vonage.com/v2/project/test_application_id/archive',
141+
'list_archives.json',
142+
)
143+
144+
filter = ListArchivesFilter(session_id='test_session_id')
145+
archives, count, next_page = video.list_archives(filter)
146+
147+
assert count == 2
148+
assert next_page is None
149+
assert archives[0].id == '5b1521e6-115f-4efd-bed9-e527b87f0699'
150+
assert archives[0].status == 'paused'
151+
assert archives[0].resolution == '1280x720'
152+
assert archives[0].session_id == 'test_session_id'
153+
assert archives[1].id == 'a9cdeb69-f6cf-408b-9197-6f99e6eac5aa'
154+
assert archives[1].status == 'available'
155+
assert archives[1].reason == 'session ended'
156+
assert archives[1].duration == 134
157+
assert archives[1].sha256_sum == 'test_sha256_sum'
158+
assert archives[1].url == 'https://example.com/archive.mp4'
159+
assert archives[1].max_bitrate == 2_000_000
160+
135161

136162
@responses.activate
137163
def test_start_archive():

0 commit comments

Comments
 (0)