Skip to content

Commit 565db47

Browse files
Merge pull request #838 from adamtheturtle/consolidate-tests
Move a few tests around
2 parents 05d8ba1 + ef3a7c8 commit 565db47

File tree

3 files changed

+44
-60
lines changed

3 files changed

+44
-60
lines changed

tests/test_delete_target.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

tests/test_target_list.py

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from mock_vws import MockVWS
1010

1111
from vws import VWS
12+
from vws.exceptions import UnknownTarget
1213

1314

1415
class TestAddTarget:
@@ -109,3 +110,46 @@ def test_custom_base_url(self, high_quality_image: io.BytesIO) -> None:
109110
width=1,
110111
image=high_quality_image,
111112
)
113+
114+
115+
class TestListTargets:
116+
"""
117+
Tests for listing targets.
118+
"""
119+
120+
def test_list_targets(
121+
self,
122+
client: VWS,
123+
high_quality_image: io.BytesIO,
124+
) -> None:
125+
"""
126+
It is possible to get a list of target IDs.
127+
"""
128+
id_1 = client.add_target(name='x', width=1, image=high_quality_image)
129+
id_2 = client.add_target(name='a', width=1, image=high_quality_image)
130+
assert sorted(client.list_targets()) == sorted([id_1, id_2])
131+
132+
133+
class TestDelete:
134+
"""
135+
Test for deleting a target.
136+
"""
137+
138+
def test_delete_target(
139+
self,
140+
client: VWS,
141+
high_quality_image: io.BytesIO,
142+
) -> None:
143+
"""
144+
It is possible to delete a target.
145+
"""
146+
target_id = client.add_target(
147+
name='x',
148+
width=1,
149+
image=high_quality_image,
150+
)
151+
152+
client.wait_for_target_processed(target_id=target_id)
153+
client.delete_target(target_id=target_id)
154+
with pytest.raises(UnknownTarget):
155+
client.get_target_record(target_id=target_id)

0 commit comments

Comments
 (0)