From 6fece14639a22dbb2bd48c4b96b6a9b0b57a347e Mon Sep 17 00:00:00 2001 From: mutantmonkey Date: Sat, 2 Jun 2012 01:13:50 -0700 Subject: [PATCH] catfacts test and test cleanup --- modules/test/test_catfacts.py | 22 ++++++++++++++++++++++ modules/test/test_commit.py | 2 +- modules/test/test_mylife.py | 2 +- modules/test/test_nodetodo.py | 2 -- modules/test/test_wuvt.py | 2 +- 5 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 modules/test/test_catfacts.py diff --git a/modules/test/test_catfacts.py b/modules/test/test_catfacts.py new file mode 100644 index 0000000..508fddf --- /dev/null +++ b/modules/test/test_catfacts.py @@ -0,0 +1,22 @@ +""" +test_catfacts.py - tests for the cat facts module +author: mutantmonkey +""" + +import re +import unittest +from mock import MagicMock +from modules.catfacts import catfacts + + +class TestCatfacts(unittest.TestCase): + def setUp(self): + self.phenny = MagicMock() + + def test_catfacts(self): + catfacts(self.phenny, None) + + out = self.phenny.reply.call_args[0][0] + m = re.match('^.* \(#[0-9]+\)$', out, + flags=re.UNICODE) + self.assertTrue(m) diff --git a/modules/test/test_commit.py b/modules/test/test_commit.py index f2903be..f045e2a 100644 --- a/modules/test/test_commit.py +++ b/modules/test/test_commit.py @@ -4,7 +4,7 @@ author: mutantmonkey """ import unittest -from mock import MagicMock, Mock +from mock import MagicMock from modules.commit import commit diff --git a/modules/test/test_mylife.py b/modules/test/test_mylife.py index a224103..53ff31f 100644 --- a/modules/test/test_mylife.py +++ b/modules/test/test_mylife.py @@ -4,7 +4,7 @@ author: mutantmonkey """ import unittest -from mock import MagicMock, Mock +from mock import MagicMock from modules import mylife diff --git a/modules/test/test_nodetodo.py b/modules/test/test_nodetodo.py index 7ac1851..31b9ea3 100644 --- a/modules/test/test_nodetodo.py +++ b/modules/test/test_nodetodo.py @@ -21,5 +21,3 @@ class TestNodeTodo(unittest.TestCase): m = re.match('^http://node-todobin\.herokuapp\.com/list/[a-z0-9]+$', out, flags=re.UNICODE) self.assertTrue(m) - - diff --git a/modules/test/test_wuvt.py b/modules/test/test_wuvt.py index e89c5f9..5271f9d 100644 --- a/modules/test/test_wuvt.py +++ b/modules/test/test_wuvt.py @@ -9,7 +9,7 @@ sys.path.append('.') import re import unittest -from mock import MagicMock, Mock +from mock import MagicMock from modules.wuvt import wuvt class TestWuvt(unittest.TestCase):