diff options
Diffstat (limited to 'test_client.py')
-rwxr-xr-x | test_client.py | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/test_client.py b/test_client.py index 0e78784..5176ad2 100755 --- a/test_client.py +++ b/test_client.py @@ -3,7 +3,7 @@ # This file is part of Remote Support Desktop # https://gitlab.das-netzwerkteam.de/RemoteWebApp/rwa.support.sessionservice # Copyright 2020, 2021 Jonathan Weth <dev@jonathanweth.de> -# Copyright 2020 Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de> +# Copyright 2020, 2021 Daniel Teichmann <daniel.teichmann@das-netzwerkteam.de> # Copyright 2020 Mike Gabriel <mike.gabriel@das-netzwerkteam.de> # SPDX-License-Identifier: GPL-2.0-or-later # @@ -25,13 +25,53 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. + +import click import dbus bus = dbus.SessionBus() +req = bus.get_object("org.ArcticaProject.RWASupportSessionService", "/RWASupportSessionService") + + +@click.group() +def cli(): + pass + + +@cli.command() +@click.argument("host") +def start(host: int): + """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(f"Your response is: {response}") + + +@cli.command() +@click.argument("pid") +def stop(pid: 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"Your response is: {response}") + + +@cli.command() +@click.argument("pid") +def status(pid: 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"Your response is: {response}") + -api = bus.get_object("org.ArcticaProject.RWASupportSessionService", "/RWASupportSessionService") +@cli.command() +@click.argument("pid") +def refresh_status(pid: 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"Your response is: {response}") -hosts = api.get_web_app_hosts() -print(hosts) -curr = api.start(0) -print("Your VNC session is", curr) +if __name__ == "__main__": + cli() |