phenny-1/modules/test/test_slogan.py

31 lines
827 B
Python
Raw Normal View History

2012-06-01 02:13:02 -04:00
"""
test_slogan.py - tests for the slogan module
author: mutantmonkey <mutantmonkey@mutantmonkey.in>
"""
import unittest
from mock import MagicMock, Mock
from modules.slogan import sloganize, slogan
2012-06-01 02:13:02 -04:00
class TestSlogan(unittest.TestCase):
def setUp(self):
self.phenny = MagicMock()
def test_sloganize(self):
out = sloganize('slogan')
2013-08-25 17:32:42 -04:00
self.assertRegex(out, ".*slogan.*")
2012-06-01 02:13:02 -04:00
def test_slogan(self):
input = Mock(group=lambda x: 'slogan')
slogan(self.phenny, input)
2013-08-25 17:32:42 -04:00
2012-06-01 02:13:02 -04:00
out = self.phenny.say.call_args[0][0]
2013-08-25 17:32:42 -04:00
self.assertRegex(out, ".*slogan.*")
2012-06-01 02:13:02 -04:00
2013-08-25 17:32:42 -04:00
def test_slogan_none(self):
input = Mock(group=lambda x: None)
slogan(self.phenny, input)
self.phenny.say.assert_called_once_with(
"You need to specify a word; try .slogan Granola")