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

ISSUE-1836: Add Dashboard Support #1837

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
ISSUE #1836: Address PR Feedback
* Make method name align with parameters/ui
  • Loading branch information
jpavlav committed Mar 17, 2024
commit cc3f41235898e3c21f844a291725b4727ced3329
6 changes: 4 additions & 2 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ def copy_dashboard(

@cloud
@experimental
def update_dashboard_automatic_refresh_seconds(
def update_dashboard_automatic_refresh_minutes(
self, id: str, minutes: int
jpavlav marked this conversation as resolved.
Show resolved Hide resolved
) -> Response:
# NOTE(jpavlav): The payload expects milliseconds, we are doing a conversion
Expand Down Expand Up @@ -1638,7 +1638,9 @@ def group_members(self, group: str) -> OrderedDict:
(
user["id"]
if hasId
else user.get("name") if hasName else user.get("accountId")
else user.get("name")
if hasName
else user.get("accountId")
)
] = {
"name": user.get("name"),
Expand Down
12 changes: 6 additions & 6 deletions jira/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,9 @@ def update( # type: ignore[override] # incompatible supertype ignored
Resource
"""
options = self._options.copy()
options["path"] = (
f"dashboard/{dashboard_id}/items/{item_id}/properties/{self.key}"
)
options[
"path"
] = f"dashboard/{dashboard_id}/items/{item_id}/properties/{self.key}"
self.raw["value"].update(value)
self._session.put(self.JIRA_BASE_URL.format(**options), self.raw["value"])

Expand All @@ -628,9 +628,9 @@ def delete(self, dashboard_id: str, item_id: str) -> Response: # type: ignore[o
Response
"""
options = self._options.copy()
options["path"] = (
f"dashboard/{dashboard_id}/items/{item_id}/properties/{self.key}"
)
options[
"path"
] = f"dashboard/{dashboard_id}/items/{item_id}/properties/{self.key}"

return self._session.delete(self.JIRA_BASE_URL.format(**options))

Expand Down
6 changes: 3 additions & 3 deletions tests/resources/test_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,16 @@ def test_dashboard_gadgets(self):
reason="Functionality only available on Jira Cloud",
)
@allow_on_cloud
def test_update_dashboard_automatic_refresh_seconds(self):
def test_update_dashboard_automatic_refresh_minutes(self):
dashboard = self.jira.create_dashboard(
name=rndstr(), share_permissions=[{"type": "authenticated"}]
)
self.dashboards_to_delete.append(dashboard)
response = self.jira.update_dashboard_automatic_refresh_seconds(
response = self.jira.update_dashboard_automatic_refresh_minutes(
dashboard.id, 10
)
self.assertEqual(response.status_code, 204)
response = self.jira.update_dashboard_automatic_refresh_seconds(dashboard.id, 0)
response = self.jira.update_dashboard_automatic_refresh_minutes(dashboard.id, 0)
self.assertEqual(response.status_code, 204)

@pytest.mark.skipif(
Expand Down