Ticket #8487: t8487_r8471_tests.diff

File t8487_r8471_tests.diff, 2.0 KB (added by clamothe, 7 years ago)

Tests for revision 8471

  • django/tests/regressiontests/admin_views/models.py

     
     1# coding=utf-8
    12from django.db import models
    23from django.contrib import admin
    34
    class Article(models.Model): 
    1617    content = models.TextField()
    1718    date = models.DateTimeField()
    1819    section = models.ForeignKey(Section)
    19 
     20   
     21    def title_method(self):
     22        """ Test that short descriptions with international characters work """
     23        return self.title
     24    title_method.short_description = "Tími"
     25       
    2026    def __unicode__(self):
    2127        return self.title
    2228
    class ArticleInline(admin.TabularInline): 
    2430    model = Article
    2531
    2632class ArticleAdmin(admin.ModelAdmin):
    27     list_display = ('content', 'date')
     33    list_display = ('title_method', 'content', 'date')
    2834    list_filter = ('date',)
    2935
    3036    def changelist_view(self, request):
  • django/tests/regressiontests/admin_views/tests.py

    class AdminViewBasicTest(TestCase): 
    2929            '/test_admin/admin/admin_views/article/add/'
    3030        )
    3131   
     32    def testBasicChangeListGet(self):
     33        """
     34        A smoke test to ensure GET on the changelist_view works.
     35        Additionally tests that international characters may be used in a list_display method's short_description.
     36        """
     37        response = self.client.get('/test_admin/admin/admin_views/article/')
     38        self.failUnlessEqual(response.status_code, 200)
     39        self.failUnless("Tími" in response.content)
     40   
    3241    def testBasicAddGet(self):
    3342        """
    3443        A smoke test to ensure GET on the add_view works.
Back to Top