Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "test/client: simplify query handling"
Browse files Browse the repository at this point in the history
This reverts commit 74e77c6.
msune committed Jun 14, 2024
1 parent 74e77c6 commit 7b92c08
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/client.py
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
import json
import requests
import argparse
from urllib.parse import urlencode

DEFAULT_HOST = "127.0.0.1"
DEFAULT_PORT = 8080
@@ -33,17 +34,18 @@ def delete_dashboard(host, port, dashboard_id) -> requests.Response:


def get_dashboard(host, port, dashboard_id=None, shortName=None, dataCube=None) -> requests.Response:
params = None
url = f"http://{host}:{port}/{DEFAULT_PATH}"
if dashboard_id:
url = f"{url}/{dashboard_id}"
url = f"http://{host}:{port}/{DEFAULT_PATH}/{dashboard_id}"
else:
params = {}
query = {}
if shortName:
params["shortName"] = shortName
query["shortName"] = shortName
if dataCube:
params["dataCube"] = dataCube
response = requests.get(url, params=params)
query["dataCube"] = dataCube
query_str = urlencode(query)
query_str = "?" + query_str if query_str != "" else ""
url = f"http://{host}:{port}/{DEFAULT_PATH}{query_str}"
response = requests.get(url)
print_response(response)
return response

0 comments on commit 7b92c08

Please sign in to comment.