Test that css is not dangerous

alt-html-css
Bob Mottram 2020-12-13 14:48:45 +00:00
parent f94f6eb997
commit 121a24d432
1 changed files with 13 additions and 0 deletions

View File

@ -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()