mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-25 10:25:09 +00:00
fix(remote): send a service option under its served name
This commit is contained in:
@@ -146,6 +146,24 @@ def test_service_params_are_the_only_service_options_when_present() -> None:
|
||||
build({"service_params": {"count": "x"}})
|
||||
|
||||
|
||||
def test_service_params_keyed_by_flag_reach_an_option_with_another_name() -> None:
|
||||
import click
|
||||
|
||||
from unshackle.core.api.handlers import SESSION_TRANSPORT_KEYS, instantiate_service
|
||||
|
||||
@click.command()
|
||||
@click.argument("title")
|
||||
@click.option("--zone", "zone_code", default=None)
|
||||
@click.option("--lang", "svc_lang", default=None)
|
||||
def cli(title: str, **kwargs: object) -> dict:
|
||||
return kwargs
|
||||
|
||||
module = type("Svc", (), {"cli": cli})
|
||||
data = {"service_params": {"zone": "eu", "svc_lang": "de", "lang": "fr"}}
|
||||
built = instantiate_service(click.Context(click.Command("dl")), module, "t", data, SESSION_TRANSPORT_KEYS)
|
||||
assert built == {"zone_code": "eu", "svc_lang": "de"}
|
||||
|
||||
|
||||
def test_drain_server_logs_survives_client_systemexit() -> None:
|
||||
"""RemoteClient raises SystemExit on transport errors; the drain must swallow it."""
|
||||
from unshackle.core.remote_service import RemoteService
|
||||
|
||||
Reference in New Issue
Block a user