mirror of https://github.com/morpheus65535/bazarr
46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
import pytest
|
|
|
|
import inspect
|
|
|
|
from bazarr.app import get_providers
|
|
|
|
|
|
def test_get_providers_auth():
|
|
for val in get_providers.get_providers_auth().values():
|
|
assert isinstance(val, dict)
|
|
|
|
|
|
def test_get_providers_auth_with_provider_registry():
|
|
"""Make sure all providers will be properly initialized with bazarr
|
|
configs"""
|
|
from subliminal_patch.extensions import provider_registry
|
|
|
|
auths = get_providers.get_providers_auth()
|
|
for key, val in auths.items():
|
|
provider = provider_registry[key]
|
|
sign = inspect.signature(provider.__init__)
|
|
for sub_key in val.keys():
|
|
if sub_key not in sign.parameters:
|
|
raise ValueError(f"'{sub_key}' parameter not present in {provider}")
|
|
|
|
assert sign.parameters[sub_key] is not None
|
|
|
|
|
|
def test_get_providers_auth_embeddedsubtitles():
|
|
item = get_providers.get_providers_auth()["embeddedsubtitles"]
|
|
assert isinstance(item["included_codecs"], list)
|
|
assert isinstance(item["hi_fallback"], bool)
|
|
assert isinstance(item["cache_dir"], str)
|
|
assert isinstance(item["ffprobe_path"], str)
|
|
assert isinstance(item["ffmpeg_path"], str)
|
|
assert isinstance(item["timeout"], str)
|
|
assert isinstance(item["unknown_as_english"], bool)
|
|
|
|
|
|
def test_get_providers_auth_karagarga():
|
|
item = get_providers.get_providers_auth()["karagarga"]
|
|
assert item["username"] is not None
|
|
assert item["password"] is not None
|
|
assert item["f_username"] is not None
|
|
assert item["f_password"] is not None
|