forked from indymedia/epicyon
Test that css is not dangerous
parent
f94f6eb997
commit
121a24d432
13
tests.py
13
tests.py
|
@ -75,6 +75,7 @@ from inbox import guessHashtagCategory
|
||||||
from content import htmlReplaceEmailQuote
|
from content import htmlReplaceEmailQuote
|
||||||
from content import htmlReplaceQuoteMarks
|
from content import htmlReplaceQuoteMarks
|
||||||
from content import dangerousMarkup
|
from content import dangerousMarkup
|
||||||
|
from content import dangerousCSS
|
||||||
from content import addWebLinks
|
from content import addWebLinks
|
||||||
from content import replaceEmojiFromTags
|
from content import replaceEmojiFromTags
|
||||||
from content import addHtmlTags
|
from content import addHtmlTags
|
||||||
|
@ -1984,6 +1985,17 @@ def testRemoveHtml():
|
||||||
assert(removeHtml(testStr) == 'This string has html.')
|
assert(removeHtml(testStr) == 'This string has html.')
|
||||||
|
|
||||||
|
|
||||||
|
def testDangerousCSS():
|
||||||
|
print('testDangerousCSS')
|
||||||
|
baseDir = os.getcwd()
|
||||||
|
for subdir, dirs, files in os.walk(baseDir):
|
||||||
|
for f in files:
|
||||||
|
if not f.endswith('.css'):
|
||||||
|
continue
|
||||||
|
assert not dangerousCSS(baseDir + '/' + f, False)
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
def testDangerousMarkup():
|
def testDangerousMarkup():
|
||||||
print('testDangerousMarkup')
|
print('testDangerousMarkup')
|
||||||
allowLocalNetworkAccess = False
|
allowLocalNetworkAccess = False
|
||||||
|
@ -2483,6 +2495,7 @@ def runAllTests():
|
||||||
testRemoveIdEnding()
|
testRemoveIdEnding()
|
||||||
testJsonPostAllowsComments()
|
testJsonPostAllowsComments()
|
||||||
runHtmlReplaceQuoteMarks()
|
runHtmlReplaceQuoteMarks()
|
||||||
|
testDangerousCSS()
|
||||||
testDangerousMarkup()
|
testDangerousMarkup()
|
||||||
testRemoveHtml()
|
testRemoveHtml()
|
||||||
testSiteIsActive()
|
testSiteIsActive()
|
||||||
|
|
Loading…
Reference in New Issue