@@ -32,12 +32,15 @@ def test_form(self):
32
32
"living" : "false" , # enable/disable live updates in preview
33
33
"spellcheck" : "false" , # enable/disable spellcheck in form textareas # noqa: E501
34
34
"hljs" : "true" , # enable/disable hljs highlighting in preview
35
- }
35
+ },
36
+ MARTOR_MARKDOWN_BASE_EMOJI_URL = "https://github.githubassets.com/images/icons/emoji/" ,
37
+ MARTOR_MARKDOWN_BASE_MENTION_URL = "https://python.web.id/author/" ,
36
38
)
37
39
def test_markdownify (self ):
38
40
# Heading
39
41
response = self .client .post (
40
- "/martor/markdownify/" , {"content" : "# Hello world!" }
42
+ "/martor/markdownify/" ,
43
+ {"content" : "# Hello world!" },
41
44
)
42
45
self .assertEqual (response .status_code , 200 )
43
46
self .assertEqual (
@@ -66,15 +69,26 @@ def test_markdownify(self):
66
69
'<p><img alt="image" src="https://imgur.com/test.png"></p>' ,
67
70
) # noqa: E501
68
71
72
+ # Emoji
73
+ response = self .client .post (
74
+ "/martor/markdownify/" ,
75
+ {"content" : ":heart:" },
76
+ )
77
+ self .assertEqual (response .status_code , 200 )
78
+ self .assertEqual (
79
+ response .content .decode ("utf-8" ),
80
+ '<p><img class="marked-emoji" src="https://github.githubassets.com/images/icons/emoji/heart.png"></p>' ,
81
+ ) # noqa: E501
82
+
69
83
# # Mention
70
84
# response = self.client.post(
71
- # ' /martor/markdownify/' ,
72
- # {' content' : f' @[{self.user.username}]'}
85
+ # " /martor/markdownify/" ,
86
+ # {" content" : f" @[{self.user.username}]"},
73
87
# )
74
88
# self.assertEqual(response.status_code, 200)
75
89
# self.assertEqual(
76
- # response.content.decode(' utf-8' ),
77
- # '...fixme'
90
+ # response.content.decode(" utf-8" ),
91
+ # f'<p><a class="direct-mention-link" href="https://python.web.id/author/{self.user.username}/">{self.user.username}</a></p>',
78
92
# )
79
93
80
94
def test_markdownify_xss_handled (self ):
0 commit comments