-
Notifications
You must be signed in to change notification settings - Fork 186
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #321 +/- ##
=======================================
Coverage 92.53% 92.53%
=======================================
Files 27 27
Lines 2211 2211
=======================================
Hits 2046 2046
Misses 165 165 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR 👍. There are a few requirements that should be satisfy before we accept the PR:
- Please update
CHANGELOG.md
- Please add test for your changes into test_Dashboards.py. Something like following code will be pretty fine:
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]))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Closes #
Proposed Changes
Briefly describe your proposed changes:
I have only updated the return type for the
GET
operation on the dashboard service. When the parameterinclude=properties
is passed to the methods, even though the correct API calls are made, the returned object does not include cell properties.To fix the issue,
DashboardWithViewProperties
is returned instead ofDashboard
. Using this withoutinclude
returnsNone
for cell properties thereby keeping the original code intact.Checklist
pytest tests
completes successfully