diff --git a/tests/regressiontests/generic_inline_admin/tests.py b/tests/regressiontests/generic_inline_admin/tests.py
index 10c86ae..058e672 100644
a
|
b
|
class GenericInlineAdminParametersTest(TestCase):
|
96 | 96 | EpisodeMaxNum, |
97 | 97 | EpisodeExclude, |
98 | 98 | ] |
| 99 | self.pks = {} |
99 | 100 | for klass in test_classes: |
100 | 101 | e = klass.objects.create(name='This Week in Django') |
| 102 | self.pks[klass.__name__.lower()] = e.pk |
101 | 103 | m = Media(content_object=e, url='http://example.com/podcast.mp3') |
102 | 104 | m.save() |
103 | 105 | |
… |
… |
class GenericInlineAdminParametersTest(TestCase):
|
108 | 110 | """ |
109 | 111 | With one initial form, extra (default) at 3, there should be 4 forms. |
110 | 112 | """ |
111 | | response = self.client.get('/generic_inline_admin/admin/generic_inline_admin/episode/1/') |
| 113 | response = self.client.get('/generic_inline_admin/admin/generic_inline_admin/episode/%s/' % self.pks['episode']) |
112 | 114 | formset = response.context['inline_admin_formsets'][0].formset |
113 | 115 | self.assertEqual(formset.total_form_count(), 4) |
114 | 116 | self.assertEqual(formset.initial_form_count(), 1) |
… |
… |
class GenericInlineAdminParametersTest(TestCase):
|
117 | 119 | """ |
118 | 120 | With extra=0, there should be one form. |
119 | 121 | """ |
120 | | response = self.client.get('/generic_inline_admin/admin/generic_inline_admin/episodeextra/2/') |
| 122 | response = self.client.get('/generic_inline_admin/admin/generic_inline_admin/episodeextra/%s/' % self.pks['episodeextra']) |
121 | 123 | formset = response.context['inline_admin_formsets'][0].formset |
122 | 124 | self.assertEqual(formset.total_form_count(), 1) |
123 | 125 | self.assertEqual(formset.initial_form_count(), 1) |
… |
… |
class GenericInlineAdminParametersTest(TestCase):
|
127 | 129 | With extra=5 and max_num=2, there should be only 2 forms. |
128 | 130 | """ |
129 | 131 | inline_form_data = '<input type="hidden" name="generic_inline_admin-media-content_type-object_id-TOTAL_FORMS" value="2" id="id_generic_inline_admin-media-content_type-object_id-TOTAL_FORMS" /><input type="hidden" name="generic_inline_admin-media-content_type-object_id-INITIAL_FORMS" value="1" id="id_generic_inline_admin-media-content_type-object_id-INITIAL_FORMS" />' |
130 | | response = self.client.get('/generic_inline_admin/admin/generic_inline_admin/episodemaxnum/3/') |
| 132 | response = self.client.get('/generic_inline_admin/admin/generic_inline_admin/episodemaxnum/%s/' % self.pks['episodemaxnum']) |
131 | 133 | formset = response.context['inline_admin_formsets'][0].formset |
132 | 134 | self.assertEqual(formset.total_form_count(), 2) |
133 | 135 | self.assertEqual(formset.initial_form_count(), 1) |
… |
… |
class GenericInlineAdminParametersTest(TestCase):
|
136 | 138 | """ |
137 | 139 | Generic inline formsets should respect include. |
138 | 140 | """ |
139 | | response = self.client.get('/generic_inline_admin/admin/generic_inline_admin/episodeexclude/4/') |
| 141 | response = self.client.get('/generic_inline_admin/admin/generic_inline_admin/episodeexclude/%s/' % self.pks['episodeexclude']) |
140 | 142 | formset = response.context['inline_admin_formsets'][0].formset |
141 | 143 | self.failIf('url' in formset.forms[0], 'The formset has excluded "url" field.') |
| 144 | No newline at end of file |