bugdown tests: Pass message stub to bugdown_convert().

This makes the calling sequence slightly more
realistic (without any additional overhead).
This commit is contained in:
Steve Howell 2019-01-29 20:05:16 +00:00 committed by Tim Abbott
parent 8d404dbcc6
commit 643d4cacd3
1 changed files with 13 additions and 3 deletions

View File

@ -51,7 +51,10 @@ import os
import ujson import ujson
import urllib 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): class FencedBlockPreprocessorTest(TestCase):
def test_simple_quoting(self) -> None: def test_simple_quoting(self) -> None:
@ -166,8 +169,15 @@ class FencedBlockPreprocessorTest(TestCase):
lines = processor.run(markdown) lines = processor.run(markdown)
self.assertEqual(lines, expected) self.assertEqual(lines, expected)
def bugdown_convert(text: str) -> str: def bugdown_convert(content: str) -> str:
return bugdown.convert(text, message_realm=get_realm('zulip')) 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): class BugdownMiscTest(ZulipTestCase):
def test_diffs_work_as_expected(self) -> None: def test_diffs_work_as_expected(self) -> None: