mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-16 14:05:10 +00:00
refactor(remote)!: send service options only in service_params
A service option named like a dl option (e.g. --profile) is no longer dropped or mixed with the dl value; the server casts nested values and keeps cli defaults nested.
This commit is contained in:
@@ -103,3 +103,19 @@ def test_client_sent_keys_uses_the_stamp():
|
||||
|
||||
def test_client_sent_keys_without_stamp_counts_all_keys():
|
||||
assert dm.client_sent_keys({"workers": 1, "quality": None}) == {"workers", "quality"}
|
||||
|
||||
|
||||
def test_service_defaults_and_options_travel_nested(env, monkeypatch):
|
||||
import click
|
||||
|
||||
@click.command()
|
||||
@click.option("--profile", type=int, default=1)
|
||||
@click.option("--device", default="chrome")
|
||||
def cli(**kwargs):
|
||||
pass
|
||||
|
||||
monkeypatch.setattr(handlers.Services, "load", lambda service: SimpleNamespace(cli=cli))
|
||||
params = env(body={"profile": "work", "service_params": {"profile": 2}})
|
||||
assert params["profile"] == "work"
|
||||
assert params["service_params"] == {"profile": 2, "device": "chrome"}
|
||||
assert env(body={"device": "tv"})["service_params"] == {"profile": 1, "device": "tv"}
|
||||
|
||||
Reference in New Issue
Block a user