Anpassungen des Codes an Django 1.11 mit Python 3

Grapelli wurde entfernt, das neue Django Admin ist hübsch genug.
This commit is contained in:
2017-05-10 10:15:39 +02:00
parent 5437b7b8de
commit 321531c160
25 changed files with 219 additions and 121 deletions

46
src/utils/tests.py Normal file
View File

@@ -0,0 +1,46 @@
import unittest
import html_cleaner
class HtmlTestCase(unittest.TestCase):
known_html = (
('<STRONG>Fett!</STRONG>', '<strong>Fett!</strong>'),
('<a href="link.html" onclick="do_evil()">Bad Link</a>', '<a href="link.html">Bad Link</a>'),
('''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4919.2200" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hey Brad;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2> 1) From your FAQ page at Webalizer.com the README
file link in question 19 to <A
href="ftp://ftp.mrunix.net/pub/webalizer/README">ftp://ftp.mrunix.net/pub/webalizer/README</A>&nbsp;brings
a 404 Page Not Found error message.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2> 2) </FONT><FONT face=Arial size=2>My host recently
added Webalizer and I am trying to find the best way to keep the program running
correctly and to deny outsiders the ability to look at it. I would prefer not to
give others access to my stats.&nbsp; I do web design and at any given time have
client demos in various stages of completion and other things I'd prefer not to
have the general public see popping up in my stats.&nbsp; Does Webalizer have a
password protection mode or anything?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>XXXXXX XXXXXXX<BR>XXXXXXXXX Web Design<BR><A
href="http://www.xxxxxxxxxxxx.com">http://www.xxxxxxxxxxxx.com</A><BR>(xxx)
xxx-xxxx</FONT></DIV></BODY></HTML>
''',
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">'
)
)
def test_html_cleaner(self):
"""Ugly HTML Code has been made tidy"""
cleaner = html_cleaner.HtmlCleaner()
for original, tidy in self.known_html:
self.assertEqual(cleaner.clean_html(original), tidy)
if __name__ == '__main__':
unittest.main()