Initial revision
authorLindsey Smith <lindsey.smith@gmail.com>
Mon, 14 Mar 2011 16:19:12 +0000 (09:19 -0700)
committerLindsey Smith <lindsey.smith@gmail.com>
Mon, 14 Mar 2011 16:19:12 +0000 (09:19 -0700)
test_rss2email.py [new file with mode: 0644]

diff --git a/test_rss2email.py b/test_rss2email.py
new file mode 100644 (file)
index 0000000..44e14c0
--- /dev/null
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-\r
+"""Unit tests for rss2email.\r
+\r
+These tests make sure that rss2email works as it should. If you\r
+find a bug, the best way to express it is as a test\r
+case like this that fails."""\r
+\r
+import unittest\r
+from rss2email import *\r
+\r
+class Test_validateEmail(unittest.TestCase):\r
+       """"""\r
+       def test_valid_email(self):\r
+               email = validateEmail("valid@example.com", "planb@example.com")\r
+               self.assertEqual(email, "valid@example.com")\r
+\r
+       def test_no_mail_server(self):\r
+               email = validateEmail("invalid", "planb@example.com")\r
+               self.assertEqual(email, "planb@example.com")\r
+\r
+       def test_no_email_name(self):\r
+               email = validateEmail("@invalid", "planb@example.com")\r
+               self.assertEqual(email, "planb@example.com")\r
+\r
+       def test_no_at(self):\r
+               email = validateEmail("invalid", "planb@example.com")\r
+               self.assertEqual(email, "planb@example.com")\r
+\r
+if __name__ == '__main__':\r
+    unittest.main()\r