#NEWLINE# def test_document_upload( self ) : #NEWLINE# #INDENT# with open ( TEST_DOCUMENT_PATH ) as file_descriptor : #NEWLINE# #INDENT# document_response = self . client . post ( reverse ( 'rest_api:document-list' ) , { #NEWLINE# #INDENT# 'document_type' : self . document_type . pk , #NEWLINE# 'file' : file_descriptor , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# document_data = loads ( document_response . content ) #NEWLINE# self . assertEqual ( document_response . status_code , status . HTTP_201_CREATED ) #NEWLINE# self . assertEqual ( Document . objects . count ( ) , 1 ) #NEWLINE# document = Document . objects . first ( ) #NEWLINE# self . assertEqual ( document . pk , document_data [ 'id' ] ) #NEWLINE# self . assertEqual ( document . versions . count ( ) , 1 ) #NEWLINE# self . assertEqual ( document . exists ( ) , True ) #NEWLINE# self . assertEqual ( document . size , 272213 ) #NEWLINE# self . assertEqual ( document . file_mimetype , 'application/pdf' ) #NEWLINE# self . assertEqual ( document . file_mime_encoding , 'binary' ) #NEWLINE# self . assertEqual ( document . label , TEST_DOCUMENT_FILENAME ) #NEWLINE# self . assertEqual ( document . checksum , 'c637ffab6b8bb026ed3784afdb07663fddc60099853fae2be93890852a69ecf3' ) #NEWLINE# self . assertEqual ( document . page_count , 47 )