forked from kenzuya/unshackle
feat(remote)!: make remote serve WebSocket-only and refuse older clients with CLIENT_OUTDATED
This commit is contained in:
@@ -300,13 +300,7 @@ def cdm_only_client(monkeypatch: pytest.MonkeyPatch, tmp_path: Path, cdm: Any, c
|
||||
monkeypatch.setattr(config, "credentials", {})
|
||||
monkeypatch.setattr(config.directories, "cookies", tmp_path / "cookies")
|
||||
monkeypatch.setattr(config.directories, "cache", tmp_path / "cache")
|
||||
monkeypatch.setattr(
|
||||
remote_channel,
|
||||
"open_channel",
|
||||
lambda service: SimpleNamespace(
|
||||
in_flight=None, close=lambda: None, drain_logs=lambda: None, keep_alive=lambda: None
|
||||
),
|
||||
)
|
||||
monkeypatch.setattr(remote_channel, "open_channel", lambda service: SimpleNamespace(close=lambda: None))
|
||||
obj = SimpleNamespace(cdm=cdm, cdm_entry=False, proxy_providers=[])
|
||||
parent = click.Context(click.Command("dl"), obj=obj)
|
||||
parent.params = {"no_proxy": True, "cdm_only": True}
|
||||
@@ -314,14 +308,16 @@ def cdm_only_client(monkeypatch: pytest.MonkeyPatch, tmp_path: Path, cdm: Any, c
|
||||
svc = RemoteService(ctx, "EXAMPLE", "example-1", "http://server", "key", {"_server_cdm": True})
|
||||
posts: list = []
|
||||
svc.client = SimpleNamespace(
|
||||
tunnel=None, post=lambda endpoint, data, expect=(): posts.append(data) or created, delete=lambda endpoint: {}
|
||||
tunnel=None,
|
||||
post=lambda endpoint, data, expect=(): posts.append(data) or {**created, "session_id": data["session_id"]},
|
||||
delete=lambda endpoint: {},
|
||||
)
|
||||
svc.posts = posts
|
||||
return svc
|
||||
|
||||
|
||||
def test_cdm_only_declines_the_server_cdm_and_its_vault(monkeypatch, tmp_path) -> None:
|
||||
created = {"session_id": "sess", "server_cdm": False, "server_vault": True}
|
||||
created = {"server_cdm": False, "server_vault": True}
|
||||
svc = cdm_only_client(monkeypatch, tmp_path, cdm_type_stub("widevine"), created)
|
||||
try:
|
||||
svc.authenticate()
|
||||
@@ -341,7 +337,7 @@ def test_cdm_only_without_a_local_cdm_fails_before_the_session(monkeypatch, tmp_
|
||||
|
||||
|
||||
def test_cdm_only_on_the_server_device_fails(monkeypatch, tmp_path) -> None:
|
||||
created = {"session_id": "sess", "server_cdm": True, "server_device": True}
|
||||
created = {"server_cdm": True, "server_device": True}
|
||||
svc = cdm_only_client(monkeypatch, tmp_path, cdm_type_stub("widevine"), created)
|
||||
try:
|
||||
with pytest.raises(click.ClickException, match="runs on the server's device"):
|
||||
|
||||
Reference in New Issue
Block a user