Skip to content
Open
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
5 changes: 4 additions & 1 deletion src/sentry/integrations/jira_server/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ def search_issues(self, query):
else:
q = query.replace('"', '\\"')
jql = f'text ~ "{q}"'
return self.get(self.SEARCH_URL, params={"jql": jql})
return self.get(
self.SEARCH_URL,
params={"jql": jql, "startAt": 0, "maxResults": 20, "fields": "summary"},
)

def create_comment(self, issue_key, comment):
return self.post(self.COMMENTS_URL % issue_key, data={"body": comment})
Expand Down
22 changes: 20 additions & 2 deletions tests/sentry/integrations/jira_server/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,16 @@ def test_search_issues_with_pasted_issue_url(self) -> None:
responses.add(
method=responses.GET,
url="https://jira.example.com/rest/api/2/search/",
match=[query_param_matcher({"jql": 'id="ABC-123"'})],
match=[
query_param_matcher(
{
"jql": 'id="ABC-123"',
"startAt": 0,
"maxResults": 20,
"fields": "summary",
}
)
],
body=json.dumps(body),
status=200,
content_type="application/json",
Expand All @@ -83,7 +92,16 @@ def test_search_issues_with_free_text(self) -> None:
responses.add(
method=responses.GET,
url="https://jira.example.com/rest/api/2/search/",
match=[query_param_matcher({"jql": 'text ~ "login crash"'})],
match=[
query_param_matcher(
{
"jql": 'text ~ "login crash"',
"startAt": 0,
"maxResults": 20,
"fields": "summary",
}
)
],
body=json.dumps(body),
status=200,
content_type="application/json",
Expand Down
37 changes: 34 additions & 3 deletions tests/sentry/integrations/jira_server/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import responses
from django.urls import reverse
from responses.matchers import query_param_matcher

from sentry.testutils.cases import APITestCase
from sentry.testutils.silo import control_silo_test
Expand All @@ -22,7 +23,17 @@ def test_get_success_text_search(self) -> None:
integration = self.integration
responses.add(
responses.GET,
'https://jira.example.org/rest/api/2/search/?jql=text ~ "test"',
"https://jira.example.org/rest/api/2/search/",
match=[
query_param_matcher(
{
"jql": 'text ~ "test"',
"startAt": 0,
"maxResults": 20,
"fields": "summary",
}
)
],
body=EXAMPLE_ISSUE_SEARCH,
content_type="json",
)
Expand All @@ -40,7 +51,17 @@ def test_get_success_id_search(self) -> None:
integration = self.integration
responses.add(
responses.GET,
'https://jira.example.org/rest/api/2/search/?jql=id="HSP-1"',
"https://jira.example.org/rest/api/2/search/",
match=[
query_param_matcher(
{
"jql": 'id="HSP-1"',
"startAt": 0,
"maxResults": 20,
"fields": "summary",
}
)
],
body=EXAMPLE_ISSUE_SEARCH,
content_type="json",
)
Expand All @@ -58,7 +79,17 @@ def test_get_network_error(self) -> None:
integration = self.integration
responses.add(
responses.GET,
'https://jira.example.org/rest/api/2/search/?jql=id="HSP-1"',
"https://jira.example.org/rest/api/2/search/",
match=[
query_param_matcher(
{
"jql": 'id="HSP-1"',
"startAt": 0,
"maxResults": 20,
"fields": "summary",
}
)
],
status=502,
body="<p>We are down</p>",
)
Expand Down
Loading