From 0499511f6109d5d0cf137a99ab73048f45610d1e Mon Sep 17 00:00:00 2001 From: Bryan Burgers Date: Fri, 12 Jul 2019 13:26:14 -0500 Subject: [PATCH] Add test to ensure @bors only responds to itself Test that we only respond when a command is issued to `@bors`, and not to `@bors-servo` or any other `@bors{something}` bot. This came up because a comment on `rust-lang/rust` referenced `@bors-servo` instead of `@bors` and was still approved successfully. The command-parsing changes apparently already fixed this, but add a test to prevent regressions. --- homu/tests/test_parse_issue_comment.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/homu/tests/test_parse_issue_comment.py b/homu/tests/test_parse_issue_comment.py index e7da8ef..fe14f89 100644 --- a/homu/tests/test_parse_issue_comment.py +++ b/homu/tests/test_parse_issue_comment.py @@ -497,6 +497,20 @@ def test_multiple_hooks(): assert thirdhook_commands[0].hook_extra is None +def test_similar_name(): + """ + Test that a username that starts with 'bors' doesn't trigger. + """ + + author = "jack" + body = """ + @bors-servo r+ + """ + commands = parse_issue_comment(author, body, commit, "bors") + + assert len(commands) == 0 + + def test_parse_up_to_first_unknown_word(): """ Test that when parsing, once we arrive at an unknown word, we stop parsing