Skip to content

Commit

Permalink
pubbot.dispatch tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jc2k committed Sep 7, 2014
1 parent 1fd41f9 commit ce5262a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pubbot/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,31 @@

from django.core.cache import caches

from pubbot import dispatch
from pubbot import ratelimit
from pubbot.state import Machine, State, Transition
from pubbot.service import BaseService, TaskService
from pubbot.utils import force_str, force_bytes


class TestDispatch(unittest.TestCase):

def test_dispatch(self):
test_signal = dispatch.Signal()
a = mock.Mock()
b = mock.Mock()
b.side_effect = RuntimeError("Fake error")

test_signal.connect(b)
test_signal.connect(a)

retval = test_signal.send(hello="hello")
self.assertEqual(retval[0], (a, a.return_value))
self.assertEqual(len(retval), 1)

a.assert_called_with(signal=test_signal, sender=None, hello="hello")


class TestRateLimitUtils(unittest.TestCase):

def test_get_rate_1000_s(self):
Expand Down

0 comments on commit ce5262a

Please sign in to comment.