2012-06-01 02:34:38 -04:00
|
|
|
"""
|
|
|
|
test_short.py - tests for the vtluug url shortener module
|
|
|
|
author: mutantmonkey <mutantmonkey@mutantmonkey.in>
|
|
|
|
"""
|
|
|
|
|
|
|
|
import unittest
|
|
|
|
from mock import MagicMock, Mock
|
|
|
|
from modules.short import short
|
|
|
|
|
2012-06-01 03:13:57 -04:00
|
|
|
|
2012-06-01 02:34:38 -04:00
|
|
|
class TestShort(unittest.TestCase):
|
|
|
|
def setUp(self):
|
|
|
|
self.phenny = MagicMock()
|
|
|
|
|
|
|
|
def test_short(self):
|
|
|
|
input = Mock(group=lambda x: 'http://vtluug.org/')
|
|
|
|
short(self.phenny, input)
|
|
|
|
self.phenny.reply.assert_called_once_with('http://vtlu.ug/bLQYAy')
|
2013-08-25 17:32:42 -04:00
|
|
|
|
|
|
|
def test_short_none(self):
|
|
|
|
input = Mock(group=lambda x: None)
|
|
|
|
short(self.phenny, input)
|
|
|
|
self.phenny.reply.assert_called_once_with(
|
|
|
|
"No URL provided. CAN I HAS?")
|