Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return type for dashboard when include is used #321

Merged
merged 7 commits into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]))