clean up slogan.py and add test
parent
abc29de35c
commit
5087eb07d0
|
@ -32,7 +32,6 @@ def slogan(phenny, input):
|
|||
phenny.say("Looks like an issue with sloganizer.net")
|
||||
return
|
||||
phenny.say(slogan)
|
||||
|
||||
slogan.commands = ['slogan']
|
||||
slogan.example = '.slogan Granola'
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
"""
|
||||
test_slogan.py - tests for the slogan module
|
||||
author: mutantmonkey <mutantmonkey@mutantmonkey.in>
|
||||
"""
|
||||
|
||||
# add current working directory to path
|
||||
import sys
|
||||
sys.path.append('.')
|
||||
|
||||
import re
|
||||
import unittest
|
||||
from mock import MagicMock, Mock
|
||||
from modules.slogan import sloganize, slogan
|
||||
|
||||
class TestSlogan(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.phenny = MagicMock()
|
||||
|
||||
def test_sloganize(self):
|
||||
out = sloganize('slogan')
|
||||
|
||||
assert len(out) > 0
|
||||
|
||||
def test_slogan(self):
|
||||
input = Mock(group=lambda x: 'slogan')
|
||||
slogan(self.phenny, input)
|
||||
out = self.phenny.say.call_args[0][0]
|
||||
|
||||
self.assertNotEqual(out, "Looks like an issue with sloganizer.net")
|
Loading…
Reference in New Issue