From 30705b87de7ab7e6d6ef2df429e5d8082fe71863 Mon Sep 17 00:00:00 2001 From: mutantmonkey Date: Fri, 1 Jun 2012 22:17:28 -0700 Subject: [PATCH] add what the commit test, simply mylife tests --- modules/test/test_commit.py | 17 +++++++++++++++++ modules/test/test_mylife.py | 29 ++++++----------------------- 2 files changed, 23 insertions(+), 23 deletions(-) create mode 100644 modules/test/test_commit.py diff --git a/modules/test/test_commit.py b/modules/test/test_commit.py new file mode 100644 index 0000000..f2903be --- /dev/null +++ b/modules/test/test_commit.py @@ -0,0 +1,17 @@ +""" +test_commit.py - tests for the what the commit module +author: mutantmonkey +""" + +import unittest +from mock import MagicMock, Mock +from modules.commit import commit + + +class TestCommit(unittest.TestCase): + def setUp(self): + self.phenny = MagicMock() + + def test_commit(self): + commit(self.phenny, None) + assert self.phenny.reply.called == 1 diff --git a/modules/test/test_mylife.py b/modules/test/test_mylife.py index 5a45f90..a224103 100644 --- a/modules/test/test_mylife.py +++ b/modules/test/test_mylife.py @@ -14,42 +14,25 @@ class TestMylife(unittest.TestCase): def test_fml(self): mylife.fml(self.phenny, None) - out = self.phenny.say.call_args[0][0] - - self.assertNotEqual(out, - "I tried to use .fml, but it was broken. FML") + assert self.phenny.say.called == 1 def test_mlia(self): mylife.mlia(self.phenny, None) - out = self.phenny.say.call_args[0][0] - - self.assertNotEqual(out, - "I tried to use .mlia, but it wasn't loading. MLIA") + assert self.phenny.say.called == 1 def test_mlib(self): mylife.mlib(self.phenny, None) - out = self.phenny.say.call_args[0][0] - - self.assertNotEqual(out, - "MLIB is out getting a case of Natty. It's chill.") + assert self.phenny.say.called == 1 def test_mlih(self): mylife.mlih(self.phenny, None) - out = self.phenny.say.call_args[0][0] - - self.assertNotEqual(out, - "MLIH is giving some dome to some lax bros.") + assert self.phenny.say.called == 1 def test_mlihp(self): mylife.mlihp(self.phenny, None) - out = self.phenny.say.call_args[0][0] - - self.assertNotEqual(out, - "This service is not available to Muggles.") + assert self.phenny.say.called == 1 def test_mlit(self): mylife.mlit(self.phenny, None) - out = self.phenny.say.call_args[0][0] + assert self.phenny.say.called == 1 - self.assertNotEqual(out, - "Error: Your life is too Twilight. Go outside.")