diff --git a/modules/test/test_fcc.py b/modules/test/test_fcc.py new file mode 100644 index 0000000..e669257 --- /dev/null +++ b/modules/test/test_fcc.py @@ -0,0 +1,37 @@ +""" +test_fcc.py - tests for the fcc callsign lookup module +author: mutantmonkey +""" + +# add current working directory to path +import sys +sys.path.append('.') + +import unittest +from mock import MagicMock, Mock +from modules.fcc import fcc + +class TestFcc(unittest.TestCase): + def setUp(self): + self.phenny = MagicMock() + + def test_result(self): + callsign = 'KK4EWT' + ham = 'JAMES B WILLIAMS' + key = 3326562 + + input = Mock(group=lambda x: 'KK4EWT') + fcc(self.phenny, input) + + self.phenny.say.assert_called_once_with('{0} - {1} - '\ + 'http://wireless2.fcc.gov/UlsApp/UlsSearch/license.jsp?licKey={2}' + .format(callsign, ham, key)) + + def test_none(self): + callsign = 'XFOOBAR' + + input = Mock(group=lambda x: callsign) + fcc(self.phenny, input) + + self.phenny.reply.assert_called_once_with('No results found for '\ + '{0}'.format(callsign))