Skip to content

Commit

Permalink
Add a test for the matcher function
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Jul 26, 2024
1 parent 0f27cb6 commit 0d75874
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/test_intermediary.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,5 +362,20 @@ def test_from_pagure_pr_reopen(self,
mock_datetime.fromtimestamp.assert_called_with(float(1234))
mock_matcher.assert_called_with(self.mock_pagure_pr['initial_comment'], formatted_comments)

def test_matcher(self):
""" This tests the matcher function """
# Positive case
content = "Relates to JIRA: XYZ-5678"
comments = [{"body": "Relates to JIRA: ABC-1234"}]
expected = True
actual = bool(i.matcher(content, comments))
assert expected == actual

# TODO: Add new tests from PR
# Negative case
content = "No JIRAs here..."
comments = [{"body": "... nor here"}]
expected = False
actual = bool(i.matcher(content, comments))
assert expected == actual

# TODO: Add new tests from PR

0 comments on commit 0d75874

Please sign in to comment.