#NEWLINE# @ assert_logs ( NodeLog . EDITED_TITLE , 'collection' ) #NEWLINE# def test_update_collection_sanitizes_html_properly( self ) : #NEWLINE# #INDENT# 'Post request should update resource, and any HTML in fields should be stripped' #NEWLINE# new_title = '<strong>Super</strong><script>alert("even cooler")</script> Cool Project' #NEWLINE# res = self . app . put_json_api ( self . url , { #NEWLINE# #INDENT# 'data' : { #NEWLINE# #INDENT# 'id' : self . collection . _id , #NEWLINE# 'type' : 'collections' , #NEWLINE# 'attributes' : { #NEWLINE# #INDENT# 'title' : new_title , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , auth = self . user . auth ) #NEWLINE# assert_equal ( res . status_code , 200 ) #NEWLINE# assert_equal ( res . content_type , 'application/vnd.api+json' ) #NEWLINE# assert_equal ( res . json [ 'data' ] [ 'attributes' ] [ 'title' ] , strip_html ( new_title ) ) #NEWLINE# self . collection . reload ( ) #NEWLINE# assert_equal ( self . collection . title , strip_html ( res ) )