Change name from Uptime Robot to UptimeRobot (#57714)

This commit is contained in:
Joakim Sørensen 2021-10-15 00:50:09 +02:00 committed by GitHub
parent e077fb13ce
commit c243dca58e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 28 additions and 28 deletions

View File

@ -1,4 +1,4 @@
"""The Uptime Robot integration.""" """The UptimeRobot integration."""
from __future__ import annotations from __future__ import annotations
from pyuptimerobot import ( from pyuptimerobot import (
@ -24,7 +24,7 @@ from .const import API_ATTR_OK, COORDINATOR_UPDATE_INTERVAL, DOMAIN, LOGGER, PLA
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Uptime Robot from a config entry.""" """Set up UptimeRobot from a config entry."""
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})
uptime_robot_api = UptimeRobot( uptime_robot_api = UptimeRobot(
entry.data[CONF_API_KEY], async_get_clientsession(hass) entry.data[CONF_API_KEY], async_get_clientsession(hass)
@ -55,7 +55,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
class UptimeRobotDataUpdateCoordinator(DataUpdateCoordinator): class UptimeRobotDataUpdateCoordinator(DataUpdateCoordinator):
"""Data update coordinator for Uptime Robot.""" """Data update coordinator for UptimeRobot."""
def __init__( def __init__(
self, self,

View File

@ -1,4 +1,4 @@
"""A platform that to monitor Uptime Robot monitors.""" """UptimeRobot binary_sensor platform."""
from __future__ import annotations from __future__ import annotations
import voluptuous as vol import voluptuous as vol
@ -31,7 +31,7 @@ async def async_setup_platform(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None, discovery_info: DiscoveryInfoType | None = None,
) -> None: ) -> None:
"""Set up the Uptime Robot binary_sensor platform.""" """Set up the UptimeRobot binary_sensor platform."""
hass.async_create_task( hass.async_create_task(
hass.config_entries.flow.async_init( hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_IMPORT}, data=config DOMAIN, context={"source": SOURCE_IMPORT}, data=config
@ -42,7 +42,7 @@ async def async_setup_platform(
async def async_setup_entry( async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None: ) -> None:
"""Set up the Uptime Robot binary_sensors.""" """Set up the UptimeRobot binary_sensors."""
coordinator: DataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id] coordinator: DataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
async_add_entities( async_add_entities(
[ [
@ -61,7 +61,7 @@ async def async_setup_entry(
class UptimeRobotBinarySensor(UptimeRobotEntity, BinarySensorEntity): class UptimeRobotBinarySensor(UptimeRobotEntity, BinarySensorEntity):
"""Representation of a Uptime Robot binary sensor.""" """Representation of a UptimeRobot binary sensor."""
@property @property
def is_on(self) -> bool: def is_on(self) -> bool:

View File

@ -1,4 +1,4 @@
"""Config flow for Uptime Robot integration.""" """Config flow for UptimeRobot integration."""
from __future__ import annotations from __future__ import annotations
from pyuptimerobot import ( from pyuptimerobot import (
@ -23,7 +23,7 @@ STEP_USER_DATA_SCHEMA = vol.Schema({vol.Required(CONF_API_KEY): str})
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle a config flow for Uptime Robot.""" """Handle a config flow for UptimeRobot."""
VERSION = 1 VERSION = 1

View File

@ -1,4 +1,4 @@
"""Constants for the Uptime Robot integration.""" """Constants for the UptimeRobot integration."""
from __future__ import annotations from __future__ import annotations
from datetime import timedelta from datetime import timedelta
@ -13,7 +13,7 @@ COORDINATOR_UPDATE_INTERVAL: timedelta = timedelta(seconds=10)
DOMAIN: Final = "uptimerobot" DOMAIN: Final = "uptimerobot"
PLATFORMS: Final = ["binary_sensor"] PLATFORMS: Final = ["binary_sensor"]
ATTRIBUTION: Final = "Data provided by Uptime Robot" ATTRIBUTION: Final = "Data provided by UptimeRobot"
ATTR_TARGET: Final = "target" ATTR_TARGET: Final = "target"

View File

@ -23,14 +23,14 @@ class UptimeRobotEntity(CoordinatorEntity):
description: EntityDescription, description: EntityDescription,
monitor: UptimeRobotMonitor, monitor: UptimeRobotMonitor,
) -> None: ) -> None:
"""Initialize Uptime Robot entities.""" """Initialize UptimeRobot entities."""
super().__init__(coordinator) super().__init__(coordinator)
self.entity_description = description self.entity_description = description
self._monitor = monitor self._monitor = monitor
self._attr_device_info = { self._attr_device_info = {
"identifiers": {(DOMAIN, str(self.monitor.id))}, "identifiers": {(DOMAIN, str(self.monitor.id))},
"name": self.monitor.friendly_name, "name": self.monitor.friendly_name,
"manufacturer": "Uptime Robot Team", "manufacturer": "UptimeRobot Team",
"entry_type": "service", "entry_type": "service",
"model": self.monitor.type.name, "model": self.monitor.type.name,
"configuration_url": f"https://uptimerobot.com/dashboard#{self.monitor.id}", "configuration_url": f"https://uptimerobot.com/dashboard#{self.monitor.id}",

View File

@ -1,6 +1,6 @@
{ {
"domain": "uptimerobot", "domain": "uptimerobot",
"name": "Uptime Robot", "name": "UptimeRobot",
"documentation": "https://www.home-assistant.io/integrations/uptimerobot", "documentation": "https://www.home-assistant.io/integrations/uptimerobot",
"requirements": [ "requirements": [
"pyuptimerobot==21.9.0" "pyuptimerobot==21.9.0"

View File

@ -2,14 +2,14 @@
"config": { "config": {
"step": { "step": {
"user": { "user": {
"description": "You need to supply a read-only API key from Uptime Robot", "description": "You need to supply a read-only API key from UptimeRobot",
"data": { "data": {
"api_key": "[%key:common::config_flow::data::api_key%]" "api_key": "[%key:common::config_flow::data::api_key%]"
} }
}, },
"reauth_confirm": { "reauth_confirm": {
"title": "[%key:common::config_flow::title::reauth%]", "title": "[%key:common::config_flow::title::reauth%]",
"description": "You need to supply a new read-only API key from Uptime Robot", "description": "You need to supply a new read-only API key from UptimeRobot",
"data": { "data": {
"api_key": "[%key:common::config_flow::data::api_key%]" "api_key": "[%key:common::config_flow::data::api_key%]"
} }

View File

@ -1 +1 @@
"""Tests for the Uptime Robot integration.""" """Tests for the UptimeRobot integration."""

View File

@ -1,4 +1,4 @@
"""Common constants and functions for Uptime Robot tests.""" """Common constants and functions for UptimeRobot tests."""
from __future__ import annotations from __future__ import annotations
from enum import Enum from enum import Enum
@ -61,7 +61,7 @@ def mock_uptimerobot_api_response(
status: APIStatus = APIStatus.OK, status: APIStatus = APIStatus.OK,
key: MockApiResponseKey = MockApiResponseKey.MONITORS, key: MockApiResponseKey = MockApiResponseKey.MONITORS,
) -> UptimeRobotApiResponse: ) -> UptimeRobotApiResponse:
"""Mock API response for Uptime Robot.""" """Mock API response for UptimeRobot."""
return UptimeRobotApiResponse.from_dict( return UptimeRobotApiResponse.from_dict(
{ {
"stat": {"error": APIStatus.FAIL}.get(key, status), "stat": {"error": APIStatus.FAIL}.get(key, status),
@ -77,7 +77,7 @@ def mock_uptimerobot_api_response(
async def setup_uptimerobot_integration(hass: HomeAssistant) -> MockConfigEntry: async def setup_uptimerobot_integration(hass: HomeAssistant) -> MockConfigEntry:
"""Set up the Uptime Robot integration.""" """Set up the UptimeRobot integration."""
mock_entry = MockConfigEntry(**MOCK_UPTIMEROBOT_CONFIG_ENTRY_DATA) mock_entry = MockConfigEntry(**MOCK_UPTIMEROBOT_CONFIG_ENTRY_DATA)
mock_entry.add_to_hass(hass) mock_entry.add_to_hass(hass)

View File

@ -1,4 +1,4 @@
"""Test Uptime Robot binary_sensor.""" """Test UptimeRobot binary_sensor."""
from unittest.mock import patch from unittest.mock import patch
@ -53,7 +53,7 @@ async def test_config_import(hass: HomeAssistant) -> None:
async def test_presentation(hass: HomeAssistant) -> None: async def test_presentation(hass: HomeAssistant) -> None:
"""Test the presenstation of Uptime Robot binary_sensors.""" """Test the presenstation of UptimeRobot binary_sensors."""
await setup_uptimerobot_integration(hass) await setup_uptimerobot_integration(hass)
entity = hass.states.get(UPTIMEROBOT_TEST_ENTITY) entity = hass.states.get(UPTIMEROBOT_TEST_ENTITY)

View File

@ -1,4 +1,4 @@
"""Test the Uptime Robot config flow.""" """Test the UptimeRobot config flow."""
from unittest.mock import patch from unittest.mock import patch
import pytest import pytest
@ -196,7 +196,7 @@ async def test_user_unique_id_already_exists(
async def test_reauthentication( async def test_reauthentication(
hass: HomeAssistant, hass: HomeAssistant,
) -> None: ) -> None:
"""Test Uptime Robot reauthentication.""" """Test UptimeRobot reauthentication."""
old_entry = MockConfigEntry(**MOCK_UPTIMEROBOT_CONFIG_ENTRY_DATA) old_entry = MockConfigEntry(**MOCK_UPTIMEROBOT_CONFIG_ENTRY_DATA)
old_entry.add_to_hass(hass) old_entry.add_to_hass(hass)
@ -235,7 +235,7 @@ async def test_reauthentication(
async def test_reauthentication_failure( async def test_reauthentication_failure(
hass: HomeAssistant, hass: HomeAssistant,
) -> None: ) -> None:
"""Test Uptime Robot reauthentication failure.""" """Test UptimeRobot reauthentication failure."""
old_entry = MockConfigEntry(**MOCK_UPTIMEROBOT_CONFIG_ENTRY_DATA) old_entry = MockConfigEntry(**MOCK_UPTIMEROBOT_CONFIG_ENTRY_DATA)
old_entry.add_to_hass(hass) old_entry.add_to_hass(hass)
@ -275,7 +275,7 @@ async def test_reauthentication_failure(
async def test_reauthentication_failure_no_existing_entry( async def test_reauthentication_failure_no_existing_entry(
hass: HomeAssistant, hass: HomeAssistant,
) -> None: ) -> None:
"""Test Uptime Robot reauthentication with no existing entry.""" """Test UptimeRobot reauthentication with no existing entry."""
old_entry = MockConfigEntry( old_entry = MockConfigEntry(
**{**MOCK_UPTIMEROBOT_CONFIG_ENTRY_DATA, "unique_id": None} **{**MOCK_UPTIMEROBOT_CONFIG_ENTRY_DATA, "unique_id": None}
) )
@ -316,7 +316,7 @@ async def test_reauthentication_failure_no_existing_entry(
async def test_reauthentication_failure_account_not_matching( async def test_reauthentication_failure_account_not_matching(
hass: HomeAssistant, hass: HomeAssistant,
) -> None: ) -> None:
"""Test Uptime Robot reauthentication failure when using another account.""" """Test UptimeRobot reauthentication failure when using another account."""
old_entry = MockConfigEntry(**MOCK_UPTIMEROBOT_CONFIG_ENTRY_DATA) old_entry = MockConfigEntry(**MOCK_UPTIMEROBOT_CONFIG_ENTRY_DATA)
old_entry.add_to_hass(hass) old_entry.add_to_hass(hass)

View File

@ -1,4 +1,4 @@
"""Test the Uptime Robot init.""" """Test the UptimeRobot init."""
from unittest.mock import patch from unittest.mock import patch
from pytest import LogCaptureFixture from pytest import LogCaptureFixture