'Test updating an existing device.'

@patch('apns2.client.APNsClient')
def test_send(self, mock_client):

    send = mock_client.return_value.send_notification
    yaml_file = {1234: {'name': 'test    device    1'}}
    with patch('homeassistant.components.notify.apns.load_yaml_config_file', Mock(return_value=yaml_file)):
        self._setup_notify()
    self.assertTrue(self.hass.services.call('notify', 'test_app', {'message': 'Hello', 'data': {'badge': 1, 'sound': 'test.mp3', 'category': 'testing'}}, blocking=True))
    self.assertTrue(send.called)
    self.assertEqual(1, len(send.mock_calls))
    target = send.mock_calls[0][1][0]
    payload = send.mock_calls[0][1][1]
    self.assertEqual('1234', target)
    self.assertEqual('Hello', payload.alert)
    self.assertEqual(1, payload.badge)
    self.assertEqual('test.mp3', payload.sound)
    self.assertEqual('testing', payload.category)
