Django

Code

Changeset 7924

Show
Ignore:
Timestamp:
07/14/08 23:37:57 (4 months ago)
Author:
jkocherhans
Message:

newforms-admin: Removed a comment that was no longer applicable and cleaned up some whitespace.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/newforms-admin/tests/regressiontests/admin_views/tests.py

    r7825 r7924  
    1212    ct = ContentType.objects.get_for_model(Model) 
    1313    return Permission.objects.get(content_type=ct,codename=perm) 
    14      
    1514 
    1615class AdminViewPermissionsTest(TestCase): 
     
    4140        delete_user.user_permissions.add(get_perm(Article, 
    4241            opts.get_delete_permission())) 
    43  
     42         
    4443        delete_user.user_permissions.add(get_perm(Section, 
    4544            Section._meta.get_delete_permission())) 
     
    7473                     'username': 'joepublic', 
    7574                     'password': 'secret'} 
    76             
     75 
    7776    def testTrailingSlashRequired(self): 
    7877        """ 
     
    8786            '/test_admin/admin/admin_views/article/add/' 
    8887        ) 
    89      
     88 
    9089    def testLogin(self): 
    9190        """ 
     
    116115        # check to ensure if there are multiple e-mail addresses a user doesn't get a 500 
    117116        login = self.client.post('/test_admin/admin/', self.super_email_login) 
    118         self.assertContains(login, "Usernames cannot contain the '@' character")         
     117        self.assertContains(login, "Usernames cannot contain the '@' character") 
    119118         
    120119        # Add User 
     
    149148        # Login.context is a list of context dicts we just need to check the first one. 
    150149        self.assert_(login.context[0].get('error_message')) 
    151      
     150 
    152151    def testAddView(self): 
    153152        """Test add view restricts access and actually adds items.""" 
     
    192191        self.failUnlessEqual(Article.objects.all().count(), 4) 
    193192        self.client.get('/test_admin/admin/logout/') 
    194          
     193 
    195194    def testChangeView(self): 
    196195        """Change view should restrict access and allow users to edit items.""" 
     
    222221        self.failUnlessEqual(Article.objects.get(pk=1).content, '<p>edited article</p>') 
    223222        self.client.get('/test_admin/admin/logout/') 
    224          
     223 
    225224    def testCustomModelAdminTemplates(self): 
    226225        self.client.get('/test_admin/admin/') 
     
    253252         
    254253        self.client.get('/test_admin/admin/logout/') 
    255          
     254 
    256255    def testCustomAdminSiteTemplates(self): 
    257256        from django.contrib import admin 
     
    276275        self.assertTemplateUsed(request, 'custom_admin/index.html') 
    277276        self.assert_('Hello from a custom index template' in request.content) 
    278                  
     277         
    279278        # Finally, using monkey patching check we can inject custom_context arguments in to index 
    280279        original_index = admin.site.index 
     
    291290        admin.site.login_template = None 
    292291        admin.site.index_template = None 
    293      
     292 
    294293    def testDeleteView(self): 
    295294        """Delete view should restrict access and actually delete items.""" 
    296  
     295         
    297296        delete_dict = {'post': 'yes'} 
    298297         
     
    313312         # test response contains link to related Article 
    314313        self.assertContains(response, "admin_views/article/1/") 
    315  
     314         
    316315        response = self.client.get('/test_admin/admin/admin_views/article/1/delete/') 
    317316        self.failUnlessEqual(response.status_code, 200) 
    318317        post = self.client.post('/test_admin/admin/admin_views/article/1/delete/', delete_dict) 
    319         # TODO: http://code.djangoproject.com/ticket/6819 or the next line fails 
    320318        self.assertRedirects(post, '/test_admin/admin/') 
    321319        self.failUnlessEqual(Article.objects.all().count(), 0) 
    322320        self.client.get('/test_admin/admin/logout/') 
    323