Skip to content

Commit 4a16049

Browse files
authored
fix: return type for dashboard when include is used (influxdata#321)
1 parent d22a361 commit 4a16049

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
### Features
44
1. [#319](https://github.com/influxdata/influxdb-client-python/pull/319): Add supports for array expressions in query parameters
5+
6+
### Bug Fixes
7+
1. [#321](https://github.com/influxdata/influxdb-client-python/pull/321): Fixes return type for dashboard when `include=properties` is used
58

69
## 1.20.0 [2021-08-20]
710

influxdb_client/service/dashboards_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ def get_dashboards_id(self, dashboard_id, **kwargs): # noqa: E501,D401,D403
733733
:param str dashboard_id: The ID of the dashboard to update. (required)
734734
:param str zap_trace_span: OpenTracing span context
735735
:param str include: Includes the cell view properties in the response if set to `properties`
736-
:return: Dashboard
736+
:return: DashboardWithViewProperties
737737
If the method is called asynchronously,
738738
returns the request thread.
739739
""" # noqa: E501
@@ -756,7 +756,7 @@ def get_dashboards_id_with_http_info(self, dashboard_id, **kwargs): # noqa: E50
756756
:param str dashboard_id: The ID of the dashboard to update. (required)
757757
:param str zap_trace_span: OpenTracing span context
758758
:param str include: Includes the cell view properties in the response if set to `properties`
759-
:return: Dashboard
759+
:return: DashboardWithViewProperties
760760
If the method is called asynchronously,
761761
returns the request thread.
762762
""" # noqa: E501
@@ -820,7 +820,7 @@ def get_dashboards_id_with_http_info(self, dashboard_id, **kwargs): # noqa: E50
820820
body=body_params,
821821
post_params=form_params,
822822
files=local_var_files,
823-
response_type='Dashboard', # noqa: E501
823+
response_type='DashboardWithViewProperties', # noqa: E501
824824
auth_settings=auth_settings,
825825
async_req=local_var_params.get('async_req'),
826826
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501

tests/test_Dashboards.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,22 @@ def test_create_dashboard_with_cell(self):
3131
self.assertIsNotNone(cell.id)
3232
view = cells_service.get_dashboards_id_cells_id_view(dashboard_id=dashboard.id, cell_id=cell.id)
3333
self.assertEqual(view.name, f"Cell_{unique_id}_IT")
34+
35+
def test_get_dashboard_with_cell_with_properties(self):
36+
unique_id = str(datetime.datetime.now().timestamp())
37+
38+
dashboard = self.dashboards_service.post_dashboards(
39+
create_dashboard_request=CreateDashboardRequest(org_id=self.find_my_org().id,
40+
name=f"Dashboard_{unique_id}_IT"))
41+
42+
# create cell
43+
CellsService(self.client.api_client).post_dashboards_id_cells(
44+
dashboard_id=dashboard.id, create_cell=CreateCell(name=f"Cell_{unique_id}_IT", h=3, w=12))
45+
46+
# retrieve dashboard
47+
dashboard = self.dashboards_service.get_dashboards_id(dashboard.id)
48+
49+
from influxdb_client import DashboardWithViewProperties, CellWithViewProperties
50+
self.assertEqual(DashboardWithViewProperties, type(dashboard))
51+
self.assertEqual(1, len(dashboard.cells))
52+
self.assertEqual(CellWithViewProperties, type(dashboard.cells[0]))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy