|
3 | 3 | be given. |
4 | 4 | """ |
5 | 5 |
|
6 | | -from typing import Any, Callable, Dict, Union |
7 | | - |
8 | 6 | import pytest |
9 | | -from _pytest.fixtures import SubRequest |
10 | 7 | from requests import codes |
11 | 8 |
|
12 | 9 | from vws import VWS |
13 | 10 | from vws.exceptions import UnknownTarget |
14 | 11 |
|
15 | 12 |
|
16 | | -@pytest.fixture() |
17 | | -def _delete_target(client: VWS) -> Callable[[str], None]: |
18 | | - return client.delete_target |
19 | | - |
20 | | - |
21 | | -@pytest.fixture() |
22 | | -def _get_target_record(client: VWS, |
23 | | - ) -> Callable[[str], Dict[str, Union[str, int]]]: |
24 | | - return client.get_target_record |
25 | | - |
26 | | - |
27 | | -@pytest.fixture() |
28 | | -def _wait_for_target_processed(client: VWS) -> Any: |
29 | | - return client.wait_for_target_processed |
30 | | - |
31 | | - |
32 | | -@pytest.fixture() |
33 | | -def _get_target_summary_report( |
34 | | - client: VWS, |
35 | | -) -> Callable[[str], Dict[str, Union[str, int]]]: |
36 | | - return client.get_target_summary_report |
37 | | - |
38 | | - |
39 | | -@pytest.mark.parametrize( |
40 | | - 'fixture', |
41 | | - [ |
42 | | - '_delete_target', |
43 | | - '_get_target_record', |
44 | | - '_wait_for_target_processed', |
45 | | - '_get_target_summary_report', |
46 | | - ], |
47 | | -) |
48 | | -def test_invalid_given_id( |
49 | | - fixture: Callable[[str], None], |
50 | | - request: SubRequest, |
51 | | -) -> None: |
| 13 | +def test_invalid_given_id(client: VWS) -> None: |
52 | 14 | """ |
53 | 15 | Giving an invalid ID to a helper which requires a target ID to be given |
54 | 16 | causes an ``UnknownTarget`` exception to be raised. |
55 | 17 | """ |
56 | | - func = request.getfixturevalue(fixture) |
57 | 18 | with pytest.raises(UnknownTarget) as exc: |
58 | | - func(target_id='x') |
| 19 | + client.delete_target(target_id='x') |
59 | 20 | assert exc.value.response.status_code == codes.NOT_FOUND |
0 commit comments