Skip to content

Commit

Permalink
fix: return type for dashboard when include is used (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi1693 authored Aug 27, 2021
1 parent d22a361 commit 4a16049
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

### Features
1. [#319](https://github.com/influxdata/influxdb-client-python/pull/319): Add supports for array expressions in query parameters

### Bug Fixes
1. [#321](https://github.com/influxdata/influxdb-client-python/pull/321): Fixes return type for dashboard when `include=properties` is used

## 1.20.0 [2021-08-20]

Expand Down
6 changes: 3 additions & 3 deletions influxdb_client/service/dashboards_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ def get_dashboards_id(self, dashboard_id, **kwargs): # noqa: E501,D401,D403
:param str dashboard_id: The ID of the dashboard to update. (required)
:param str zap_trace_span: OpenTracing span context
:param str include: Includes the cell view properties in the response if set to `properties`
:return: Dashboard
:return: DashboardWithViewProperties
If the method is called asynchronously,
returns the request thread.
""" # noqa: E501
Expand All @@ -756,7 +756,7 @@ def get_dashboards_id_with_http_info(self, dashboard_id, **kwargs): # noqa: E50
:param str dashboard_id: The ID of the dashboard to update. (required)
:param str zap_trace_span: OpenTracing span context
:param str include: Includes the cell view properties in the response if set to `properties`
:return: Dashboard
:return: DashboardWithViewProperties
If the method is called asynchronously,
returns the request thread.
""" # noqa: E501
Expand Down Expand Up @@ -820,7 +820,7 @@ def get_dashboards_id_with_http_info(self, dashboard_id, **kwargs): # noqa: E50
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='Dashboard', # noqa: E501
response_type='DashboardWithViewProperties', # noqa: E501
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
Expand Down
19 changes: 19 additions & 0 deletions tests/test_Dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,22 @@ def test_create_dashboard_with_cell(self):
self.assertIsNotNone(cell.id)
view = cells_service.get_dashboards_id_cells_id_view(dashboard_id=dashboard.id, cell_id=cell.id)
self.assertEqual(view.name, f"Cell_{unique_id}_IT")

def test_get_dashboard_with_cell_with_properties(self):
unique_id = str(datetime.datetime.now().timestamp())

dashboard = self.dashboards_service.post_dashboards(
create_dashboard_request=CreateDashboardRequest(org_id=self.find_my_org().id,
name=f"Dashboard_{unique_id}_IT"))

# create cell
CellsService(self.client.api_client).post_dashboards_id_cells(
dashboard_id=dashboard.id, create_cell=CreateCell(name=f"Cell_{unique_id}_IT", h=3, w=12))

# retrieve dashboard
dashboard = self.dashboards_service.get_dashboards_id(dashboard.id)

from influxdb_client import DashboardWithViewProperties, CellWithViewProperties
self.assertEqual(DashboardWithViewProperties, type(dashboard))
self.assertEqual(1, len(dashboard.cells))
self.assertEqual(CellWithViewProperties, type(dashboard.cells[0]))

0 comments on commit 4a16049

Please sign in to comment.