Enabling honeypot.middleware.HoneypotMiddleware breaks existing tests
nessita opened this issue · 2 comments
Hello,
I have a big project where I recently added honeypot as dependency. I enabled the honeypot.middleware.HoneypotMiddleware middleware but then every single test that performs a POST breaks, because, of course, the honeypot field is not being sent.
I've investigated what Django does for the CSRF middleware, and they have a couple of hacks in place that I'm not sure apply for honeypot, since those require that the test Client gets instantiated with a custom parameter enforce_csrf_checks=False.
Can you think of any other way of using the middleware without breaking all the tests? (the existing tests are too many, adding the honeypot field to each one does not scale).
Thank you.
I'd probably use a different settings config for your tests that doesn't include django-honeypot. If you do need to test the interaction between any of your code & honeypot you could have separate tests for that that explicitly enable it
Right, that's what I implemented, but was hopping to get a, ideally, more general solution.
Thanks for the prompt reply!