-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from lnx85/dev
Dev
- Loading branch information
Showing
4 changed files
with
82 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
import pytest | ||
|
||
from osservaprezzi.exceptions import ApiError, ApiTimeoutError | ||
from osservaprezzi.models import GPSCoordinates | ||
|
||
if TYPE_CHECKING: | ||
from osservaprezzi.client import Osservaprezzi | ||
|
||
|
||
@pytest.mark.usefixtures("client", "mock_client_get_response_timeout") | ||
async def test_get_response_timeout( | ||
client: Osservaprezzi, | ||
) -> None: | ||
with pytest.raises(ApiTimeoutError): | ||
await client.get_fuels() | ||
|
||
|
||
@pytest.mark.usefixtures("client", "mock_client_get_response_error") | ||
async def test_get_response_error( | ||
client: Osservaprezzi, | ||
) -> None: | ||
with pytest.raises(ApiError): | ||
await client.get_fuels() | ||
|
||
|
||
@pytest.mark.usefixtures("client", "mock_client_post_response_timeout") | ||
async def test_post_response_timeout( | ||
client: Osservaprezzi, | ||
) -> None: | ||
with pytest.raises(ApiTimeoutError): | ||
await client.get_stations(GPSCoordinates(45.542662, 10.225224), radius=5) | ||
|
||
|
||
@pytest.mark.usefixtures("client", "mock_client_post_response_error") | ||
async def test_post_response_error( | ||
client: Osservaprezzi, | ||
) -> None: | ||
with pytest.raises(ApiError): | ||
await client.get_stations(GPSCoordinates(45.542662, 10.225224), radius=5) |