From ea0e73fbcd1f13b4c0c72c732d9eead6f9af0e81 Mon Sep 17 00:00:00 2001 From: Jonathan Weth Date: Thu, 1 Jul 2021 19:01:48 +0200 Subject: Refactor ID system --- test_client.py | 63 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 16 deletions(-) (limited to 'test_client.py') diff --git a/test_client.py b/test_client.py index 72538c1..4a0f83a 100755 --- a/test_client.py +++ b/test_client.py @@ -43,38 +43,69 @@ def cli(): @cli.command() -@click.argument("host", type=int) -def start(host: int): +def get_web_app_hosts(): """Start a session on the RWA.Support.WebApp host with index HOST.""" - click.echo(f"Sending D-Bus request 'start': {host}") - response = req.start(host) + click.echo("Sending D-Bus request 'get_web_app_hosts'") + response = req.get_web_app_hosts() click.echo(f"Your response is: {response}") @cli.command() -@click.argument("pid", type=int) -def stop(pid: int): +@click.argument("host", type=str) +def add_web_app_host(host: str): + """Start a session on the RWA.Support.WebApp host with index HOST.""" + click.echo(f"Sending D-Bus request 'add_web_app_host': {host}") + response = req.add_web_app_host(host) + click.echo(f"Your response is: {response}") + + +@cli.command() +@click.argument("host", type=str) +def remove_web_app_host(host: str): + """Start a session on the RWA.Support.WebApp host with index HOST.""" + click.echo(f"Sending D-Bus request 'remove_web_app_host': {host}") + response = req.remove_web_app_host(host) + click.echo(f"Your response is: {response}") + + +@cli.command() +@click.argument("host_id", type=str) +def start(host_id: str): + """Start a session on the RWA.Support.WebApp host with index HOST.""" + click.echo(f"Sending D-Bus request 'start': {host_id}") + response = req.start(host_id) + click.echo(f"Your response is: {response}") + + +@cli.command() +@click.argument("host_id", type=str) +@click.argument("session_id", type=int) +def stop(host_id: str, session_id: int): """Stop the session with the pid PID.""" - click.echo(f"Sending D-Bus request 'stop' with PID {pid}") - response = req.stop(pid) + click.echo(f"Sending D-Bus request 'stop' with host ID {host_id} and session ID {session_id}") + response = req.stop(host_id, session_id) click.echo(f"Your response is: {response}") @cli.command() -@click.argument("pid", type=int) -def status(pid: int): +@click.argument("host_id", type=str) +@click.argument("session_id", type=int) +def status(host_id: str, session_id: int): """Get the status of the session with the pid PID.""" - click.echo(f"Sending D-Bus request 'status' with PID {pid}") - response = req.status(pid) + click.echo(f"Sending D-Bus request 'status' with host ID {host_id} and session ID {session_id}") + response = req.status(host_id, session_id) click.echo(f"Your response is: {response}") @cli.command() -@click.argument("pid", type=int) -def refresh_status(pid: int): +@click.argument("host_id", type=str) +@click.argument("session_id", type=int) +def refresh_status(host_id: str, session_id: int): """Refresh and get the status of the session with the pid PID.""" - click.echo(f"Sending D-Bus request 'refresh_status' with PID {pid}") - response = req.refresh_status(pid) + click.echo( + f"Sending D-Bus request 'refresh_status' with host ID {host_id} and session ID {session_id}" + ) + response = req.refresh_status(host_id, session_id) click.echo(f"Your response is: {response}") -- cgit v1.2.3