Skip to content

Commit a00444f

Browse files
committed
Move a few tests around
1 parent 05d8ba1 commit a00444f

File tree

3 files changed

+42
-60
lines changed

3 files changed

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

0 commit comments

Comments
 (0)