django-axes/tests/test_signals.py
2021-01-07 18:23:33 +02:00

19 lines
490 B
Python

from unittest.mock import MagicMock
from axes.signals import user_locked_out
from tests.base import AxesTestCase
class SignalTestCase(AxesTestCase):
def test_send_lockout_signal(self):
"""
Test if the lockout signal is correctly emitted when user is locked out.
"""
handler = MagicMock()
user_locked_out.connect(handler)
self.assertEqual(0, handler.call_count)
self.lockout()
self.assertEqual(1, handler.call_count)