Debian Codegraph @

tests/functional/services/transfer/endpoint_manager/test_task_event_list.py

raw
1 import uuid
2
3 import pytest
4
5 from globus_sdk.testing import get_last_request
6 from tests.common import register_api_route
7
8 ZERO_ID = uuid.UUID(int=0)
9
10
11 def get_last_params():
12 return get_last_request().params
13
14
15 @pytest.fixture
16 def task_id():
17 return uuid.uuid1()
18
19
20 # stub in empty data, this can be explicitly replaced if a test wants specific data
21 @pytest.fixture(autouse=True)
22 def empty_response(task_id):
23 register_api_route(
24 "transfer", f"/endpoint_manager/task/{task_id}/event_list", json={"DATA": []}
25 )
26
27
28 # although int values are not supported based on the type annotations, users may already
29 # be passing ints -- it's good to support this usage and test it even if it's not
30 # documented and desirable
31 @pytest.mark.parametrize(
32 "paramvalue, paramstr", [(True, "1"), (False, "0"), (1, "1"), (0, "0")]
33 )
34 def test_filter_is_error(client, task_id, paramvalue, paramstr):
35 client.endpoint_manager_task_event_list(task_id, filter_is_error=paramvalue)
36 params = get_last_params()
37 assert "filter_is_error" in params
38 assert params["filter_is_error"] == paramstr