mirror of https://github.com/zulip/zulip.git
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:
parent
8d404dbcc6
commit
643d4cacd3
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue