          self.assertEqual(
              list(ma.get_formsets(request))[0]().forms[0].fields.keys(),
              ['extra', 'transport', 'id', 'DELETE', 'main_band'])
  
      def test_media_minified_only_if_debug_is_false(self):
          """
          Ensure that, with ModelAdmin, the minified versions of the JS files are
          only used when DEBUG is False.
          Refs #17521.
          """
          ma = ModelAdmin(Band, self.site)
          ma.prepopulated_fields = ['something']
          ma.actions = ['some action']
  
          with override_settings(DEBUG=False):
              media_js = str(ma.media['js'])
              self.assertFalse('jquery.js' in media_js)
              self.assertTrue('jquery.min.js' in media_js)
              self.assertFalse('prepopulate.js' in media_js)
              self.assertTrue('prepopulate.min.js' in media_js)
              self.assertFalse('actions.js' in media_js)
              self.assertTrue('actions.min.js' in media_js)
          with override_settings(DEBUG=True):
              media_js = str(ma.media['js'])
              self.assertTrue('jquery.js' in media_js)
              self.assertFalse('jquery.min.js' in media_js)
              self.assertTrue('prepopulate.js' in media_js)
              self.assertFalse('prepopulate.min.js' in media_js)
              self.assertTrue('actions.js' in media_js)
              self.assertFalse('actions.min.js' in media_js)
  
      def test_inlines_media_minified_only_if_debug_is_false(self):
          """
          Ensure that, with InlineModelAdmin, the minified versions of the JS
          files are only used when DEBUG is False.
          Refs #17521.
          """
          class InlineBandAdmin(InlineModelAdmin):
              model = Band
  
          ma = InlineBandAdmin(Band, self.site)
          ma.prepopulated_fields = ['something']
          ma.actions = ['some action']
  
          with override_settings(DEBUG=False):
              media_js = str(ma.media['js'])
              self.assertFalse('jquery.js' in media_js)
              self.assertTrue('jquery.min.js' in media_js)
              self.assertFalse('prepopulate.js' in media_js)
              self.assertTrue('prepopulate.min.js' in media_js)
              self.assertFalse('inlines.js' in media_js)
              self.assertTrue('inlines.min.js' in media_js)
          with override_settings(DEBUG=True):
              media_js = str(ma.media['js'])
              self.assertTrue('jquery.js' in media_js)
              self.assertFalse('jquery.min.js' in media_js)
              self.assertTrue('prepopulate.js' in media_js)
              self.assertFalse('prepopulate.min.js' in media_js)
              self.assertTrue('inlines.js' in media_js)
              self.assertFalse('inlines.min.js' in media_js)
  
  
  class ValidationTests(unittest.TestCase):
      def test_validation_only_runs_in_debug(self):
          # Ensure validation only runs when DEBUG = True
          try:
 
</s> remove             js = ['jquery.min.js', 'jquery.init.js', 'collapse.min.js']
 </s> add             extra = '' if settings.DEBUG else '.min'
            js = ['jquery%s.js' % extra,
                  'jquery.init.js',
                  'collapse%s.js' % extra] </s> remove         extra = "" if settings.DEBUG else ".min"
        js = ['jquery%s.js' % extra, 'jquery.init.js', "inlines%s.js" % extra]
 </s> add         extra = '' if settings.DEBUG else '.min'
        js = ['jquery%s.js' % extra, 'jquery.init.js', 'inlines%s.js' % extra] </s> remove 
 </s> add     prepopulated_fields = {
        'title' : ('content',)
    }
    fieldsets=(
        ('Some fields', {
            'classes': ('collapse',),
            'fields': ('title', 'content')
        }),
        ('Some other fields', {
            'classes': ('wide',),
            'fields': ('date', 'section')
        })
    ) </s> remove         extra = "" if settings.DEBUG else ".min"
 </s> add         extra = '' if settings.DEBUG else '.min'
          self.assertEqual(
              list(ma.get_formsets(request))[0]().forms[0].fields.keys(),
              ['extra', 'transport', 'id', 'DELETE', 'main_band'])
  

























































  
  class ValidationTests(unittest.TestCase):
      def test_validation_only_runs_in_debug(self):
          # Ensure validation only runs when DEBUG = True
          try:
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Improved on r17454 to ensure that `collapse.js` only gets minified when `DEBUG` is `False`.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17455 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
tests/regressiontests/modeladmin/tests.py