#NEWLINE# def test_send_json_query( self ) : #NEWLINE# #INDENT# '\n        /test/jsonquery?q=\'{"eggs":"spam", "foo":"bar"}\'\n        ' #NEWLINE# class JsonClient ( Client ) : #NEWLINE# #INDENT# def process_result( self , result ) : #NEWLINE# #INDENT# return json . loads ( result ) #NEWLINE# #UNINDENT# #UNINDENT# q = dict ( foo = 'bar' , eggs = 'spam' ) #NEWLINE# jsonapi = JsonClient ( TEST_SERVER ) #NEWLINE# self . assertEqual ( jsonapi , jsonapi . tests . jsonquery ( q = json . dumps ( q ) ) ) #NEWLINE# class ApiJsonClient ( JsonClient ) : #NEWLINE# #INDENT# def build_request( self , resource , query ) : #NEWLINE# #INDENT# query = { #NEWLINE# #INDENT# 'q' : json . dumps ( query ) , #NEWLINE# #UNINDENT# } #NEWLINE# return ( resource , query ) #NEWLINE# #UNINDENT# #UNINDENT# jsonapi = ApiJsonClient ( TEST_SERVER ) #NEWLINE# self . assertEqual ( q , jsonapi . tests . jsonquery ( ** q ) ) #NEWLINE# self . assertEqual ( jsonapi . _last_response . final_url , ( TEST_SERVER + '/tests/jsonquery?q=%7B%22eggs%22%3A+%22spam%22%2C+%22foo%22%3A+%22bar%22%7D' ) )