|
1 | 1 | import pytest |
2 | 2 |
|
| 3 | +from pipedream import AsyncPipedream, Pipedream |
| 4 | + |
3 | 5 |
|
4 | 6 | # Get started with writing tests with pytest at https://docs.pytest.org |
5 | 7 | @pytest.mark.skip(reason="Unimplemented") |
6 | 8 | def test_client() -> None: |
7 | 9 | assert True |
| 10 | + |
| 11 | + |
| 12 | +def test_pipedream_accepts_timeout_with_access_token() -> None: |
| 13 | + """Test that Pipedream accepts the timeout parameter with access_token.""" |
| 14 | + client = Pipedream( |
| 15 | + project_id="test-project-id", |
| 16 | + access_token="test-token", |
| 17 | + timeout=5.0, |
| 18 | + ) |
| 19 | + assert client._client_wrapper._timeout == 5.0 |
| 20 | + |
| 21 | + |
| 22 | +def test_pipedream_accepts_timeout_with_client_credentials() -> None: |
| 23 | + """Test that Pipedream accepts the timeout parameter with client credentials.""" |
| 24 | + client = Pipedream( |
| 25 | + project_id="test-project-id", |
| 26 | + client_id="test-client-id", |
| 27 | + client_secret="test-client-secret", |
| 28 | + timeout=10.0, |
| 29 | + ) |
| 30 | + assert client._client_wrapper._timeout == 10.0 |
| 31 | + |
| 32 | + |
| 33 | +def test_async_pipedream_accepts_timeout_with_access_token() -> None: |
| 34 | + """Test that AsyncPipedream accepts the timeout parameter with access_token.""" |
| 35 | + client = AsyncPipedream( |
| 36 | + project_id="test-project-id", |
| 37 | + access_token="test-token", |
| 38 | + timeout=5.0, |
| 39 | + ) |
| 40 | + assert client._client_wrapper._timeout == 5.0 |
| 41 | + |
| 42 | + |
| 43 | +def test_async_pipedream_accepts_timeout_with_client_credentials() -> None: |
| 44 | + """Test that AsyncPipedream accepts the timeout parameter with client credentials.""" |
| 45 | + client = AsyncPipedream( |
| 46 | + project_id="test-project-id", |
| 47 | + client_id="test-client-id", |
| 48 | + client_secret="test-client-secret", |
| 49 | + timeout=15.0, |
| 50 | + ) |
| 51 | + assert client._client_wrapper._timeout == 15.0 |
| 52 | + |
| 53 | + |
| 54 | +def test_pipedream_default_timeout() -> None: |
| 55 | + """Test that Pipedream uses the default timeout of 60 seconds when not specified.""" |
| 56 | + client = Pipedream( |
| 57 | + project_id="test-project-id", |
| 58 | + access_token="test-token", |
| 59 | + ) |
| 60 | + assert client._client_wrapper._timeout == 60 |
| 61 | + |
| 62 | + |
| 63 | +def test_async_pipedream_default_timeout() -> None: |
| 64 | + """Test that AsyncPipedream uses the default timeout of 60 seconds when not specified.""" |
| 65 | + client = AsyncPipedream( |
| 66 | + project_id="test-project-id", |
| 67 | + access_token="test-token", |
| 68 | + ) |
| 69 | + assert client._client_wrapper._timeout == 60 |
0 commit comments