forked from kenzuya/unshackle
feat(dl): let a service force --license-first with the LICENSE_FIRST class variable
This commit is contained in:
@@ -46,6 +46,7 @@ class StubService:
|
||||
A test puts extra service work in ``hooks``: "titles" runs inside get_titles, on the service thread.
|
||||
"""
|
||||
|
||||
LICENSE_FIRST = False
|
||||
logins = 0
|
||||
hooks: dict[str, Callable[[StubService], None]] = {}
|
||||
|
||||
@@ -290,3 +291,18 @@ def test_server_request_records_never_reach_the_remote_client(
|
||||
assert all("body" not in e["response"] for e in entries)
|
||||
own = [e for e in entries if e["request"]["host"] == server_host and e["request"]["path"].endswith("/titles")]
|
||||
assert own and all((tmp_path / "server" / e["response"]["body_file"]).is_file() for e in own)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("forced", [True, False])
|
||||
def test_the_client_reports_the_license_first_of_the_served_service(
|
||||
server: SimpleNamespace, monkeypatch: pytest.MonkeyPatch, forced: bool
|
||||
) -> None:
|
||||
monkeypatch.setattr(StubService, "LICENSE_FIRST", forced)
|
||||
remote = make_client(server.url)
|
||||
try:
|
||||
remote.authenticate()
|
||||
remote.get_tracks(remote.get_titles()[0])
|
||||
finally:
|
||||
remote.close()
|
||||
|
||||
assert remote.LICENSE_FIRST is forced
|
||||
|
||||
Reference in New Issue
Block a user