testutils.py 511 B

123456789101112131415
  1. from django.contrib.auth import get_user_model
  2. from django.core.urlresolvers import reverse
  3. from django.test import TestCase
  4. def admin_login(client, username, password):
  5. client.post(reverse('misago:admin:index'),
  6. data={'username': username, 'password': password})
  7. class AdminTestCase(TestCase):
  8. def setUp(self):
  9. User = get_user_model()
  10. User.objects.create_superuser('TestAdmin', 'admin@test.com', 'Pass.123')
  11. admin_login(self.client, 'TestAdmin', 'Pass.123')