Haki Benita
Feb 24, 2017 · 1 min read

When I write my own tests I usually use mock.ANY for sender and signal

handler.assert_called_once_with(
total=100,
sender=mock.ANY,
signal=mock.ANY,
)

sender is something you want to check when the same signal can be raised from different models (such as pre_save etc). signal is redundant because the mock was called (and the handler is registered to the signal).

    Haki Benita

    Written by

    Full Stack Developer, Team Leader, Independent. More from me at https://hakibenita.com