Hey I am trying to activate a signal in my test - but I can not seem to make it work.
This is my receiver
@receiver(post_save, sender=models.Allocation, dispatch_uid="close_overdue_invoice_tasks")
So how can "activate" it so it will call the method:
def close_overdue_invoice_tasks(sender, **kwargs):
...
All the signals works and my guess is that you manually have to activate the signals when running the tests.
I am using Pytest by the way.
Your signal will be called when you save your model that it is attached to. In this case, calling .save()
on an instance of Allocation
will cause the signal to be called.
You shouldn't have to activate the signals, they should be already set up. Check where you defined your signals and make sure that they are being executed during your test run.