Oblivious to the obvious
Raphael Kimmig, 28 Sep 2013
Just because I've just spent half an hour tracing through WebTest and the Django auth internals...
When you are using WebTest to test custom admin views and for some reason your user login doesn't seem to work - make sure to check for is_staff=True on the test user.
from django_webtest import WebTest
from django_dynamic_fixture import G
class CustomAdminTest(WebTest):
def setUp(self):
self.user = G(User, is_superuser=True, is_staff=True)
def test_custom_admin_page(self):
custom_page = self.app.get(reverse('admin:custom_page'), user=self.user)
self.assertContains(custom_page, 'custom value')