Implement get_account_info() to get authenticated user's account info (#556) (#557)

* implement get_account_info to provide information about the authenticated user's account (#556)

* Apply suggestions from code review to tests/README.rst

Co-authored-by: sigma67 <16363825+sigma67@users.noreply.github.com>

* simplify get_account_info by moving code out of parsers.py and navigation.py

* test with non-auth account

* format

* update .pre-commit-config.yaml

---------

Co-authored-by: sigma67 <16363825+sigma67@users.noreply.github.com>
Co-authored-by: sigma67 <sigma67.github@gmail.com>
This commit is contained in:
Alex Pastel 2024-03-03 11:55:06 -07:00 • committed by GitHub
commit c412d7ce34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 60 additions and 1 deletions

View file

@ -1,3 +1,5 @@
from urllib.parse import urlparse
import pytest
@ -109,3 +111,12 @@ class TestLibrary:
def test_subscribe_artists(self, yt_auth):
yt_auth.subscribe_artists(["UCUDVBtnOQi4c7E8jebpjc9Q"])
yt_auth.unsubscribe_artists(["UCUDVBtnOQi4c7E8jebpjc9Q"])
def test_get_account_info(self, config, yt, yt_oauth):
with pytest.raises(Exception, match="Please provide authentication"):
yt.get_account_info()
account_info = yt_oauth.get_account_info()
assert account_info["accountName"] == config.get("auth", "account_name")
assert account_info["channelHandle"] == config.get("auth", "channel_handle")
assert bool(urlparse(account_info["accountPhotoUrl"]))