* Add YouTube stub * Add YouTube stub * Add YouTube stub * Add YouTube stub * Add Youtube stub * Add Youtube stub * Add tests * Add tests * Add tests * Clean up * Add test for options flow * Fix feedback * Fix feedback * Remove obsolete request * Catch exceptions * Parallelize latest video calls * Apply suggestions from code review Co-authored-by: Robert Hillis <tkdrob4390@yahoo.com> * Add youtube to google brands * Fix feedback * Fix feedback * Fix test * Fix test * Add unit test for http error * Update homeassistant/components/youtube/coordinator.py Co-authored-by: Robert Hillis <tkdrob4390@yahoo.com> * Fix black * Fix feedback * Fix feedback * Fix tests --------- Co-authored-by: Robert Hillis <tkdrob4390@yahoo.com>
30 lines
1014 B
Python
30 lines
1014 B
Python
"""Sensor tests for the YouTube integration."""
|
|
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from .conftest import ComponentSetup
|
|
|
|
|
|
async def test_sensor(hass: HomeAssistant, setup_integration: ComponentSetup) -> None:
|
|
"""Test sensor."""
|
|
await setup_integration()
|
|
|
|
state = hass.states.get("sensor.google_for_developers_latest_upload")
|
|
assert state
|
|
assert state.name == "Google for Developers Latest upload"
|
|
assert state.state == "What's new in Google Home in less than 1 minute"
|
|
assert (
|
|
state.attributes["entity_picture"]
|
|
== "https://i.ytimg.com/vi/wysukDrMdqU/sddefault.jpg"
|
|
)
|
|
|
|
state = hass.states.get("sensor.google_for_developers_subscribers")
|
|
assert state
|
|
assert state.name == "Google for Developers Subscribers"
|
|
assert state.state == "2290000"
|
|
assert (
|
|
state.attributes["entity_picture"]
|
|
== "https://yt3.ggpht.com/fca_HuJ99xUxflWdex0XViC3NfctBFreIl8y4i9z411asnGTWY-Ql3MeH_ybA4kNaOjY7kyA=s800-c-k-c0x00ffffff-no-rj"
|
|
)
|