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

feat(asana-integration):default description and name #75546

Closed
Closed
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
2 changes: 2 additions & 0 deletions src/sentry_plugins/asana/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ def get_new_issue_fields(self, request: Request, group, event, **kwargs):
for field in fields:
if field["name"] == "title":
field["label"] = "Name"
field["default"] = "issue.name"
if field["name"] == "description":
field["label"] = "Notes"
field["required"] = False
field["default"] = "issue.description"

return [
{
Expand Down
49 changes: 49 additions & 0 deletions tests/sentry_plugins/asana/test_plugin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from functools import cached_property
from unittest.mock import patch

import orjson
import pytest
Expand Down Expand Up @@ -89,6 +90,54 @@ def test_view_create_no_auth(self):
# Asana redirect_urls are set to the root domain.
assert "http://testserver" in response.data["auth_url"]

@responses.activate
@patch(
"sentry.plugins.bases.issue2.IssueTrackingPlugin2.check_config_and_auth", return_value=None
)
def test_view_create_with_auth(self, mock_check_auth):
responses.add(
responses.POST,
"https://app.asana.com/api/1.0/tasks",
json={"data": {"name": "Hello world!", "notes": "Fix this.", "gid": 1}},
)

responses.add(
responses.GET,
"https://app.asana.com/api/1.0/workspaces",
json={"data": [{"gid": "12345678", "name": "workspace"}]},
)

self.plugin.set_option("workspace", "12345678", self.project)
event = self.store_event(
data={"message": "Hello world", "culprit": "foo.bar"}, project_id=self.project.id
)
group = event.group
assert group

self.login_as(self.user)
self.create_usersocialauth(
user=self.user, provider=self.plugin.auth_provider, extra_data={"access_token": "foo"}
)

request = self.request.get("/")
request.user = self.user
response = self.plugin.view_create(request, group)
assert response.status_code == 200

assert {
"name": "title",
"label": "Name",
"default": "issue.name",
"type": "text",
} in response.data
assert {
"name": "description",
"label": "Notes",
"default": "issue.description",
"type": "textarea",
"required": False,
} in response.data

@responses.activate
def test_link_issue(self):
responses.add(
Expand Down
Loading