Update use of new Redash v5 queries API.

Fixes #79
This commit is contained in:
Peter Bengtsson 2018-10-22 14:41:53 -04:00 коммит произвёл Marina Samuel
Родитель 5dd6f7f930
Коммит 7b9654a97a
2 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -344,14 +344,14 @@ class RedashClient(object):
return fork
def search_queries(self, keyword):
url_path = "queries/search?q={0}&{1}".format(keyword, self._url_params)
url_path = "queries?q={0}&{1}".format(keyword, self._url_params)
query_url = urljoin(self.API_BASE_URL, url_path)
json_result, response = self._make_request(
requests.get, query_url)
templated_queries = []
for query in json_result:
for query in json_result["results"]:
query_id = query.get("id", None)
visualization = self._get_visualization(query_id)
options = visualization.get("options", None)

Просмотреть файл

@ -411,12 +411,14 @@ class TestRedashClient(AppTest):
def test_search_queries_returns_correct_attributes(self):
self.get_calls = 0
QUERIES_IN_SEARCH = [{
"id": 5,
"description": "SomeQuery",
"name": "Query Title",
"data_source_id": 5
}]
QUERIES_IN_SEARCH = {
"results": [{
"id": 5,
"description": "SomeQuery",
"name": "Query Title",
"data_source_id": 5
}]
}
VISUALIZATIONS_FOR_QUERY = {
"visualizations": [
{"options": {}},