Skip to content

Commit

Permalink
Merge pull request #6 from melexis/fix_jql_query
Browse files Browse the repository at this point in the history
Fix JQL query with a special character
  • Loading branch information
Letme authored Apr 12, 2021
2 parents fbb4a75 + 94c8b83 commit beab20d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mlx/jira_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,5 @@ def escape_special_characters(input_string):
prepared_string = input_string
for special_char in ("\\", "+", "-", "&", "|", "!", "(", ")", "{", "}", "[", "]", "^", "~", "*", "?", ":"):
if special_char in prepared_string:
prepared_string = prepared_string.replace(special_char, "\\" + special_char)
prepared_string = prepared_string.replace(special_char, r"\\" + special_char)
return prepared_string
5 changes: 3 additions & 2 deletions tests/test_jira_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ def test_create_jira_issues_unique(self, jira):
basic_auth=('my_username', 'my_password')))
self.assertEqual(jira_mock.search_issues.call_args_list,
[
mock.call("project=MLX12345 and summary ~ 'MEETING\\-12345_2\\: Caption for action 1\\?'"),
mock.call(
"project=MLX12345 and summary ~ 'MEETING\\\\-12345_2\\\\: Caption for action 1\\\\?'"),
mock.call("project=MLX12345 and summary ~ 'Caption for action 2'"),
])

Expand Down Expand Up @@ -323,7 +324,7 @@ def test_tuple_for_relationship_to_parent(self, jira):
self.assertEqual(jira_mock.search_issues.call_args_list,
[
mock.call("project=MLX12345 and summary ~ "
"'ZZZ\\-TO_BE_PRIORITIZED\\: Caption for action 1\\?'"),
"'ZZZ\\\\-TO_BE_PRIORITIZED\\\\: Caption for action 1\\\\?'"),
mock.call("project=MLX12345 and summary ~ 'Caption for action 2'"),
])

Expand Down

0 comments on commit beab20d

Please sign in to comment.