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:
Robbie Trencheny 2016-10-11 20:33:41 -07:00 committed by Paulus Schoutsen
parent e135691bd6
commit d302dbec2d
2 changed files with 1 additions and 4 deletions

View file

@ -101,7 +101,7 @@ def setup(hass, config):
if targets.get(call.service) is not None:
kwargs[ATTR_TARGET] = [targets[call.service]]
else:
elif call.data.get(ATTR_TARGET) is not None:
kwargs[ATTR_TARGET] = call.data.get(ATTR_TARGET)
message.hass = hass

View file

@ -64,7 +64,6 @@ class TestNotifyDemo(unittest.TestCase):
data = self.events[0].data
assert {
'message': 'my message',
'target': None,
'title': 'my title',
'data': {'hello': 'world'}
} == data
@ -92,7 +91,6 @@ data_template:
self.assertTrue(len(self.events) == 1)
assert {
'message': 'Test 123 4',
'target': None,
'data': {
'push': {
'sound':
@ -124,7 +122,6 @@ data_template:
assert {
'message': 'Test 123 4',
'title': 'Test',
'target': None,
'data': {
'push': {
'sound':