Skip to content

Instantly share code, notes, and snippets.

@flavianmissi
Created November 6, 2011 01:56
Show Gist options
  • Save flavianmissi/1342352 to your computer and use it in GitHub Desktop.
Save flavianmissi/1342352 to your computer and use it in GitHub Desktop.
Testing Django signals
from unittest import TestCase
from my_app.signals import foo_bar
class SignalsTestCase(TestCase):
def dummy_listener(self, sender, **kwargs):
self.times += 1
def test_deve_chamar_o_signal_foo_bar(self):
self.times = 0
foo_bar.connect(self.dummy_listener)
metodo_que_deve_disparar_o_sinal()
self.asserGreater(self.times, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment