#NEWLINE# def test_document_version_download_user_view( self ) : #NEWLINE# #INDENT# self . login ( username = TEST_USER_USERNAME , password = TEST_USER_PASSWORD ) #NEWLINE# self . assertEqual ( Document . objects . count ( ) , 1 ) #NEWLINE# response = self . post ( 'documents:document_version_download' , args = ( self . document . latest_version . pk , ) ) #NEWLINE# self . assertEqual ( response . status_code , 302 ) #NEWLINE# self . role . permissions . add ( permission_document_download . stored_permission ) #NEWLINE# response = self . post ( 'documents:document_version_download' , args = ( self . document . latest_version . pk , ) ) #NEWLINE# self . assertEqual ( response . status_code , 200 ) #NEWLINE# buf = BytesIO ( ) #NEWLINE# buf . write ( response . content ) #NEWLINE# self . assertEqual ( HASH_FUNCTION ( buf . getvalue ( ) ) , TEST_SMALL_DOCUMENT_CHECKSUM ) #NEWLINE# del buf