#27117: The force_login() does not work in a testing if using more one a test
-----------------------------------+-------------------------------
Reporter: setivolkylany | Owner: nobody
Type: Uncategorized | Status: new
Component: Testing framework | Version: 1.9
Severity: Normal | Keywords: Pytest, LiveTests
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+-------------------------------
# test_.py
{{{
from django.test import Client
from django.contrib.auth import get_user_model
from django.core.management import call_command
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
class Tests(StaticLiveServerTestCase):
@classmethod
def setUpClass(cls):
super(Tests, cls).setUpClass()
call_command('factory_test_superusers', '1')
cls.active_superuser = get_user_model().objects.get()
def setUp(self):
c = Client()
c.force_login(self.active_superuser)
def test_1(self):
pass
def test_2(self):
pass
}}}
# run tests
py.test
traceback is here https://bpaste.net/show/36be7958e3d9
--
Ticket URL: <https://code.djangoproject.com/ticket/27117>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/056.183c1af3724c1de2d96ff3e9e08896c1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.