#NEWLINE# def test__rpc( self ) : #NEWLINE# #INDENT# class ReqPB ( object ) : #NEWLINE# #INDENT# def SerializeToString( self ) : #NEWLINE# #INDENT# return REQPB #NEWLINE# #UNINDENT# #UNINDENT# class RspPB ( object ) : #NEWLINE# #INDENT# def __init__( self , pb ) : #NEWLINE# #INDENT# self . _pb = pb #NEWLINE# #UNINDENT# @ classmethod #NEWLINE# def FromString( cls , pb ) : #NEWLINE# #INDENT# return cls ( pb ) #NEWLINE# #UNINDENT# #UNINDENT# REQPB = b'REQPB' #NEWLINE# PROJECT = 'PROJECT' #NEWLINE# METHOD = 'METHOD' #NEWLINE# conn = self . _makeOne ( ) #NEWLINE# URI = '/' . join ( [ conn . api_base_url , conn . API_VERSION , 'projects' , ( ( PROJECT + ':' ) + METHOD ) ] ) #NEWLINE# http = conn . _http = Http ( { #NEWLINE# #INDENT# 'status' : '200' , #NEWLINE# #UNINDENT# } , 'CONTENT' ) #NEWLINE# response = conn . _rpc ( PROJECT , METHOD , ReqPB ( ) , RspPB ) #NEWLINE# self . assertTrue ( isinstance ( response , RspPB ) ) #NEWLINE# self . assertEqual ( response . _pb , 'CONTENT' ) #NEWLINE# self . _verifyProtobufCall ( http . _called_with , URI , conn ) #NEWLINE# self . assertEqual ( http . _called_with [ 'body' ] , REQPB )