#NEWLINE# def test_update_post( self ) : #NEWLINE# #INDENT# a = Author . objects . create ( name = 'Randall Munroe' , slug = 'randall-munroe' ) #NEWLINE# res = self . client . get ( ( '/edit/author/%d/update/' % a . pk ) ) #NEWLINE# self . assertEqual ( res . status_code , 200 ) #NEWLINE# self . assertIsInstance ( self . context [ 'form' ] , forms . ModelForm ) #NEWLINE# self . assertEqual ( res . context [ 'object' ] , Author . objects . get ( pk = a . pk ) ) #NEWLINE# self . assertEqual ( res . context [ 'author' ] , Author . objects . get ( pk = a . pk ) ) #NEWLINE# self . assertTemplateUsed ( res , 'generic_views/author_form.html' ) #NEWLINE# res = self . client . post ( ( '/edit/author/%d/update/' % a . pk ) , { #NEWLINE# #INDENT# 'name' : 'Randall Munroe (xkcd)' , #NEWLINE# 'slug' : 'randall-munroe' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( res . status_code , 302 ) #NEWLINE# self . assertRedirects ( res , 'http://testserver/list/authors/' ) #NEWLINE# self . assertQuerysetEqual ( Author . objects . all ( ) , [ '<Author: Randall Munroe (xkcd)>' ] )