|
13 | 13 |
|
14 | 14 | from simple_history.models import HistoricalRecords
|
15 | 15 | from simple_history.admin import SimpleHistoryAdmin, get_complete_version
|
16 |
| -from ..models import Book, Person, Poll, State, Employee |
| 16 | +from ..models import Book, Person, Poll, State, Employee, Choice |
17 | 17 |
|
18 | 18 | try:
|
19 | 19 | from django.contrib.admin.utils import quote
|
@@ -75,6 +75,27 @@ def test_history_list(self):
|
75 | 75 | self.assertIn("Created", response.unicode_normal_body)
|
76 | 76 | self.assertIn(self.user.username, response.unicode_normal_body)
|
77 | 77 |
|
| 78 | + def test_history_list_custom_fields(self): |
| 79 | + model_name = self.user._meta.model_name |
| 80 | + self.assertEqual(model_name, 'customuser') |
| 81 | + self.login() |
| 82 | + poll = Poll(question="why?", pub_date=today) |
| 83 | + poll._history_user = self.user |
| 84 | + poll.save() |
| 85 | + choice = Choice(poll=poll, choice='because', votes=12) |
| 86 | + choice._history_user = self.user |
| 87 | + choice.save() |
| 88 | + choice.votes = 15 |
| 89 | + choice.save() |
| 90 | + response = self.app.get(get_history_url(choice)) |
| 91 | + self.assertIn(get_history_url(choice, 0), response.unicode_normal_body) |
| 92 | + self.assertIn("Choice object", response.unicode_normal_body) |
| 93 | + self.assertIn("Created", response.unicode_normal_body) |
| 94 | + self.assertIn(self.user.username, response.unicode_normal_body) |
| 95 | + self.assertIn("votes", response.unicode_normal_body) |
| 96 | + self.assertIn("12", response.unicode_normal_body) |
| 97 | + self.assertIn("15", response.unicode_normal_body) |
| 98 | + |
78 | 99 | def test_history_form_permission(self):
|
79 | 100 | self.login(self.user)
|
80 | 101 | person = Person.objects.create(name='Sandra Hale')
|
|
0 commit comments