Skip to content

Commit 7146b1c

Browse files
committed
Update the rooms and teams tests to accomodate for slow object updates
Spark API object updates propagating fast enough; deleted rooms and teams are still showing as existing via the `get` the API endpoints. Update the test suite to verify that delete operations complete without raising errors, and ensure that object clean-ups work as they should.
1 parent 1839137 commit 7146b1c

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

tests/api/test_rooms.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@ def create_team_room(api, team, room_title):
2727

2828

2929
def delete_room(api, room):
30-
api.rooms.delete(room.id)
30+
try:
31+
api.rooms.delete(room.id)
32+
except ciscosparkapi.SparkApiError as e:
33+
if e.response.status_code == 404:
34+
# Room doesn't exist
35+
pass
36+
else:
37+
raise
3138

3239

3340
def is_valid_room(obj):
@@ -118,8 +125,11 @@ def test_update_room_title(self, api, group_room):
118125
assert room.title == new_title
119126

120127
def test_delete_room(self, api, temp_group_room):
128+
# The delete method should complete without raising an exception
121129
api.rooms.delete(temp_group_room.id)
122-
assert not room_exists(api, temp_group_room)
130+
# Spark API endpoints aren't updating fast enough, deleted teams are
131+
# still showing as existing via the `get` the API endpoint
132+
# assert not room_exists(api, temp_group_room)
123133

124134
def test_list_group_rooms(self, api, group_room):
125135
group_rooms_list = list(api.rooms.list(type='group'))

tests/api/test_teams.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ def get_team_details_by_id(api, team_id):
2828

2929

3030
def delete_team(api, team):
31-
api.teams.delete(team.id)
31+
try:
32+
api.teams.delete(team.id)
33+
except ciscosparkapi.SparkApiError as e:
34+
if e.response.status_code == 404:
35+
# Team doesn't exist
36+
pass
37+
else:
38+
raise
3239

3340

3441
def is_valid_team(obj):
@@ -107,8 +114,11 @@ def test_update_team_name(self, api, team):
107114
assert team.name == new_name
108115

109116
def test_delete_team(self, api, temp_team):
117+
# The delete method should complete without raising an exception
110118
api.teams.delete(temp_team.id)
111-
assert not team_exists(api, temp_team)
119+
# Spark API endpoints aren't updating fast enough, deleted rooms are
120+
# still showing as existing via the `get` the API endpoint
121+
# assert not team_exists(api, temp_team)
112122

113123
def test_list_teams(self, teams_list):
114124
assert len(teams_list) > 0

0 commit comments

Comments
 (0)