testutils.py 543 B

1234567891011121314151617
  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. serialized_rollback = True
  9. def setUp(self):
  10. User = get_user_model()
  11. User.objects.create_superuser('TestAdmin', 'admin@test.com', 'Pass.123')
  12. admin_login(self.client, 'TestAdmin', 'Pass.123')