#NEWLINE# def test_404_custom_payload( self ) : #NEWLINE# #INDENT# '\n        Test that if the decorated function throws a NotFound error with an\n        additional payload, a JSON response of status 404 is returned with\n        extra keys from the payload included.\n        ' #NEWLINE# test_payload = { #NEWLINE# #INDENT# 'error_detail' : 'The resource that you requested was not found on the server' , #NEWLINE# 'documentation' : 'http://www.flask-nicely.readthedocs.org' , #NEWLINE# #UNINDENT# } #NEWLINE# @ nice_json #NEWLINE# def error_function( ) : #NEWLINE# #INDENT# raise NotFound ( payload = test_payload ) #NEWLINE# #UNINDENT# response = error_function ( ) #NEWLINE# self . assertEqual ( { #NEWLINE# #INDENT# 'data' : None , #NEWLINE# 'status' : 404 , #NEWLINE# 'error' : 'Not Found' , #NEWLINE# 'error_detail' : 'The resource that you requested was not found on the server' , #NEWLINE# 'documentation' : 'http://www.flask-nicely.readthedocs.org' , #NEWLINE# #UNINDENT# } , error_function . json ) #NEWLINE# self . assertEqual ( 404 , response . status_code )