improve tests and test coverage

This commit is contained in:
mutantmonkey
2013-08-25 14:32:42 -07:00
parent f5fb2fc37d
commit 23d99dd326
6 changed files with 55 additions and 20 deletions

View File

@@ -25,6 +25,15 @@ class TestImdb(unittest.TestCase):
input = Mock(group=lambda x: 'Antitrust')
imdb(self.phenny, input)
out = self.phenny.reply.call_args[0][0]
m = re.match('^.* \(.*\): .* http://imdb.com/title/[a-z\d]+$', out, flags=re.UNICODE)
self.assertTrue(m)
out = self.phenny.say.call_args[0][0]
pattern = re.compile(
r'^.* \(.*\): .* http://imdb.com/title/[a-z\d]+$',
flags=re.UNICODE)
self.assertRegex(out, pattern)
def test_imdb_none(self):
input = Mock(group=lambda x: None)
imdb(self.phenny, input)
self.phenny.say.assert_called_once_with(
".imdb what?")