test restructuring via pytest
This commit is contained in:
parent
d1ac87ce6e
commit
69dd4a9f2f
19 changed files with 858 additions and 619 deletions
17
tests/auth/test_browser.py
Normal file
17
tests/auth/test_browser.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from unittest import mock
|
||||
|
||||
import ytmusicapi.setup
|
||||
from ytmusicapi.setup import main
|
||||
|
||||
|
||||
class TestBrowser:
|
||||
def test_setup_browser(self, config, browser_filepath: str):
|
||||
headers = ytmusicapi.setup(browser_filepath, config["auth"]["headers_raw"])
|
||||
assert len(headers) >= 2
|
||||
headers_raw = config["auth"]["headers_raw"].split("\n")
|
||||
with (
|
||||
mock.patch("sys.argv", ["ytmusicapi", "browser", "--file", browser_filepath]),
|
||||
mock.patch("builtins.input", side_effect=(headers_raw + [EOFError()])),
|
||||
):
|
||||
headers = main()
|
||||
assert len(headers) >= 2
|
||||
Loading…
Reference in a new issue