Ticket #10876: django-r10586-fix.patch

File django-r10586-fix.patch, 3.3 KB (added by korpios, 16 years ago)
  • tests/regressiontests/generic_inline_admin/tests.py

    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):  
    9696            EpisodeMaxNum,
    9797            EpisodeExclude,
    9898        ]
     99        self.pks = {}
    99100        for klass in test_classes:
    100101            e = klass.objects.create(name='This Week in Django')
     102            self.pks[klass.__name__.lower()] = e.pk
    101103            m = Media(content_object=e, url='http://example.com/podcast.mp3')
    102104            m.save()
    103105   
    class GenericInlineAdminParametersTest(TestCase):  
    108110        """
    109111        With one initial form, extra (default) at 3, there should be 4 forms.
    110112        """
    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'])
    112114        formset = response.context['inline_admin_formsets'][0].formset
    113115        self.assertEqual(formset.total_form_count(), 4)
    114116        self.assertEqual(formset.initial_form_count(), 1)
    class GenericInlineAdminParametersTest(TestCase):  
    117119        """
    118120        With extra=0, there should be one form.
    119121        """
    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'])
    121123        formset = response.context['inline_admin_formsets'][0].formset
    122124        self.assertEqual(formset.total_form_count(), 1)
    123125        self.assertEqual(formset.initial_form_count(), 1)
    class GenericInlineAdminParametersTest(TestCase):  
    127129        With extra=5 and max_num=2, there should be only 2 forms.
    128130        """
    129131        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'])
    131133        formset = response.context['inline_admin_formsets'][0].formset
    132134        self.assertEqual(formset.total_form_count(), 2)
    133135        self.assertEqual(formset.initial_form_count(), 1)
    class GenericInlineAdminParametersTest(TestCase):  
    136138        """
    137139        Generic inline formsets should respect include.
    138140        """
    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'])
    140142        formset = response.context['inline_admin_formsets'][0].formset
    141143        self.failIf('url' in formset.forms[0], 'The formset has excluded "url" field.')
     144 No newline at end of file
Back to Top