Skip to content

Commit

Permalink
ensure None is handled correctly in search_issues() (#1434)
Browse files Browse the repository at this point in the history
  • Loading branch information
adehad committed Jul 26, 2022
1 parent 313ba9a commit 49fe68c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions jira/client.py
Expand Up @@ -2930,6 +2930,8 @@ def search_issues(
"""
if isinstance(fields, str):
fields = fields.split(",")
elif fields is None:
fields = ["*all"]

# this will translate JQL field names to REST API Name
# most people do know the JQL names so this will help them use the API easier
Expand Down
9 changes: 8 additions & 1 deletion tests/resources/test_issue.py
Expand Up @@ -37,10 +37,17 @@ def test_issue_search_only_includes_provided_fields(self):
self.assertFalse(hasattr(issues[0].fields, "reporter"))

def test_issue_search_default_behaviour_included_fields(self):
issues = self.jira.search_issues("key=%s" % self.issue_1)
search_str = f"key={self.issue_1}"
issues = self.jira.search_issues(search_str)
self.assertTrue(hasattr(issues[0].fields, "reporter"))
self.assertTrue(hasattr(issues[0].fields, "comment"))

# fields=None should be valid and return all fields (ie. default behavior)
self.assertEqual(
self.jira.search_issues(search_str),
self.jira.search_issues(search_str, fields=None),
)

def test_issue_get_field(self):
issue = self.jira.issue(self.issue_1)
self.assertEqual(
Expand Down

0 comments on commit 49fe68c

Please sign in to comment.