From 743d92700c70c282c83209b14168d59a835ea9b6 Mon Sep 17 00:00:00 2001 From: mutantmonkey Date: Sat, 2 Jun 2012 00:31:02 -0700 Subject: [PATCH] rename nodetodo and add test --- modules/{node-todo.py => nodetodo.py} | 2 +- modules/test/test_nodetodo.py | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) rename modules/{node-todo.py => nodetodo.py} (95%) create mode 100644 modules/test/test_nodetodo.py diff --git a/modules/node-todo.py b/modules/nodetodo.py similarity index 95% rename from modules/node-todo.py rename to modules/nodetodo.py index b8263f5..686c16e 100644 --- a/modules/node-todo.py +++ b/modules/nodetodo.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 """ -node-todo.py - node-todo uploader +nodetodo.py - node-todo uploader author: mutantmonkey author: telnoratti """ diff --git a/modules/test/test_nodetodo.py b/modules/test/test_nodetodo.py new file mode 100644 index 0000000..7ac1851 --- /dev/null +++ b/modules/test/test_nodetodo.py @@ -0,0 +1,25 @@ +""" +test_nodetodo.py - tests for the node-todo xss module +author: mutantmonkey +""" + +import re +import unittest +from mock import MagicMock, Mock +from modules.nodetodo import xss, urlshortener + + +class TestNodeTodo(unittest.TestCase): + def setUp(self): + self.phenny = MagicMock() + + def test_xss(self): + input = Mock(group=lambda x: 'http://vtluug.org/') + xss(self.phenny, input) + + out = self.phenny.reply.call_args[0][0] + m = re.match('^http://node-todobin\.herokuapp\.com/list/[a-z0-9]+$', + out, flags=re.UNICODE) + self.assertTrue(m) + +