diff --git a/zerver/tests/test_bugdown.py b/zerver/tests/test_bugdown.py index bc533723bd..34d7b38b68 100644 --- a/zerver/tests/test_bugdown.py +++ b/zerver/tests/test_bugdown.py @@ -51,7 +51,10 @@ import os import ujson import urllib -from typing import Any, AnyStr, Dict, List, Optional, Set, Tuple +from typing import cast, Any, AnyStr, Dict, List, Optional, Set, Tuple + +class FakeMessage: + pass class FencedBlockPreprocessorTest(TestCase): def test_simple_quoting(self) -> None: @@ -166,8 +169,15 @@ class FencedBlockPreprocessorTest(TestCase): lines = processor.run(markdown) self.assertEqual(lines, expected) -def bugdown_convert(text: str) -> str: - return bugdown.convert(text, message_realm=get_realm('zulip')) +def bugdown_convert(content: str) -> str: + message = cast(Message, FakeMessage()) + message.content = content + message.id = 999 + return bugdown.convert( + content=content, + message_realm=get_realm('zulip'), + message=message, + ) class BugdownMiscTest(ZulipTestCase): def test_diffs_work_as_expected(self) -> None: