Skip to content

Commit 49fe68c

Browse files
authored
ensure None is handled correctly in search_issues() (#1434)
1 parent 313ba9a commit 49fe68c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

jira/client.py

+2
Original file line numberDiff line numberDiff line change
@@ -2930,6 +2930,8 @@ def search_issues(
29302930
"""
29312931
if isinstance(fields, str):
29322932
fields = fields.split(",")
2933+
elif fields is None:
2934+
fields = ["*all"]
29332935

29342936
# this will translate JQL field names to REST API Name
29352937
# most people do know the JQL names so this will help them use the API easier

tests/resources/test_issue.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,17 @@ def test_issue_search_only_includes_provided_fields(self):
3737
self.assertFalse(hasattr(issues[0].fields, "reporter"))
3838

3939
def test_issue_search_default_behaviour_included_fields(self):
40-
issues = self.jira.search_issues("key=%s" % self.issue_1)
40+
search_str = f"key={self.issue_1}"
41+
issues = self.jira.search_issues(search_str)
4142
self.assertTrue(hasattr(issues[0].fields, "reporter"))
4243
self.assertTrue(hasattr(issues[0].fields, "comment"))
4344

45+
# fields=None should be valid and return all fields (ie. default behavior)
46+
self.assertEqual(
47+
self.jira.search_issues(search_str),
48+
self.jira.search_issues(search_str, fields=None),
49+
)
50+
4451
def test_issue_get_field(self):
4552
issue = self.jira.issue(self.issue_1)
4653
self.assertEqual(

0 commit comments

Comments
 (0)