* 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:
parent
13701c40b7
commit
c412d7ce34
6 changed files with 60 additions and 1 deletions
|
|
@ -24,6 +24,9 @@ The entry descriptions should be self-explanatory.
|
|||
For the headers_raw, you need to indent the overflowing lines with a tab character. For the upload test you need a suitable music file in the test directory.
|
||||
Adjust the file to contain appropriate information for your YouTube account and local setup.
|
||||
|
||||
``account_name`` and ``channel_handle`` for test.cfg can be obtained by visiting either YouTube or YouTube Music and
|
||||
clicking your profile picture icon in the top right while signed in with your test account.
|
||||
|
||||
Brand accounts can be created by first signing into the google account you wish to have as the parent/controlling
|
||||
account then navigating `here. <https://www.youtube.com/create_channel?action_create_new_channel_redirect=true>`_
|
||||
|
||||
|
|
|
|||
|
|
@ -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"]))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
[auth]
|
||||
brand_account = 101234229123420379537
|
||||
brand_account_empty = 1123456629123420379537
|
||||
account_name = Sample Account
|
||||
channel_handle = @SampleAccount
|
||||
headers = headers_auth_json_as_string
|
||||
headers_empty = headers_account_with_empty_library_as_json_as_string
|
||||
browser_file = ./browser.json
|
||||
|
|
|
|||
Loading…
Reference in a new issue