test that <somebody> is only stripped when from the bridge user itself

This commit is contained in:
Brian S. Stephan 2023-02-19 21:00:12 -06:00
parent cfeddfdc4e
commit 88ea0dbbb4
Signed by: bss
GPG Key ID: 3DE06D3180895FCB
1 changed files with 17 additions and 0 deletions

View File

@ -73,6 +73,23 @@ class MarkovTestCase(TestCase):
self.assertEqual(mock_learn_line.call_args.args[0], 'hello this is a test message') self.assertEqual(mock_learn_line.call_args.args[0], 'hello this is a test message')
def test_learn_bridge_no_edit(self):
"""Test that if a message is from the bridge, we learn what looks like a speaker's nick.
This is primarily for if someone on IRC is pasting a log --- the "<somebody> whatever" should
be retained in full, rather than learned as "whatever".
"""
mock_event = mock.MagicMock()
mock_event.arguments = ['<tester> hello this is a test message']
mock_event.target = '#test'
mock_event.recursing = False
mock_event.source = 'not-bridge!not-bridge@localhost'
with mock.patch('markov.lib.learn_line') as mock_learn_line:
self.plugin.handle_chatter(self.mock_connection, mock_event)
self.assertEqual(mock_learn_line.call_args.args[0], '<tester> hello this is a test message')
def test_learn_bridge_and_self_edit(self): def test_learn_bridge_and_self_edit(self):
"""Test that we don't learn our own name when learning something addressed to us, discord style.""" """Test that we don't learn our own name when learning something addressed to us, discord style."""
mock_event = mock.MagicMock() mock_event = mock.MagicMock()