Completed test coverage for ModelDetailView.

This commit is contained in:
Mads Jensen 2018-01-10 18:13:04 +01:00 committed by Tim Graham
parent e2908ecb3e
commit a613feb5d3
1 changed files with 10 additions and 0 deletions

View File

@ -293,6 +293,16 @@ class TestModelDetailView(TestDataMixin, AdminDocsTestCase):
def test_model_detail_title(self):
self.assertContains(self.response, '<h1>admin_docs.Person</h1>', html=True)
def test_app_not_found(self):
response = self.client.get(reverse('django-admindocs-models-detail', args=['doesnotexist', 'Person']))
self.assertEqual(response.context['exception'], "App 'doesnotexist' not found")
self.assertEqual(response.status_code, 404)
def test_model_not_found(self):
response = self.client.get(reverse('django-admindocs-models-detail', args=['admin_docs', 'doesnotexist']))
self.assertEqual(response.context['exception'], "Model 'doesnotexist' not found in app 'admin_docs'")
self.assertEqual(response.status_code, 404)
class CustomField(models.Field):
description = "A custom field type"