Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mariosanchezc/5ca1825f5924245cd4913992fe21f5c0 to your computer and use it in GitHub Desktop.
Save mariosanchezc/5ca1825f5924245cd4913992fe21f5c0 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