From 49ba982d6c7e3f2f63b0d1a0d31f6356884985c7 Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Wed, 27 Nov 2019 10:17:59 -0500 Subject: [PATCH 1/3] change apns service domain and remove unused variable --- homeassistant/components/apns/notify.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/homeassistant/components/apns/notify.py b/homeassistant/components/apns/notify.py index c24c9cc16052ae..b4f637040fc9e5 100644 --- a/homeassistant/components/apns/notify.py +++ b/homeassistant/components/apns/notify.py @@ -9,7 +9,6 @@ from homeassistant.components.notify import ( ATTR_DATA, ATTR_TARGET, - DOMAIN, PLATFORM_SCHEMA, BaseNotificationService, ) @@ -19,12 +18,12 @@ import homeassistant.helpers.config_validation as cv from homeassistant.helpers.event import track_state_change +DOMAIN = "apns" APNS_DEVICES = "apns.yaml" CONF_CERTFILE = "cert_file" CONF_TOPIC = "topic" CONF_SANDBOX = "sandbox" DEVICE_TRACKER_DOMAIN = "device_tracker" -SERVICE_REGISTER = "apns_register" ATTR_PUSH_ID = "push_id" From 0b0eb0811b2801fc5385d7673f9239abd12742f8 Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Wed, 27 Nov 2019 11:17:21 -0500 Subject: [PATCH 2/3] fix tests --- tests/components/apns/test_notify.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/components/apns/test_notify.py b/tests/components/apns/test_notify.py index 78f597c58adef4..19d869ea678313 100644 --- a/tests/components/apns/test_notify.py +++ b/tests/components/apns/test_notify.py @@ -121,7 +121,7 @@ def fake_write(_out, device): self._setup_notify() assert self.hass.services.call( - notify.DOMAIN, + apns.DOMAIN, "apns_test_app", {"push_id": "1234", "name": "test device"}, blocking=True, @@ -153,7 +153,7 @@ def fake_write(_out, device): self._setup_notify() assert self.hass.services.call( - notify.DOMAIN, "apns_test_app", {"push_id": "1234"}, blocking=True + apns.DOMAIN, "apns_test_app", {"push_id": "1234"}, blocking=True ) devices = {dev.push_id: dev for dev in written_devices} @@ -183,7 +183,7 @@ def fake_write(_out, device): self._setup_notify() assert self.hass.services.call( - notify.DOMAIN, + apns.DOMAIN, "apns_test_app", {"push_id": "1234", "name": "updated device 1"}, blocking=True, @@ -222,7 +222,7 @@ def fake_write(_out, device): self._setup_notify() assert self.hass.services.call( - notify.DOMAIN, + apns.DOMAIN, "apns_test_app", {"push_id": "1234", "name": "updated device 1"}, blocking=True, From 8089e4c1a5ee5e9bdfdad320625b410b3b83c164 Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Wed, 27 Nov 2019 13:19:52 -0500 Subject: [PATCH 3/3] move DOMAIN to const.py and import DEVICE_TRACKER_DOMAIN from base component --- homeassistant/components/apns/const.py | 2 ++ homeassistant/components/apns/notify.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 homeassistant/components/apns/const.py diff --git a/homeassistant/components/apns/const.py b/homeassistant/components/apns/const.py new file mode 100644 index 00000000000000..a8dc1204aa1949 --- /dev/null +++ b/homeassistant/components/apns/const.py @@ -0,0 +1,2 @@ +"""Constants for the apns component.""" +DOMAIN = "apns" diff --git a/homeassistant/components/apns/notify.py b/homeassistant/components/apns/notify.py index b4f637040fc9e5..ce761b502ac414 100644 --- a/homeassistant/components/apns/notify.py +++ b/homeassistant/components/apns/notify.py @@ -17,13 +17,14 @@ from homeassistant.helpers import template as template_helper import homeassistant.helpers.config_validation as cv from homeassistant.helpers.event import track_state_change +from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER_DOMAIN + +from .const import DOMAIN -DOMAIN = "apns" APNS_DEVICES = "apns.yaml" CONF_CERTFILE = "cert_file" CONF_TOPIC = "topic" CONF_SANDBOX = "sandbox" -DEVICE_TRACKER_DOMAIN = "device_tracker" ATTR_PUSH_ID = "push_id"