Closed mschoettle closed 6 months ago
@jheld Let me know what you think please. Happy to create a PR for this.
The alternative would be to disable auth events to be watched in tests but it would be nice to stay as close as possible to production.
Should any extra conceptual weirdness be at play here by making this change, it's evading me at this time. Given the examples you've shown in the code where it certainly allows None
, I concur with your approach. Yes, please make a PR :)
The
user_logged_in
signal handler fails during tests when callingclient.force_login(...)
because the request has no IP (REMOTE_ADDR
).Would it be ok to change this to
request.META.get(REMOTE_ADDR_HEADER)
?remote_ip
is already nullable so from theLoginEvent
model perspective it is already supported. And the request signal handler already supports this:https://github.com/soynatan/django-easy-audit/blob/bbdf834d671811043e7bab4aaeb39903ac21f982/easyaudit/signals/request_signals.py#L44