forked from indymedia/epicyon
Check a few emoji cases
parent
53906b3e66
commit
a7b0634d1e
15
tests.py
15
tests.py
|
@ -1352,9 +1352,8 @@ def testWebLinks():
|
||||||
assert resultText=='<p>ABCABCABCABCABCABCABCABCABCABCABCABCABCA<\p>'
|
assert resultText=='<p>ABCABCABCABCABCABCABCABCABCABCABCABCABCA<\p>'
|
||||||
|
|
||||||
|
|
||||||
def testAddEmoji():
|
def testAddEmoji(content: str,emojiStr:str):
|
||||||
print('testAddEmoji')
|
print('testAddEmoji: '+emojiStr)
|
||||||
content='Emoji :lemon: :strawberry: :banana:'
|
|
||||||
httpPrefix='http'
|
httpPrefix='http'
|
||||||
nickname='testuser'
|
nickname='testuser'
|
||||||
domain='testdomain.net'
|
domain='testdomain.net'
|
||||||
|
@ -1383,14 +1382,16 @@ def testAddEmoji():
|
||||||
addHtmlTags(baseDir,httpPrefix, \
|
addHtmlTags(baseDir,httpPrefix, \
|
||||||
nickname,domain,content, \
|
nickname,domain,content, \
|
||||||
recipients,hashtags,True)
|
recipients,hashtags,True)
|
||||||
assert ':lemon:' in contentModified
|
assert ':'+emojiStr+':' in contentModified
|
||||||
|
assert contentModified.startswith('<p>')
|
||||||
|
assert contentModified.endswith('</p>')
|
||||||
tags=[]
|
tags=[]
|
||||||
for tagName,tag in hashtags.items():
|
for tagName,tag in hashtags.items():
|
||||||
tags.append(tag)
|
tags.append(tag)
|
||||||
content=contentModified
|
content=contentModified
|
||||||
contentModified=replaceEmojiFromTags(content,tags,'content')
|
contentModified=replaceEmojiFromTags(content,tags,'content')
|
||||||
assert 'img src' in contentModified
|
assert 'img src' in contentModified
|
||||||
assert ':lemon:' not in contentModified
|
assert ':'+emojiStr+':' not in contentModified
|
||||||
|
|
||||||
os.chdir(baseDirOriginal)
|
os.chdir(baseDirOriginal)
|
||||||
shutil.rmtree(baseDirOriginal+'/.tests')
|
shutil.rmtree(baseDirOriginal+'/.tests')
|
||||||
|
@ -1472,7 +1473,9 @@ def runAllTests():
|
||||||
testSaveLoadJson()
|
testSaveLoadJson()
|
||||||
testCommentJson()
|
testCommentJson()
|
||||||
testGetStatusNumber()
|
testGetStatusNumber()
|
||||||
testAddEmoji()
|
testAddEmoji("Emoji :lemon: :strawberry: :banana:","lemon")
|
||||||
|
testAddEmoji("Emoji :lemon: :strawberry: :banana:","banana")
|
||||||
|
testAddEmoji("G'day world :worldmap:","worldmap")
|
||||||
testActorParsing()
|
testActorParsing()
|
||||||
testHttpsig()
|
testHttpsig()
|
||||||
testCache()
|
testCache()
|
||||||
|
|
Loading…
Reference in New Issue