Fix memoir image delivery and Android rendering
This commit is contained in:
@@ -66,3 +66,23 @@ class MemoirImageBootstrapTest(unittest.TestCase):
|
||||
self.assertEqual(assets[0]["url"], "https://cos.example.com/existing.png")
|
||||
self.assertEqual(assets[1]["status"], "pending")
|
||||
self.assertEqual(assets[1]["description"], "奶奶坐在院子里的藤椅上")
|
||||
|
||||
def test_initialize_chapter_images_accepts_double_brace_placeholders(self):
|
||||
chapter = type(
|
||||
"ChapterStub",
|
||||
(),
|
||||
{
|
||||
"id": "chapter-1",
|
||||
"title": "童年的夏天",
|
||||
"category": "childhood",
|
||||
"content": "开头。\n\n{{IMAGE:1938年初的上海弄堂口,冬日萧瑟}}\n\n结尾。",
|
||||
"images": [],
|
||||
},
|
||||
)()
|
||||
|
||||
with unittest.mock.patch.dict(os.environ, {"MEMOIR_IMAGE_ENABLED": "true"}, clear=False):
|
||||
assets = initialize_chapter_images(chapter)
|
||||
|
||||
self.assertEqual(len(assets), 1)
|
||||
self.assertEqual(assets[0]["status"], "pending")
|
||||
self.assertEqual(assets[0]["placeholder"], "{{IMAGE:1938年初的上海弄堂口,冬日萧瑟}}")
|
||||
|
||||
Reference in New Issue
Block a user