mirror of https://gitlab.com/bashrc2/epicyon
Add ftp as a supported link type
parent
db7043dfd2
commit
2bbdbe9774
27
tests.py
27
tests.py
|
@ -2978,9 +2978,36 @@ def testFunctions():
|
||||||
'-Gsep=+120 -Tx11 epicyon.dot')
|
'-Gsep=+120 -Tx11 epicyon.dot')
|
||||||
|
|
||||||
|
|
||||||
|
def testLinksWithinPost() -> None:
|
||||||
|
baseDir = os.getcwd()
|
||||||
|
nickname = 'test27636'
|
||||||
|
domain = 'rando.site'
|
||||||
|
port = 443
|
||||||
|
httpPrefix = 'https'
|
||||||
|
content = 'This is a test post with links.\n\n' + \
|
||||||
|
'ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/v4/\n\nhttps://freedombone.net'
|
||||||
|
postJsonObject = \
|
||||||
|
createPublicPost(baseDir, nickname, domain, port, httpPrefix,
|
||||||
|
content,
|
||||||
|
False, False, False, True,
|
||||||
|
None, None, False, None)
|
||||||
|
assert postJsonObject['object']['content'] == \
|
||||||
|
'<p>This is a test post with links.<br><br>' + \
|
||||||
|
'<a href="ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/v4/" ' + \
|
||||||
|
'rel="nofollow noopener noreferrer" target="_blank">' + \
|
||||||
|
'<span class="invisible">ftp://</span>' + \
|
||||||
|
'<span class="ellipsis">' + \
|
||||||
|
'ftp.ncdc.noaa.gov/pub/data/ghcn/v4/</span>' + \
|
||||||
|
'</a><br><br><a href="https://freedombone.net" ' + \
|
||||||
|
'rel="nofollow noopener noreferrer" target="_blank">' + \
|
||||||
|
'<span class="invisible">https://</span>' + \
|
||||||
|
'<span class="ellipsis">freedombone.net</span></a></p>'
|
||||||
|
|
||||||
|
|
||||||
def runAllTests():
|
def runAllTests():
|
||||||
print('Running tests...')
|
print('Running tests...')
|
||||||
testFunctions()
|
testFunctions()
|
||||||
|
testLinksWithinPost()
|
||||||
testReplyToPublicPost()
|
testReplyToPublicPost()
|
||||||
testGetMentionedPeople()
|
testGetMentionedPeople()
|
||||||
testGuessHashtagCategory()
|
testGuessHashtagCategory()
|
||||||
|
|
6
utils.py
6
utils.py
|
@ -328,14 +328,16 @@ def removeIdEnding(idStr: str) -> str:
|
||||||
def getProtocolPrefixes() -> []:
|
def getProtocolPrefixes() -> []:
|
||||||
"""Returns a list of valid prefixes
|
"""Returns a list of valid prefixes
|
||||||
"""
|
"""
|
||||||
return ('https://', 'http://', 'dat://', 'i2p://', 'gnunet://',
|
return ('https://', 'http://', 'ftp://',
|
||||||
|
'dat://', 'i2p://', 'gnunet://',
|
||||||
'hyper://', 'gemini://', 'gopher://')
|
'hyper://', 'gemini://', 'gopher://')
|
||||||
|
|
||||||
|
|
||||||
def getLinkPrefixes() -> []:
|
def getLinkPrefixes() -> []:
|
||||||
"""Returns a list of valid web link prefixes
|
"""Returns a list of valid web link prefixes
|
||||||
"""
|
"""
|
||||||
return ('https://', 'http://', 'dat://', 'i2p://', 'gnunet://',
|
return ('https://', 'http://', 'ftp://',
|
||||||
|
'dat://', 'i2p://', 'gnunet://',
|
||||||
'hyper://', 'gemini://', 'gopher://', 'briar:')
|
'hyper://', 'gemini://', 'gopher://', 'briar:')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue