Use message agent value instead of checking for the latest comment
The latest comment seems to be unreliable. We should use agent itself, this will skip all the messages that were generated by toddler itself. Signed-off-by: Michal Konečný <mkonecny@redhat.com>
This commit is contained in:
parent
d23aa93424
commit
19f48a0b52
2 changed files with 16 additions and 16 deletions
|
@ -100,9 +100,9 @@ class TestProcess:
|
|||
caplog.records[-1].message == "The issue 100 is not open. Skipping message."
|
||||
)
|
||||
|
||||
def test_process_comment_already_added(self, caplog, toddler):
|
||||
def test_process_change_done_by_toddler(self, caplog, toddler):
|
||||
"""
|
||||
Assert that toddler will ignore comments that were already commented on by it.
|
||||
Assert that toddler will ignore messages that were emitted by it.
|
||||
"""
|
||||
caplog.set_level(logging.INFO)
|
||||
|
||||
|
@ -112,7 +112,8 @@ class TestProcess:
|
|||
msg = IssueCommentAddedV1()
|
||||
msg.body = {
|
||||
"project": {"fullname": scm_request_processor.PROJECT_NAMESPACE},
|
||||
"issue": {"status": "Open", "comments": [{"user": {"name": pagure_user}}]},
|
||||
"issue": {"status": "Open"},
|
||||
"agent": pagure_user,
|
||||
}
|
||||
|
||||
with patch(
|
||||
|
@ -124,7 +125,7 @@ class TestProcess:
|
|||
|
||||
assert caplog.records[
|
||||
-1
|
||||
].message == "Last comment is from {0}. Ignoring the message.".format(
|
||||
].message == "Last change on the ticket was done by {0}. Ignoring the message.".format(
|
||||
pagure_user
|
||||
)
|
||||
|
||||
|
@ -142,6 +143,7 @@ class TestProcess:
|
|||
msg.body = {
|
||||
"project": {"fullname": scm_request_processor.PROJECT_NAMESPACE},
|
||||
"issue": issue,
|
||||
"agent": "agent",
|
||||
}
|
||||
config = {
|
||||
"branch_slas": {},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue