mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Notify: Only attach target if in call data (#3831)
* Only pass through the target if it has a value * Target will no longer be none
This commit is contained in:
parent
e135691bd6
commit
d302dbec2d
@ -101,7 +101,7 @@ def setup(hass, config):
|
|||||||
|
|
||||||
if targets.get(call.service) is not None:
|
if targets.get(call.service) is not None:
|
||||||
kwargs[ATTR_TARGET] = [targets[call.service]]
|
kwargs[ATTR_TARGET] = [targets[call.service]]
|
||||||
else:
|
elif call.data.get(ATTR_TARGET) is not None:
|
||||||
kwargs[ATTR_TARGET] = call.data.get(ATTR_TARGET)
|
kwargs[ATTR_TARGET] = call.data.get(ATTR_TARGET)
|
||||||
|
|
||||||
message.hass = hass
|
message.hass = hass
|
||||||
|
@ -64,7 +64,6 @@ class TestNotifyDemo(unittest.TestCase):
|
|||||||
data = self.events[0].data
|
data = self.events[0].data
|
||||||
assert {
|
assert {
|
||||||
'message': 'my message',
|
'message': 'my message',
|
||||||
'target': None,
|
|
||||||
'title': 'my title',
|
'title': 'my title',
|
||||||
'data': {'hello': 'world'}
|
'data': {'hello': 'world'}
|
||||||
} == data
|
} == data
|
||||||
@ -92,7 +91,6 @@ data_template:
|
|||||||
self.assertTrue(len(self.events) == 1)
|
self.assertTrue(len(self.events) == 1)
|
||||||
assert {
|
assert {
|
||||||
'message': 'Test 123 4',
|
'message': 'Test 123 4',
|
||||||
'target': None,
|
|
||||||
'data': {
|
'data': {
|
||||||
'push': {
|
'push': {
|
||||||
'sound':
|
'sound':
|
||||||
@ -124,7 +122,6 @@ data_template:
|
|||||||
assert {
|
assert {
|
||||||
'message': 'Test 123 4',
|
'message': 'Test 123 4',
|
||||||
'title': 'Test',
|
'title': 'Test',
|
||||||
'target': None,
|
|
||||||
'data': {
|
'data': {
|
||||||
'push': {
|
'push': {
|
||||||
'sound':
|
'sound':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user