Skip to content

Commit 2295d32

Browse files
committed
Progress
1 parent e0b9153 commit 2295d32

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

tests/test_unknown_target.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,26 @@
33
be given.
44
"""
55

6+
from typing import Callable
7+
68
import pytest
9+
from _pytest.fixtures import SubRequest
710

811
from vws import VWS
912
from vws.exceptions import UnknownTarget
1013

1114

12-
class TestInvalidGivenID:
13-
"""
14-
Tests for giving an invalid ID to helpers which require a target ID to be
15-
given.
16-
"""
15+
@pytest.fixture()
16+
def _delete_target(client: VWS) -> Callable[[str], None]:
17+
return client.delete_target
1718

18-
def test_invalid_given_id(self, client: VWS) -> None:
19-
"""
20-
Giving an invalid ID to a helper which requires a target ID to be given
21-
causes an ``UnknownTarget`` exception to be raised.
22-
"""
23-
funcs = (
24-
client.get_target_record,
25-
client.get_target_summary_report,
26-
client.delete_target,
27-
)
2819

29-
for func in funcs:
30-
with pytest.raises(UnknownTarget):
31-
func(target_id='x')
20+
@pytest.mark.parametrize('fixture', ['_delete_target'])
21+
def test_invalid_given_id(fixture: Callable[[str], None], request: SubRequest,) -> None:
22+
"""
23+
Giving an invalid ID to a helper which requires a target ID to be given
24+
causes an ``UnknownTarget`` exception to be raised.
25+
"""
26+
func = request.getfixturevalue(fixture)
27+
with pytest.raises(UnknownTarget):
28+
func(target_id='x')

0 commit comments

Comments
 (0)