#NEWLINE# def test_save_publication_returns_correct_html( self ) : #NEWLINE# #INDENT# client = Client ( ) #NEWLINE# client . login ( username = TEST_USER_USERNAME , password = TEST_USER_PASSWORD ) #NEWLINE# kwargs = { #NEWLINE# #INDENT# 'HTTP_X_REQUESTED_WITH' : 'XMLHttpRequest' , #NEWLINE# #UNINDENT# } #NEWLINE# file_path = ( settings . MEDIA_ROOT + '/sample.pdf' ) #NEWLINE# with open ( file_path , 'rb' ) as fp : #NEWLINE# #INDENT# self . assertTrue ( ( fp is not None ) ) #NEWLINE# response = client . post ( '/save_publication' , { #NEWLINE# #INDENT# 'publication_id' : 0 , #NEWLINE# 'title' : 'test' , #NEWLINE# 'description' : 'test' , #NEWLINE# 'file' : fp , #NEWLINE# #UNINDENT# } , ** kwargs ) #NEWLINE# self . assertEqual ( response . status_code , 200 ) #NEWLINE# #UNINDENT# response = client . post ( '/delete_publication' , { #NEWLINE# #INDENT# 'publication_id' : 1 , #NEWLINE# #UNINDENT# } , ** kwargs ) #NEWLINE# self . assertEqual ( response . status_code , 200 ) #NEWLINE# json_string = response . content . decode ( encoding = 'UTF-8' ) #NEWLINE# array = json . loads ( json_string ) #NEWLINE# self . assertEqual ( array [ 'status' ] , 'success' ) #NEWLINE# self . assertEqual ( array [ 'message' ] , 'deleted' )