Skip to content

Commit d9a8006

Browse files
committed
add tests for recordings endpoint
1 parent 21ac6f8 commit d9a8006

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

tests/api/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,5 +200,6 @@ def test_teams_api_object_creation(api):
200200
def test_webhooks_api_object_creation(api):
201201
assert isinstance(api.webhooks, WebhooksAPI)
202202

203+
203204
def test_recordings_api_object_creation(api):
204205
assert isinstance(api.recordings, RecordingsAPI)

tests/api/test_recordings.py

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# -*- coding: utf-8 -*-
2+
"""WebexTeamsAPI Recordings API fixtures and tests.
3+
4+
Copyright (c) 2016-2020 Cisco and/or its affiliates.
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
"""
24+
25+
import itertools
26+
import os
27+
28+
import pytest
29+
30+
import webexteamssdk
31+
32+
from_datetime_string = str(
33+
webexteamssdk.WebexTeamsDateTime(2022, 1, 1, 0, 0, 0, 0),
34+
)
35+
36+
to_datetime_string = str(
37+
webexteamssdk.WebexTeamsDateTime.utcnow(),
38+
)
39+
40+
41+
# Helper Functions
42+
def is_valid_recording(obj):
43+
return isinstance(obj, webexteamssdk.Recording) and obj.id is not None
44+
45+
46+
def are_valid_recording(iterable):
47+
return all([is_valid_recording(obj) for obj in iterable])
48+
49+
50+
# Fixtures
51+
@pytest.fixture(scope="session")
52+
def list_recordings(api):
53+
return list(api.recordings.list(_from=from_datetime_string, to=to_datetime_string))
54+
55+
56+
@pytest.fixture(scope="session")
57+
def recording_id(api, list_recordings):
58+
assert list_recordings > 0
59+
return list_recordings[0].id
60+
61+
62+
# Tests
63+
def test_recording_list(list_recordings):
64+
assert len(list_recordings) > 0
65+
assert are_valid_recording(list_recordings)
66+
67+
68+
def test_recording_detail(recording_id):
69+
assert is_valid_recording(recording_id)
70+
71+
72+
def test_delete_recording(api, recording_id):
73+
api.recordings.delete(recording_id)

0 commit comments

Comments
 (0)