-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't raise UserWarning 'No request passed to the backend' during tests #41
Comments
This warning happens for us whenever we call from django.contrib.auth.models import AnonymousUser
from django.urls import reverse
from django.test import RequestFactory, TestCase
class SomethingTests(TestCase):
def setUp(self):
factory = RequestFactory()
self.login_request = factory.get(reverse('login'))
self.login_request.user = AnonymousUser
super(TestCase, self).setUp()
def test_method(self):
self.client.login(username='user', password='pass', request=self.login_request) |
I ended up using this snippet in my testing.py settings
|
ciarancourtney
added a commit
to ciarancourtney/django-ratelimit-backend
that referenced
this issue
Nov 19, 2018
* Default is False
ciarancourtney
added a commit
to ciarancourtney/django-ratelimit-backend
that referenced
this issue
Nov 19, 2018
* Default is False
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What would be the accepted method to stop this from happening during mocked auth unit tests?
Thanks
The text was updated successfully, but these errors were encountered: