|
|
@ -1,5 +1,7 @@
|
|
|
|
from pathlib import Path
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
|
|
from subliminal_patch import core
|
|
|
|
from subliminal_patch import core
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -17,3 +19,54 @@ def test_scan_video_episode(tmpdir):
|
|
|
|
|
|
|
|
|
|
|
|
result = core.scan_video(str(video_path))
|
|
|
|
result = core.scan_video(str(video_path))
|
|
|
|
assert isinstance(result, core.Episode)
|
|
|
|
assert isinstance(result, core.Episode)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
|
|
|
|
def pool_instance():
|
|
|
|
|
|
|
|
yield core.SZProviderPool({"argenteam"}, {})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_pool_update_w_nothing(pool_instance):
|
|
|
|
|
|
|
|
pool_instance.update({}, {}, [], {})
|
|
|
|
|
|
|
|
assert pool_instance.providers == set()
|
|
|
|
|
|
|
|
assert pool_instance.discarded_providers == set()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_pool_update_w_multiple_providers(pool_instance):
|
|
|
|
|
|
|
|
assert pool_instance.providers == {"argenteam"}
|
|
|
|
|
|
|
|
pool_instance.update({"argenteam", "subdivx", "subf2m"}, {}, [], {})
|
|
|
|
|
|
|
|
assert pool_instance.providers == {"argenteam", "subdivx", "subf2m"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_pool_update_discarded_providers(pool_instance):
|
|
|
|
|
|
|
|
assert pool_instance.providers == {"argenteam"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Provider was discarded internally
|
|
|
|
|
|
|
|
pool_instance.discarded_providers = {"argenteam"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert pool_instance.discarded_providers == {"argenteam"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Provider is set to be used again
|
|
|
|
|
|
|
|
pool_instance.update({"subdivx", "argenteam"}, {}, [], {})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert pool_instance.providers == {"argenteam", "subdivx"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Provider should disappear from discarded providers
|
|
|
|
|
|
|
|
assert pool_instance.discarded_providers == set()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_pool_update_discarded_providers_2(pool_instance):
|
|
|
|
|
|
|
|
assert pool_instance.providers == {"argenteam"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Provider was discarded internally
|
|
|
|
|
|
|
|
pool_instance.discarded_providers = {"argenteam"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert pool_instance.discarded_providers == {"argenteam"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Provider is not set to be used again
|
|
|
|
|
|
|
|
pool_instance.update({"subdivx"}, {}, [], {})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert pool_instance.providers == {"subdivx"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Provider should not disappear from discarded providers
|
|
|
|
|
|
|
|
assert pool_instance.discarded_providers == {"argenteam"}
|
|
|
|