hass-core/tests/components/speedtestdotnet/__init__.py
Rami Mosleh 51addfc164
Add device_info to Speedtestdotnet and some code cleanup (#56612)
* Apply code cleanup suggestions from previous PRs

* Update homeassistant/components/speedtestdotnet/const.py

Co-authored-by: Franck Nijhof <git@frenck.dev>

* fix native_value, and ping value in test

* use self._state instead of _attr_native_value

* update identifiers and add more tests

Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-09-30 08:28:04 +02:00

55 lines
1.3 KiB
Python

"""Tests for SpeedTest."""
MOCK_SERVERS = {
1: [
{
"url": "http://server_1:8080/speedtest/upload.php",
"lat": "1",
"lon": "1",
"name": "Server1",
"country": "Country1",
"cc": "LL1",
"sponsor": "Sponsor1",
"id": "1",
"host": "server1:8080",
"d": 1,
}
],
2: [
{
"url": "http://server_2:8080/speedtest/upload.php",
"lat": "2",
"lon": "2",
"name": "Server2",
"country": "Country2",
"cc": "LL2",
"sponsor": "Sponsor2",
"id": "2",
"host": "server2:8080",
"d": 2,
}
],
}
MOCK_RESULTS = {
"download": 1024000,
"upload": 1024000,
"ping": 18.465,
"server": {
"url": "http://test_server:8080/speedtest/upload.php",
"lat": "00.0000",
"lon": "11.1111",
"name": "NAME",
"country": "Country",
"id": "8408",
"host": "test_server:8080",
"d": 1.4858909757493415,
"latency": 18.465,
},
"timestamp": "2020-05-29T07:28:57.908387Z",
"bytes_sent": 4194304,
"bytes_received": 19712300,
"share": None,
}
MOCK_STATES = {"ping": "18", "download": "1.02", "upload": "1.02"}