async def test_create_cast_device_with_uuid(hass): """Test create cast devices with UUID creates entities.""" added_casts = hass.data[cast.ADDED_CAST_DEVICES_KEY] = set() info = get_fake_chromecast_info() cast_device = cast._async_create_cast_device(hass, info) assert cast_device is not None assert info.uuid in added_casts # Sending second time should not create new entity cast_device = cast._async_create_cast_device(hass, info) assert cast_device is None
def test_create_cast_device_with_uuid(hass): """Test create cast devices with UUID.""" added_casts = hass.data[cast.ADDED_CAST_DEVICES_KEY] = {} chromecast = get_fake_chromecast() cast_device = cast._async_create_cast_device(hass, chromecast) assert cast_device is not None assert chromecast.uuid in added_casts with patch.object(cast_device, 'async_set_chromecast') as mock_set: assert cast._async_create_cast_device(hass, chromecast) is None assert mock_set.call_count == 0 chromecast = get_fake_chromecast(host='192.168.178.1') assert cast._async_create_cast_device(hass, chromecast) is None assert mock_set.call_count == 1 mock_set.assert_called_once_with(chromecast)
def test_create_cast_device_with_uuid(hass): """Test create cast devices with UUID.""" added_casts = hass.data[cast.ADDED_CAST_DEVICES_KEY] = {} chromecast = get_fake_chromecast() cast_device = cast._async_create_cast_device(hass, chromecast) assert cast_device is not None assert chromecast.uuid in added_casts with patch.object(cast_device, 'async_set_chromecast') as mock_set: assert cast._async_create_cast_device(hass, chromecast) is None assert mock_set.call_count == 0 chromecast = get_fake_chromecast(host='192.168.178.1') assert cast._async_create_cast_device(hass, chromecast) is None assert mock_set.call_count == 1 mock_set.assert_called_once_with(chromecast)
async def test_create_cast_device_without_uuid(hass): """Test create a cast device with no UUId should still create an entity.""" info = get_fake_chromecast_info(uuid=None) cast_device = cast._async_create_cast_device(hass, info) assert cast_device is not None
def test_create_cast_device_without_uuid(hass): """Test create a cast device without a UUID.""" chromecast = get_fake_chromecast(uuid=None) cast_device = cast._async_create_cast_device(hass, chromecast) assert cast_device is not None
def test_create_cast_device_without_uuid(hass): """Test create a cast device without a UUID.""" chromecast = get_fake_chromecast(uuid=None) cast_device = cast._async_create_cast_device(hass, chromecast) assert cast_device is not None