diff --git a/CHANGELOG.md b/CHANGELOG.md index b85e72fb..895d2643 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] diff --git a/influxdb_client/service/dashboards_service.py b/influxdb_client/service/dashboards_service.py index e55686c4..04ce379a 100644 --- a/influxdb_client/service/dashboards_service.py +++ b/influxdb_client/service/dashboards_service.py @@ -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 @@ -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 @@ -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 diff --git a/tests/test_Dashboards.py b/tests/test_Dashboards.py index 37dca721..dd578b08 100644 --- a/tests/test_Dashboards.py +++ b/tests/test_Dashboards.py @@ -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]))