Speedtestdotnet code cleanup and type hints (#52533)
This commit is contained in:
parent
7768f53281
commit
1a450c2084
11 changed files with 287 additions and 237 deletions
16
tests/components/speedtestdotnet/conftest.py
Normal file
16
tests/components/speedtestdotnet/conftest.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
"""Conftest for speedtestdotnet."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.components.speedtestdotnet import MOCK_RESULTS, MOCK_SERVERS
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_api():
|
||||
"""Mock entry setup."""
|
||||
with patch("speedtest.Speedtest") as mock_api:
|
||||
mock_api.return_value.get_servers.return_value = MOCK_SERVERS
|
||||
mock_api.return_value.get_best_server.return_value = MOCK_SERVERS[1][0]
|
||||
mock_api.return_value.results.dict.return_value = MOCK_RESULTS
|
||||
yield mock_api
|
Loading…
Add table
Add a link
Reference in a new issue