Created
January 4, 2012 18:33
-
-
Save dnozay/1561381 to your computer and use it in GitHub Desktop.
AdminTestMixin for django testcases whose models expose admin interface.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mixin for checkin admin interface. | |
# To be used in a django testcase (using test client). | |
# e.g. | |
# from django.test import TestCase | |
# class EntryTest(AdminTestMixin, TestCase): | |
# pass | |
class AdminTestMixin(object): | |
def test_model_admin(self): | |
app_label = self.model._meta.app_label | |
name = self.model._meta.module_name | |
list_url = reverse('admin:%(app_label)s_%(name)s_changelist' % locals()) | |
response = self.client.get(list_url) | |
self.assertEqual(response.status_code, 200) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment