mirror of
https://github.com/nathom/streamrip.git
synced 2025-06-01 15:58:24 -04:00
Update
This commit is contained in:
parent
7cbd77edc5
commit
837e934476
31 changed files with 990 additions and 172 deletions
24
tests/fixtures/clients.py
vendored
Normal file
24
tests/fixtures/clients.py
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
import hashlib
|
||||
import os
|
||||
|
||||
import pytest
|
||||
from util import arun
|
||||
|
||||
from streamrip.config import Config
|
||||
from streamrip.qobuz_client import QobuzClient
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def qobuz_client():
|
||||
config = Config.defaults()
|
||||
config.session.qobuz.email_or_userid = os.environ["QOBUZ_EMAIL"]
|
||||
config.session.qobuz.password_or_token = hashlib.md5(
|
||||
os.environ["QOBUZ_PASSWORD"].encode("utf-8")
|
||||
).hexdigest()
|
||||
if "QOBUZ_APP_ID" in os.environ and "QOBUZ_SECRETS" in os.environ:
|
||||
config.session.qobuz.app_id = os.environ["QOBUZ_APP_ID"]
|
||||
config.session.qobuz.secrets = os.environ["QOBUZ_SECRETS"].split(",")
|
||||
client = QobuzClient(config)
|
||||
arun(client.login())
|
||||
|
||||
return client
|
16
tests/fixtures/config.py
vendored
Normal file
16
tests/fixtures/config.py
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
import hashlib
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from streamrip.config import Config
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def config():
|
||||
c = Config.defaults()
|
||||
c.session.qobuz.email_or_userid = os.environ["QOBUZ_EMAIL"]
|
||||
c.session.qobuz.password_or_token = hashlib.md5(
|
||||
os.environ["QOBUZ_PASSWORD"].encode("utf-8")
|
||||
).hexdigest()
|
||||
return c
|
17
tests/fixtures/util.py
vendored
Normal file
17
tests/fixtures/util.py
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
import asyncio
|
||||
|
||||
loop = asyncio.new_event_loop()
|
||||
|
||||
|
||||
def arun(coro):
|
||||
return loop.run_until_complete(coro)
|
||||
|
||||
|
||||
def afor(async_gen):
|
||||
async def _afor(async_gen):
|
||||
l = []
|
||||
async for item in async_gen:
|
||||
l.append(item)
|
||||
return l
|
||||
|
||||
return arun(_afor(async_gen))
|
Loading…
Add table
Add a link
Reference in a new issue