Add YouTube integration (#92988)

* 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>
This commit is contained in:
Joost Lekkerkerker 2023-05-27 20:21:12 +02:00 committed by GitHub
parent bb170a2bbf
commit e4c51d43f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 1456 additions and 1 deletions

View file

@ -0,0 +1,29 @@
"""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"
)