How to test signals when using factory_boy with muted signals

Viewed 3205

I am using factory_boy package and DjangoModelFactory to generate a factory model with muted signals

@factory.django.mute_signals(signals.post_save)
class SomeModelTargetFactory(DjangoModelFactory):
    name = factory.Sequence(lambda x: "Name #{}".format(x))
    ...

I have a post_save signal connected to the model:

def send_notification(sender, instance, created, **kwargs):
    if created:
        send_email(...)
post_save.connect(send_notification, SomeModel)

How can I test the signals works when I create an instance of the model using the factory class?

1 Answers
Related