'Test registering a without a name.'

@patch('homeassistant.components.notify.apns._write_device')
def test_register_device_without_name(self, mock_write):

    yaml_file = {1234: {'name': 'test    device    1', 'tracking_device_id': 'tracking123'}, 5678: {'name': 'test    device    2', 'tracking_device_id': 'tracking456'}}
    written_devices = []
    def fake_write(_out, device):
        'Fake    write_device.'
        written_devices.append(device)
    mock_write.side_effect = fake_write
    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.DOMAIN, 'apns_test_app', {'push_id': '1234'}, blocking=True))
    devices = {dev.push_id: dev for dev in written_devices}
    test_device = devices.get('1234')
    self.assertIsNotNone(test_device)
    self.assertIsNone(test_device.name)
