grpc_testing.html 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
  4. <head>
  5. <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <title>gRPC Testing &#8212; gRPC Python 1.18.0 documentation</title>
  8. <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
  9. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  10. <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
  11. <script type="text/javascript" src="_static/jquery.js"></script>
  12. <script type="text/javascript" src="_static/underscore.js"></script>
  13. <script type="text/javascript" src="_static/doctools.js"></script>
  14. <script type="text/javascript" src="_static/language_data.js"></script>
  15. <link rel="index" title="Index" href="genindex.html" />
  16. <link rel="search" title="Search" href="search.html" />
  17. <link rel="next" title="Glossary" href="glossary.html" />
  18. <link rel="prev" title="gRPC Reflection" href="grpc_reflection.html" />
  19. <link rel="stylesheet" href="_static/custom.css" type="text/css" />
  20. <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
  21. </head><body>
  22. <div class="document">
  23. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  24. <div class="sphinxsidebarwrapper">
  25. <h1 class="logo"><a href="index.html">gRPC Python</a></h1>
  26. <p class="blurb">1.18.0</p>
  27. <h3>Navigation</h3>
  28. <p class="caption"><span class="caption-text">Contents:</span></p>
  29. <ul class="current">
  30. <li class="toctree-l1"><a class="reference internal" href="grpc.html">gRPC</a></li>
  31. <li class="toctree-l1"><a class="reference internal" href="grpc_channelz.html">gRPC Channelz</a></li>
  32. <li class="toctree-l1"><a class="reference internal" href="grpc_health_checking.html">gRPC Health Checking</a></li>
  33. <li class="toctree-l1"><a class="reference internal" href="grpc_reflection.html">gRPC Reflection</a></li>
  34. <li class="toctree-l1 current"><a class="current reference internal" href="#">gRPC Testing</a><ul>
  35. <li class="toctree-l2"><a class="reference internal" href="#module-grpc_testing">Module Contents</a></li>
  36. </ul>
  37. </li>
  38. <li class="toctree-l1"><a class="reference internal" href="glossary.html">Glossary</a></li>
  39. </ul>
  40. <div class="relations">
  41. <h3>Related Topics</h3>
  42. <ul>
  43. <li><a href="index.html">Documentation overview</a><ul>
  44. <li>Previous: <a href="grpc_reflection.html" title="previous chapter">gRPC Reflection</a></li>
  45. <li>Next: <a href="glossary.html" title="next chapter">Glossary</a></li>
  46. </ul></li>
  47. </ul>
  48. </div>
  49. <div id="searchbox" style="display: none" role="search">
  50. <h3>Quick search</h3>
  51. <div class="searchformwrapper">
  52. <form class="search" action="search.html" method="get">
  53. <input type="text" name="q" />
  54. <input type="submit" value="Go" />
  55. <input type="hidden" name="check_keywords" value="yes" />
  56. <input type="hidden" name="area" value="default" />
  57. </form>
  58. </div>
  59. </div>
  60. <script type="text/javascript">$('#searchbox').show(0);</script>
  61. </div>
  62. </div>
  63. <div class="documentwrapper">
  64. <div class="bodywrapper">
  65. <div class="body" role="main">
  66. <div class="section" id="grpc-testing">
  67. <h1>gRPC Testing<a class="headerlink" href="#grpc-testing" title="Permalink to this headline">¶</a></h1>
  68. <div class="section" id="module-grpc_testing">
  69. <span id="module-contents"></span><h2>Module Contents<a class="headerlink" href="#module-grpc_testing" title="Permalink to this headline">¶</a></h2>
  70. <p>Objects for use in testing gRPC Python-using application code.</p>
  71. <dl class="class">
  72. <dt id="grpc_testing.Channel">
  73. <em class="property">class </em><code class="descclassname">grpc_testing.</code><code class="descname">Channel</code><a class="reference internal" href="_modules/grpc_testing.html#Channel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.Channel" title="Permalink to this definition">¶</a></dt>
  74. <dd><p>A grpc.Channel double with which to test a system that invokes RPCs.</p>
  75. <dl class="method">
  76. <dt id="grpc_testing.Channel.take_stream_stream">
  77. <code class="descname">take_stream_stream</code><span class="sig-paren">(</span><em>method_descriptor</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#Channel.take_stream_stream"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.Channel.take_stream_stream" title="Permalink to this definition">¶</a></dt>
  78. <dd><p>Draws an RPC currently being made by the system under test.</p>
  79. <p>If the given descriptor does not identify any RPC currently being made
  80. by the system under test, this method blocks until the system under
  81. test invokes such an RPC.</p>
  82. <table class="docutils field-list" frame="void" rules="none">
  83. <col class="field-name" />
  84. <col class="field-body" />
  85. <tbody valign="top">
  86. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>method_descriptor</strong> – A descriptor.MethodDescriptor describing a
  87. stream-stream RPC method.</td>
  88. </tr>
  89. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="docutils">
  90. <dt>A (invocation_metadata, stream_stream_channel_rpc) tuple of the RPC’s</dt>
  91. <dd>invocation metadata and a StreamStreamChannelRpc with which to
  92. “play server” for the RPC.</dd>
  93. </dl>
  94. </td>
  95. </tr>
  96. </tbody>
  97. </table>
  98. </dd></dl>
  99. <dl class="method">
  100. <dt id="grpc_testing.Channel.take_stream_unary">
  101. <code class="descname">take_stream_unary</code><span class="sig-paren">(</span><em>method_descriptor</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#Channel.take_stream_unary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.Channel.take_stream_unary" title="Permalink to this definition">¶</a></dt>
  102. <dd><p>Draws an RPC currently being made by the system under test.</p>
  103. <p>If the given descriptor does not identify any RPC currently being made
  104. by the system under test, this method blocks until the system under
  105. test invokes such an RPC.</p>
  106. <table class="docutils field-list" frame="void" rules="none">
  107. <col class="field-name" />
  108. <col class="field-body" />
  109. <tbody valign="top">
  110. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>method_descriptor</strong> – A descriptor.MethodDescriptor describing a
  111. stream-unary RPC method.</td>
  112. </tr>
  113. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="docutils">
  114. <dt>A (invocation_metadata, stream_unary_channel_rpc) tuple of the RPC’s</dt>
  115. <dd>invocation metadata and a StreamUnaryChannelRpc with which to “play
  116. server” for the RPC.</dd>
  117. </dl>
  118. </td>
  119. </tr>
  120. </tbody>
  121. </table>
  122. </dd></dl>
  123. <dl class="method">
  124. <dt id="grpc_testing.Channel.take_unary_stream">
  125. <code class="descname">take_unary_stream</code><span class="sig-paren">(</span><em>method_descriptor</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#Channel.take_unary_stream"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.Channel.take_unary_stream" title="Permalink to this definition">¶</a></dt>
  126. <dd><p>Draws an RPC currently being made by the system under test.</p>
  127. <p>If the given descriptor does not identify any RPC currently being made
  128. by the system under test, this method blocks until the system under
  129. test invokes such an RPC.</p>
  130. <table class="docutils field-list" frame="void" rules="none">
  131. <col class="field-name" />
  132. <col class="field-body" />
  133. <tbody valign="top">
  134. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>method_descriptor</strong> – A descriptor.MethodDescriptor describing a
  135. unary-stream RPC method.</td>
  136. </tr>
  137. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="docutils">
  138. <dt>A (invocation_metadata, request, unary_stream_channel_rpc) tuple of</dt>
  139. <dd>the RPC’s invocation metadata, its request, and a
  140. UnaryStreamChannelRpc with which to “play server” for the RPC.</dd>
  141. </dl>
  142. </td>
  143. </tr>
  144. </tbody>
  145. </table>
  146. </dd></dl>
  147. <dl class="method">
  148. <dt id="grpc_testing.Channel.take_unary_unary">
  149. <code class="descname">take_unary_unary</code><span class="sig-paren">(</span><em>method_descriptor</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#Channel.take_unary_unary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.Channel.take_unary_unary" title="Permalink to this definition">¶</a></dt>
  150. <dd><p>Draws an RPC currently being made by the system under test.</p>
  151. <p>If the given descriptor does not identify any RPC currently being made
  152. by the system under test, this method blocks until the system under
  153. test invokes such an RPC.</p>
  154. <table class="docutils field-list" frame="void" rules="none">
  155. <col class="field-name" />
  156. <col class="field-body" />
  157. <tbody valign="top">
  158. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>method_descriptor</strong> – A descriptor.MethodDescriptor describing a
  159. unary-unary RPC method.</td>
  160. </tr>
  161. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="docutils">
  162. <dt>A (invocation_metadata, request, unary_unary_channel_rpc) tuple of</dt>
  163. <dd>the RPC’s invocation metadata, its request, and a
  164. UnaryUnaryChannelRpc with which to “play server” for the RPC.</dd>
  165. </dl>
  166. </td>
  167. </tr>
  168. </tbody>
  169. </table>
  170. </dd></dl>
  171. </dd></dl>
  172. <dl class="class">
  173. <dt id="grpc_testing.Server">
  174. <em class="property">class </em><code class="descclassname">grpc_testing.</code><code class="descname">Server</code><a class="reference internal" href="_modules/grpc_testing.html#Server"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.Server" title="Permalink to this definition">¶</a></dt>
  175. <dd><p>A server with which to test a system that services RPCs.</p>
  176. <dl class="method">
  177. <dt id="grpc_testing.Server.invoke_stream_stream">
  178. <code class="descname">invoke_stream_stream</code><span class="sig-paren">(</span><em>method_descriptor</em>, <em>invocation_metadata</em>, <em>timeout</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#Server.invoke_stream_stream"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.Server.invoke_stream_stream" title="Permalink to this definition">¶</a></dt>
  179. <dd><p>Invokes an RPC to be serviced by the system under test.</p>
  180. <table class="docutils field-list" frame="void" rules="none">
  181. <col class="field-name" />
  182. <col class="field-body" />
  183. <tbody valign="top">
  184. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  185. <li><strong>method_descriptor</strong> – A descriptor.MethodDescriptor describing a stream-stream
  186. RPC method.</li>
  187. <li><strong>invocation_metadata</strong> – The RPC’s invocation metadata.</li>
  188. <li><strong>timeout</strong> – A duration of time in seconds for the RPC or None to
  189. indicate that the RPC has no time limit.</li>
  190. </ul>
  191. </td>
  192. </tr>
  193. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A StreamStreamServerRpc with which to “play client” for the RPC.</p>
  194. </td>
  195. </tr>
  196. </tbody>
  197. </table>
  198. </dd></dl>
  199. <dl class="method">
  200. <dt id="grpc_testing.Server.invoke_stream_unary">
  201. <code class="descname">invoke_stream_unary</code><span class="sig-paren">(</span><em>method_descriptor</em>, <em>invocation_metadata</em>, <em>timeout</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#Server.invoke_stream_unary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.Server.invoke_stream_unary" title="Permalink to this definition">¶</a></dt>
  202. <dd><p>Invokes an RPC to be serviced by the system under test.</p>
  203. <table class="docutils field-list" frame="void" rules="none">
  204. <col class="field-name" />
  205. <col class="field-body" />
  206. <tbody valign="top">
  207. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  208. <li><strong>method_descriptor</strong> – A descriptor.MethodDescriptor describing a stream-unary
  209. RPC method.</li>
  210. <li><strong>invocation_metadata</strong> – The RPC’s invocation metadata.</li>
  211. <li><strong>timeout</strong> – A duration of time in seconds for the RPC or None to
  212. indicate that the RPC has no time limit.</li>
  213. </ul>
  214. </td>
  215. </tr>
  216. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A StreamUnaryServerRpc with which to “play client” for the RPC.</p>
  217. </td>
  218. </tr>
  219. </tbody>
  220. </table>
  221. </dd></dl>
  222. <dl class="method">
  223. <dt id="grpc_testing.Server.invoke_unary_stream">
  224. <code class="descname">invoke_unary_stream</code><span class="sig-paren">(</span><em>method_descriptor</em>, <em>invocation_metadata</em>, <em>request</em>, <em>timeout</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#Server.invoke_unary_stream"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.Server.invoke_unary_stream" title="Permalink to this definition">¶</a></dt>
  225. <dd><p>Invokes an RPC to be serviced by the system under test.</p>
  226. <table class="docutils field-list" frame="void" rules="none">
  227. <col class="field-name" />
  228. <col class="field-body" />
  229. <tbody valign="top">
  230. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  231. <li><strong>method_descriptor</strong> – A descriptor.MethodDescriptor describing a unary-stream
  232. RPC method.</li>
  233. <li><strong>invocation_metadata</strong> – The RPC’s invocation metadata.</li>
  234. <li><strong>request</strong> – The RPC’s request.</li>
  235. <li><strong>timeout</strong> – A duration of time in seconds for the RPC or None to
  236. indicate that the RPC has no time limit.</li>
  237. </ul>
  238. </td>
  239. </tr>
  240. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A UnaryStreamServerRpc with which to “play client” for the RPC.</p>
  241. </td>
  242. </tr>
  243. </tbody>
  244. </table>
  245. </dd></dl>
  246. <dl class="method">
  247. <dt id="grpc_testing.Server.invoke_unary_unary">
  248. <code class="descname">invoke_unary_unary</code><span class="sig-paren">(</span><em>method_descriptor</em>, <em>invocation_metadata</em>, <em>request</em>, <em>timeout</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#Server.invoke_unary_unary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.Server.invoke_unary_unary" title="Permalink to this definition">¶</a></dt>
  249. <dd><p>Invokes an RPC to be serviced by the system under test.</p>
  250. <table class="docutils field-list" frame="void" rules="none">
  251. <col class="field-name" />
  252. <col class="field-body" />
  253. <tbody valign="top">
  254. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  255. <li><strong>method_descriptor</strong> – A descriptor.MethodDescriptor describing a unary-unary
  256. RPC method.</li>
  257. <li><strong>invocation_metadata</strong> – The RPC’s invocation metadata.</li>
  258. <li><strong>request</strong> – The RPC’s request.</li>
  259. <li><strong>timeout</strong> – A duration of time in seconds for the RPC or None to
  260. indicate that the RPC has no time limit.</li>
  261. </ul>
  262. </td>
  263. </tr>
  264. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A UnaryUnaryServerRpc with which to “play client” for the RPC.</p>
  265. </td>
  266. </tr>
  267. </tbody>
  268. </table>
  269. </dd></dl>
  270. </dd></dl>
  271. <dl class="class">
  272. <dt id="grpc_testing.StreamStreamChannelRpc">
  273. <em class="property">class </em><code class="descclassname">grpc_testing.</code><code class="descname">StreamStreamChannelRpc</code><a class="reference internal" href="_modules/grpc_testing.html#StreamStreamChannelRpc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamStreamChannelRpc" title="Permalink to this definition">¶</a></dt>
  274. <dd><p>Fixture for a stream-stream RPC invoked by a system under test.</p>
  275. <p>Enables users to “play server” for the RPC.</p>
  276. <dl class="method">
  277. <dt id="grpc_testing.StreamStreamChannelRpc.cancelled">
  278. <code class="descname">cancelled</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamStreamChannelRpc.cancelled"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamStreamChannelRpc.cancelled" title="Permalink to this definition">¶</a></dt>
  279. <dd><p>Blocks until the system under test has cancelled the RPC.</p>
  280. </dd></dl>
  281. <dl class="method">
  282. <dt id="grpc_testing.StreamStreamChannelRpc.requests_closed">
  283. <code class="descname">requests_closed</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamStreamChannelRpc.requests_closed"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamStreamChannelRpc.requests_closed" title="Permalink to this definition">¶</a></dt>
  284. <dd><p>Blocks until the system under test has closed the request stream.</p>
  285. </dd></dl>
  286. <dl class="method">
  287. <dt id="grpc_testing.StreamStreamChannelRpc.send_initial_metadata">
  288. <code class="descname">send_initial_metadata</code><span class="sig-paren">(</span><em>initial_metadata</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamStreamChannelRpc.send_initial_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamStreamChannelRpc.send_initial_metadata" title="Permalink to this definition">¶</a></dt>
  289. <dd><p>Sends the RPC’s initial metadata to the system under test.</p>
  290. <table class="docutils field-list" frame="void" rules="none">
  291. <col class="field-name" />
  292. <col class="field-body" />
  293. <tbody valign="top">
  294. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>initial_metadata</strong> – The RPC’s initial metadata to be “sent” to the
  295. system under test.</td>
  296. </tr>
  297. </tbody>
  298. </table>
  299. </dd></dl>
  300. <dl class="method">
  301. <dt id="grpc_testing.StreamStreamChannelRpc.send_response">
  302. <code class="descname">send_response</code><span class="sig-paren">(</span><em>response</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamStreamChannelRpc.send_response"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamStreamChannelRpc.send_response" title="Permalink to this definition">¶</a></dt>
  303. <dd><p>Sends a response to the system under test.</p>
  304. <table class="docutils field-list" frame="void" rules="none">
  305. <col class="field-name" />
  306. <col class="field-body" />
  307. <tbody valign="top">
  308. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>response</strong> – A response messages to be “sent” to the system under test.</td>
  309. </tr>
  310. </tbody>
  311. </table>
  312. </dd></dl>
  313. <dl class="method">
  314. <dt id="grpc_testing.StreamStreamChannelRpc.take_request">
  315. <code class="descname">take_request</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamStreamChannelRpc.take_request"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamStreamChannelRpc.take_request" title="Permalink to this definition">¶</a></dt>
  316. <dd><p>Draws one of the requests added to the RPC by the system under test.</p>
  317. <p>This method blocks until the system under test has added to the RPC
  318. the request to be returned.</p>
  319. <p>Successive calls to this method return requests in the same order in
  320. which the system under test added them to the RPC.</p>
  321. <table class="docutils field-list" frame="void" rules="none">
  322. <col class="field-name" />
  323. <col class="field-body" />
  324. <tbody valign="top">
  325. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A request message added to the RPC by the system under test.</td>
  326. </tr>
  327. </tbody>
  328. </table>
  329. </dd></dl>
  330. <dl class="method">
  331. <dt id="grpc_testing.StreamStreamChannelRpc.terminate">
  332. <code class="descname">terminate</code><span class="sig-paren">(</span><em>trailing_metadata</em>, <em>code</em>, <em>details</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamStreamChannelRpc.terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamStreamChannelRpc.terminate" title="Permalink to this definition">¶</a></dt>
  333. <dd><p>Terminates the RPC.</p>
  334. <table class="docutils field-list" frame="void" rules="none">
  335. <col class="field-name" />
  336. <col class="field-body" />
  337. <tbody valign="top">
  338. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  339. <li><strong>trailing_metadata</strong> – The RPC’s trailing metadata.</li>
  340. <li><strong>code</strong> – The RPC’s status code.</li>
  341. <li><strong>details</strong> – The RPC’s status details.</li>
  342. </ul>
  343. </td>
  344. </tr>
  345. </tbody>
  346. </table>
  347. </dd></dl>
  348. </dd></dl>
  349. <dl class="class">
  350. <dt id="grpc_testing.StreamStreamServerRpc">
  351. <em class="property">class </em><code class="descclassname">grpc_testing.</code><code class="descname">StreamStreamServerRpc</code><a class="reference internal" href="_modules/grpc_testing.html#StreamStreamServerRpc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamStreamServerRpc" title="Permalink to this definition">¶</a></dt>
  352. <dd><p>Fixture for a stream-stream RPC serviced by a system under test.</p>
  353. <p>Enables users to “play client” for the RPC.</p>
  354. <dl class="method">
  355. <dt id="grpc_testing.StreamStreamServerRpc.cancel">
  356. <code class="descname">cancel</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamStreamServerRpc.cancel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamStreamServerRpc.cancel" title="Permalink to this definition">¶</a></dt>
  357. <dd><p>Cancels the RPC.</p>
  358. </dd></dl>
  359. <dl class="method">
  360. <dt id="grpc_testing.StreamStreamServerRpc.initial_metadata">
  361. <code class="descname">initial_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamStreamServerRpc.initial_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamStreamServerRpc.initial_metadata" title="Permalink to this definition">¶</a></dt>
  362. <dd><p>Accesses the initial metadata emitted by the system under test.</p>
  363. <p>This method blocks until the system under test has added initial
  364. metadata to the RPC (or has provided one or more response messages or
  365. has terminated the RPC, either of which will cause gRPC Python to
  366. synthesize initial metadata for the RPC).</p>
  367. <table class="docutils field-list" frame="void" rules="none">
  368. <col class="field-name" />
  369. <col class="field-body" />
  370. <tbody valign="top">
  371. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The initial metadata for the RPC.</td>
  372. </tr>
  373. </tbody>
  374. </table>
  375. </dd></dl>
  376. <dl class="method">
  377. <dt id="grpc_testing.StreamStreamServerRpc.requests_closed">
  378. <code class="descname">requests_closed</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamStreamServerRpc.requests_closed"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamStreamServerRpc.requests_closed" title="Permalink to this definition">¶</a></dt>
  379. <dd><p>Indicates the end of the RPC’s request stream.</p>
  380. </dd></dl>
  381. <dl class="method">
  382. <dt id="grpc_testing.StreamStreamServerRpc.send_request">
  383. <code class="descname">send_request</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamStreamServerRpc.send_request"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamStreamServerRpc.send_request" title="Permalink to this definition">¶</a></dt>
  384. <dd><p>Sends a request to the system under test.</p>
  385. <table class="docutils field-list" frame="void" rules="none">
  386. <col class="field-name" />
  387. <col class="field-body" />
  388. <tbody valign="top">
  389. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>request</strong> – A request message for the RPC to be “sent” to the system
  390. under test.</td>
  391. </tr>
  392. </tbody>
  393. </table>
  394. </dd></dl>
  395. <dl class="method">
  396. <dt id="grpc_testing.StreamStreamServerRpc.take_response">
  397. <code class="descname">take_response</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamStreamServerRpc.take_response"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamStreamServerRpc.take_response" title="Permalink to this definition">¶</a></dt>
  398. <dd><p>Draws one of the responses added to the RPC by the system under test.</p>
  399. <p>Successive calls to this method return responses in the same order in
  400. which the system under test added them to the RPC.</p>
  401. <table class="docutils field-list" frame="void" rules="none">
  402. <col class="field-name" />
  403. <col class="field-body" />
  404. <tbody valign="top">
  405. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A response message added to the RPC by the system under test.</td>
  406. </tr>
  407. </tbody>
  408. </table>
  409. </dd></dl>
  410. <dl class="method">
  411. <dt id="grpc_testing.StreamStreamServerRpc.termination">
  412. <code class="descname">termination</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamStreamServerRpc.termination"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamStreamServerRpc.termination" title="Permalink to this definition">¶</a></dt>
  413. <dd><p>Blocks until the system under test has terminated the RPC.</p>
  414. <table class="docutils field-list" frame="void" rules="none">
  415. <col class="field-name" />
  416. <col class="field-body" />
  417. <tbody valign="top">
  418. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><dl class="docutils">
  419. <dt>A (trailing_metadata, code, details) sequence with the RPC’s trailing</dt>
  420. <dd>metadata, code, and details.</dd>
  421. </dl>
  422. </td>
  423. </tr>
  424. </tbody>
  425. </table>
  426. </dd></dl>
  427. </dd></dl>
  428. <dl class="class">
  429. <dt id="grpc_testing.StreamUnaryChannelRpc">
  430. <em class="property">class </em><code class="descclassname">grpc_testing.</code><code class="descname">StreamUnaryChannelRpc</code><a class="reference internal" href="_modules/grpc_testing.html#StreamUnaryChannelRpc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamUnaryChannelRpc" title="Permalink to this definition">¶</a></dt>
  431. <dd><p>Fixture for a stream-unary RPC invoked by a system under test.</p>
  432. <p>Enables users to “play server” for the RPC.</p>
  433. <dl class="method">
  434. <dt id="grpc_testing.StreamUnaryChannelRpc.cancelled">
  435. <code class="descname">cancelled</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamUnaryChannelRpc.cancelled"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamUnaryChannelRpc.cancelled" title="Permalink to this definition">¶</a></dt>
  436. <dd><p>Blocks until the system under test has cancelled the RPC.</p>
  437. </dd></dl>
  438. <dl class="method">
  439. <dt id="grpc_testing.StreamUnaryChannelRpc.requests_closed">
  440. <code class="descname">requests_closed</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamUnaryChannelRpc.requests_closed"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamUnaryChannelRpc.requests_closed" title="Permalink to this definition">¶</a></dt>
  441. <dd><p>Blocks until the system under test has closed the request stream.</p>
  442. </dd></dl>
  443. <dl class="method">
  444. <dt id="grpc_testing.StreamUnaryChannelRpc.send_initial_metadata">
  445. <code class="descname">send_initial_metadata</code><span class="sig-paren">(</span><em>initial_metadata</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamUnaryChannelRpc.send_initial_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamUnaryChannelRpc.send_initial_metadata" title="Permalink to this definition">¶</a></dt>
  446. <dd><p>Sends the RPC’s initial metadata to the system under test.</p>
  447. <table class="docutils field-list" frame="void" rules="none">
  448. <col class="field-name" />
  449. <col class="field-body" />
  450. <tbody valign="top">
  451. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>initial_metadata</strong> – The RPC’s initial metadata to be “sent” to
  452. the system under test.</td>
  453. </tr>
  454. </tbody>
  455. </table>
  456. </dd></dl>
  457. <dl class="method">
  458. <dt id="grpc_testing.StreamUnaryChannelRpc.take_request">
  459. <code class="descname">take_request</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamUnaryChannelRpc.take_request"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamUnaryChannelRpc.take_request" title="Permalink to this definition">¶</a></dt>
  460. <dd><p>Draws one of the requests added to the RPC by the system under test.</p>
  461. <p>This method blocks until the system under test has added to the RPC
  462. the request to be returned.</p>
  463. <p>Successive calls to this method return requests in the same order in
  464. which the system under test added them to the RPC.</p>
  465. <table class="docutils field-list" frame="void" rules="none">
  466. <col class="field-name" />
  467. <col class="field-body" />
  468. <tbody valign="top">
  469. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A request message added to the RPC by the system under test.</td>
  470. </tr>
  471. </tbody>
  472. </table>
  473. </dd></dl>
  474. <dl class="method">
  475. <dt id="grpc_testing.StreamUnaryChannelRpc.terminate">
  476. <code class="descname">terminate</code><span class="sig-paren">(</span><em>response</em>, <em>trailing_metadata</em>, <em>code</em>, <em>details</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamUnaryChannelRpc.terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamUnaryChannelRpc.terminate" title="Permalink to this definition">¶</a></dt>
  477. <dd><p>Terminates the RPC.</p>
  478. <table class="docutils field-list" frame="void" rules="none">
  479. <col class="field-name" />
  480. <col class="field-body" />
  481. <tbody valign="top">
  482. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  483. <li><strong>response</strong> – The response for the RPC.</li>
  484. <li><strong>trailing_metadata</strong> – The RPC’s trailing metadata.</li>
  485. <li><strong>code</strong> – The RPC’s status code.</li>
  486. <li><strong>details</strong> – The RPC’s status details.</li>
  487. </ul>
  488. </td>
  489. </tr>
  490. </tbody>
  491. </table>
  492. </dd></dl>
  493. </dd></dl>
  494. <dl class="class">
  495. <dt id="grpc_testing.StreamUnaryServerRpc">
  496. <em class="property">class </em><code class="descclassname">grpc_testing.</code><code class="descname">StreamUnaryServerRpc</code><a class="reference internal" href="_modules/grpc_testing.html#StreamUnaryServerRpc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamUnaryServerRpc" title="Permalink to this definition">¶</a></dt>
  497. <dd><p>Fixture for a stream-unary RPC serviced by a system under test.</p>
  498. <p>Enables users to “play client” for the RPC.</p>
  499. <dl class="method">
  500. <dt id="grpc_testing.StreamUnaryServerRpc.cancel">
  501. <code class="descname">cancel</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamUnaryServerRpc.cancel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamUnaryServerRpc.cancel" title="Permalink to this definition">¶</a></dt>
  502. <dd><p>Cancels the RPC.</p>
  503. </dd></dl>
  504. <dl class="method">
  505. <dt id="grpc_testing.StreamUnaryServerRpc.initial_metadata">
  506. <code class="descname">initial_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamUnaryServerRpc.initial_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamUnaryServerRpc.initial_metadata" title="Permalink to this definition">¶</a></dt>
  507. <dd><p>Accesses the initial metadata emitted by the system under test.</p>
  508. <p>This method blocks until the system under test has added initial
  509. metadata to the RPC (or has provided one or more response messages or
  510. has terminated the RPC, either of which will cause gRPC Python to
  511. synthesize initial metadata for the RPC).</p>
  512. <table class="docutils field-list" frame="void" rules="none">
  513. <col class="field-name" />
  514. <col class="field-body" />
  515. <tbody valign="top">
  516. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The initial metadata for the RPC.</td>
  517. </tr>
  518. </tbody>
  519. </table>
  520. </dd></dl>
  521. <dl class="method">
  522. <dt id="grpc_testing.StreamUnaryServerRpc.requests_closed">
  523. <code class="descname">requests_closed</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamUnaryServerRpc.requests_closed"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamUnaryServerRpc.requests_closed" title="Permalink to this definition">¶</a></dt>
  524. <dd><p>Indicates the end of the RPC’s request stream.</p>
  525. </dd></dl>
  526. <dl class="method">
  527. <dt id="grpc_testing.StreamUnaryServerRpc.send_request">
  528. <code class="descname">send_request</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamUnaryServerRpc.send_request"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamUnaryServerRpc.send_request" title="Permalink to this definition">¶</a></dt>
  529. <dd><p>Sends a request to the system under test.</p>
  530. <table class="docutils field-list" frame="void" rules="none">
  531. <col class="field-name" />
  532. <col class="field-body" />
  533. <tbody valign="top">
  534. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>request</strong> – A request message for the RPC to be “sent” to the system
  535. under test.</td>
  536. </tr>
  537. </tbody>
  538. </table>
  539. </dd></dl>
  540. <dl class="method">
  541. <dt id="grpc_testing.StreamUnaryServerRpc.termination">
  542. <code class="descname">termination</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#StreamUnaryServerRpc.termination"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.StreamUnaryServerRpc.termination" title="Permalink to this definition">¶</a></dt>
  543. <dd><p>Blocks until the system under test has terminated the RPC.</p>
  544. <table class="docutils field-list" frame="void" rules="none">
  545. <col class="field-name" />
  546. <col class="field-body" />
  547. <tbody valign="top">
  548. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><dl class="docutils">
  549. <dt>A (response, trailing_metadata, code, details) sequence with the RPC’s</dt>
  550. <dd>response, trailing metadata, code, and details.</dd>
  551. </dl>
  552. </td>
  553. </tr>
  554. </tbody>
  555. </table>
  556. </dd></dl>
  557. </dd></dl>
  558. <dl class="class">
  559. <dt id="grpc_testing.Time">
  560. <em class="property">class </em><code class="descclassname">grpc_testing.</code><code class="descname">Time</code><a class="reference internal" href="_modules/grpc_testing.html#Time"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.Time" title="Permalink to this definition">¶</a></dt>
  561. <dd><p>A simulation of time.</p>
  562. <p>Implementations needn’t be connected with real time as provided by the
  563. Python interpreter, but as long as systems under test use
  564. RpcContext.is_active and RpcContext.time_remaining for querying RPC liveness
  565. implementations may be used to change passage of time in tests.</p>
  566. <dl class="method">
  567. <dt id="grpc_testing.Time.call_at">
  568. <code class="descname">call_at</code><span class="sig-paren">(</span><em>behavior</em>, <em>time</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#Time.call_at"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.Time.call_at" title="Permalink to this definition">¶</a></dt>
  569. <dd><p>Adds a behavior to be called at a specific time.</p>
  570. <table class="docutils field-list" frame="void" rules="none">
  571. <col class="field-name" />
  572. <col class="field-body" />
  573. <tbody valign="top">
  574. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  575. <li><strong>behavior</strong> – A behavior to be called with no arguments.</li>
  576. <li><strong>time</strong> – The test time at which to call the behavior.</li>
  577. </ul>
  578. </td>
  579. </tr>
  580. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><dl class="docutils">
  581. <dt>A grpc.Future with which the call of the behavior may be cancelled</dt>
  582. <dd><p class="first last">before it is executed.</p>
  583. </dd>
  584. </dl>
  585. </p>
  586. </td>
  587. </tr>
  588. </tbody>
  589. </table>
  590. </dd></dl>
  591. <dl class="method">
  592. <dt id="grpc_testing.Time.call_in">
  593. <code class="descname">call_in</code><span class="sig-paren">(</span><em>behavior</em>, <em>delay</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#Time.call_in"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.Time.call_in" title="Permalink to this definition">¶</a></dt>
  594. <dd><p>Adds a behavior to be called after some time.</p>
  595. <table class="docutils field-list" frame="void" rules="none">
  596. <col class="field-name" />
  597. <col class="field-body" />
  598. <tbody valign="top">
  599. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  600. <li><strong>behavior</strong> – A behavior to be called with no arguments.</li>
  601. <li><strong>delay</strong> – A duration of time in seconds after which to call the behavior.</li>
  602. </ul>
  603. </td>
  604. </tr>
  605. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><dl class="docutils">
  606. <dt>A grpc.Future with which the call of the behavior may be cancelled</dt>
  607. <dd><p class="first last">before it is executed.</p>
  608. </dd>
  609. </dl>
  610. </p>
  611. </td>
  612. </tr>
  613. </tbody>
  614. </table>
  615. </dd></dl>
  616. <dl class="method">
  617. <dt id="grpc_testing.Time.sleep_for">
  618. <code class="descname">sleep_for</code><span class="sig-paren">(</span><em>duration</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#Time.sleep_for"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.Time.sleep_for" title="Permalink to this definition">¶</a></dt>
  619. <dd><p>Blocks for some length of test time.</p>
  620. <table class="docutils field-list" frame="void" rules="none">
  621. <col class="field-name" />
  622. <col class="field-body" />
  623. <tbody valign="top">
  624. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>duration</strong> – A duration of test time in seconds for which to block.</td>
  625. </tr>
  626. </tbody>
  627. </table>
  628. </dd></dl>
  629. <dl class="method">
  630. <dt id="grpc_testing.Time.sleep_until">
  631. <code class="descname">sleep_until</code><span class="sig-paren">(</span><em>time</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#Time.sleep_until"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.Time.sleep_until" title="Permalink to this definition">¶</a></dt>
  632. <dd><p>Blocks until some test time.</p>
  633. <table class="docutils field-list" frame="void" rules="none">
  634. <col class="field-name" />
  635. <col class="field-body" />
  636. <tbody valign="top">
  637. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>time</strong> – The test time until which to block.</td>
  638. </tr>
  639. </tbody>
  640. </table>
  641. </dd></dl>
  642. <dl class="method">
  643. <dt id="grpc_testing.Time.time">
  644. <code class="descname">time</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#Time.time"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.Time.time" title="Permalink to this definition">¶</a></dt>
  645. <dd><p>Accesses the current test time.</p>
  646. <table class="docutils field-list" frame="void" rules="none">
  647. <col class="field-name" />
  648. <col class="field-body" />
  649. <tbody valign="top">
  650. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The current test time (over which this object has authority).</td>
  651. </tr>
  652. </tbody>
  653. </table>
  654. </dd></dl>
  655. </dd></dl>
  656. <dl class="class">
  657. <dt id="grpc_testing.UnaryStreamChannelRpc">
  658. <em class="property">class </em><code class="descclassname">grpc_testing.</code><code class="descname">UnaryStreamChannelRpc</code><a class="reference internal" href="_modules/grpc_testing.html#UnaryStreamChannelRpc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryStreamChannelRpc" title="Permalink to this definition">¶</a></dt>
  659. <dd><p>Fixture for a unary-stream RPC invoked by a system under test.</p>
  660. <p>Enables users to “play server” for the RPC.</p>
  661. <dl class="method">
  662. <dt id="grpc_testing.UnaryStreamChannelRpc.cancelled">
  663. <code class="descname">cancelled</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#UnaryStreamChannelRpc.cancelled"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryStreamChannelRpc.cancelled" title="Permalink to this definition">¶</a></dt>
  664. <dd><p>Blocks until the system under test has cancelled the RPC.</p>
  665. </dd></dl>
  666. <dl class="method">
  667. <dt id="grpc_testing.UnaryStreamChannelRpc.send_initial_metadata">
  668. <code class="descname">send_initial_metadata</code><span class="sig-paren">(</span><em>initial_metadata</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#UnaryStreamChannelRpc.send_initial_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryStreamChannelRpc.send_initial_metadata" title="Permalink to this definition">¶</a></dt>
  669. <dd><p>Sends the RPC’s initial metadata to the system under test.</p>
  670. <table class="docutils field-list" frame="void" rules="none">
  671. <col class="field-name" />
  672. <col class="field-body" />
  673. <tbody valign="top">
  674. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>initial_metadata</strong> – The RPC’s initial metadata to be “sent” to
  675. the system under test.</td>
  676. </tr>
  677. </tbody>
  678. </table>
  679. </dd></dl>
  680. <dl class="method">
  681. <dt id="grpc_testing.UnaryStreamChannelRpc.send_response">
  682. <code class="descname">send_response</code><span class="sig-paren">(</span><em>response</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#UnaryStreamChannelRpc.send_response"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryStreamChannelRpc.send_response" title="Permalink to this definition">¶</a></dt>
  683. <dd><p>Sends a response to the system under test.</p>
  684. <table class="docutils field-list" frame="void" rules="none">
  685. <col class="field-name" />
  686. <col class="field-body" />
  687. <tbody valign="top">
  688. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>response</strong> – A response message to be “sent” to the system under test.</td>
  689. </tr>
  690. </tbody>
  691. </table>
  692. </dd></dl>
  693. <dl class="method">
  694. <dt id="grpc_testing.UnaryStreamChannelRpc.terminate">
  695. <code class="descname">terminate</code><span class="sig-paren">(</span><em>trailing_metadata</em>, <em>code</em>, <em>details</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#UnaryStreamChannelRpc.terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryStreamChannelRpc.terminate" title="Permalink to this definition">¶</a></dt>
  696. <dd><p>Terminates the RPC.</p>
  697. <table class="docutils field-list" frame="void" rules="none">
  698. <col class="field-name" />
  699. <col class="field-body" />
  700. <tbody valign="top">
  701. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  702. <li><strong>trailing_metadata</strong> – The RPC’s trailing metadata.</li>
  703. <li><strong>code</strong> – The RPC’s status code.</li>
  704. <li><strong>details</strong> – The RPC’s status details.</li>
  705. </ul>
  706. </td>
  707. </tr>
  708. </tbody>
  709. </table>
  710. </dd></dl>
  711. </dd></dl>
  712. <dl class="class">
  713. <dt id="grpc_testing.UnaryStreamServerRpc">
  714. <em class="property">class </em><code class="descclassname">grpc_testing.</code><code class="descname">UnaryStreamServerRpc</code><a class="reference internal" href="_modules/grpc_testing.html#UnaryStreamServerRpc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryStreamServerRpc" title="Permalink to this definition">¶</a></dt>
  715. <dd><p>Fixture for a unary-stream RPC serviced by a system under test.</p>
  716. <p>Enables users to “play client” for the RPC.</p>
  717. <dl class="method">
  718. <dt id="grpc_testing.UnaryStreamServerRpc.cancel">
  719. <code class="descname">cancel</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#UnaryStreamServerRpc.cancel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryStreamServerRpc.cancel" title="Permalink to this definition">¶</a></dt>
  720. <dd><p>Cancels the RPC.</p>
  721. </dd></dl>
  722. <dl class="method">
  723. <dt id="grpc_testing.UnaryStreamServerRpc.initial_metadata">
  724. <code class="descname">initial_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#UnaryStreamServerRpc.initial_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryStreamServerRpc.initial_metadata" title="Permalink to this definition">¶</a></dt>
  725. <dd><p>Accesses the initial metadata emitted by the system under test.</p>
  726. <p>This method blocks until the system under test has added initial
  727. metadata to the RPC (or has provided one or more response messages or
  728. has terminated the RPC, either of which will cause gRPC Python to
  729. synthesize initial metadata for the RPC).</p>
  730. <table class="docutils field-list" frame="void" rules="none">
  731. <col class="field-name" />
  732. <col class="field-body" />
  733. <tbody valign="top">
  734. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The initial metadata for the RPC.</td>
  735. </tr>
  736. </tbody>
  737. </table>
  738. </dd></dl>
  739. <dl class="method">
  740. <dt id="grpc_testing.UnaryStreamServerRpc.take_response">
  741. <code class="descname">take_response</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#UnaryStreamServerRpc.take_response"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryStreamServerRpc.take_response" title="Permalink to this definition">¶</a></dt>
  742. <dd><p>Draws one of the responses added to the RPC by the system under test.</p>
  743. <p>Successive calls to this method return responses in the same order in
  744. which the system under test added them to the RPC.</p>
  745. <table class="docutils field-list" frame="void" rules="none">
  746. <col class="field-name" />
  747. <col class="field-body" />
  748. <tbody valign="top">
  749. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A response message added to the RPC by the system under test.</td>
  750. </tr>
  751. </tbody>
  752. </table>
  753. </dd></dl>
  754. <dl class="method">
  755. <dt id="grpc_testing.UnaryStreamServerRpc.termination">
  756. <code class="descname">termination</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#UnaryStreamServerRpc.termination"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryStreamServerRpc.termination" title="Permalink to this definition">¶</a></dt>
  757. <dd><p>Blocks until the system under test has terminated the RPC.</p>
  758. <table class="docutils field-list" frame="void" rules="none">
  759. <col class="field-name" />
  760. <col class="field-body" />
  761. <tbody valign="top">
  762. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><dl class="docutils">
  763. <dt>A (trailing_metadata, code, details) sequence with the RPC’s trailing</dt>
  764. <dd>metadata, code, and details.</dd>
  765. </dl>
  766. </td>
  767. </tr>
  768. </tbody>
  769. </table>
  770. </dd></dl>
  771. </dd></dl>
  772. <dl class="class">
  773. <dt id="grpc_testing.UnaryUnaryChannelRpc">
  774. <em class="property">class </em><code class="descclassname">grpc_testing.</code><code class="descname">UnaryUnaryChannelRpc</code><a class="reference internal" href="_modules/grpc_testing.html#UnaryUnaryChannelRpc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryUnaryChannelRpc" title="Permalink to this definition">¶</a></dt>
  775. <dd><p>Fixture for a unary-unary RPC invoked by a system under test.</p>
  776. <p>Enables users to “play server” for the RPC.</p>
  777. <dl class="method">
  778. <dt id="grpc_testing.UnaryUnaryChannelRpc.cancelled">
  779. <code class="descname">cancelled</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#UnaryUnaryChannelRpc.cancelled"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryUnaryChannelRpc.cancelled" title="Permalink to this definition">¶</a></dt>
  780. <dd><p>Blocks until the system under test has cancelled the RPC.</p>
  781. </dd></dl>
  782. <dl class="method">
  783. <dt id="grpc_testing.UnaryUnaryChannelRpc.send_initial_metadata">
  784. <code class="descname">send_initial_metadata</code><span class="sig-paren">(</span><em>initial_metadata</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#UnaryUnaryChannelRpc.send_initial_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryUnaryChannelRpc.send_initial_metadata" title="Permalink to this definition">¶</a></dt>
  785. <dd><p>Sends the RPC’s initial metadata to the system under test.</p>
  786. <table class="docutils field-list" frame="void" rules="none">
  787. <col class="field-name" />
  788. <col class="field-body" />
  789. <tbody valign="top">
  790. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>initial_metadata</strong> – The RPC’s initial metadata to be “sent” to
  791. the system under test.</td>
  792. </tr>
  793. </tbody>
  794. </table>
  795. </dd></dl>
  796. <dl class="method">
  797. <dt id="grpc_testing.UnaryUnaryChannelRpc.terminate">
  798. <code class="descname">terminate</code><span class="sig-paren">(</span><em>response</em>, <em>trailing_metadata</em>, <em>code</em>, <em>details</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#UnaryUnaryChannelRpc.terminate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryUnaryChannelRpc.terminate" title="Permalink to this definition">¶</a></dt>
  799. <dd><p>Terminates the RPC.</p>
  800. <table class="docutils field-list" frame="void" rules="none">
  801. <col class="field-name" />
  802. <col class="field-body" />
  803. <tbody valign="top">
  804. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  805. <li><strong>response</strong> – The response for the RPC.</li>
  806. <li><strong>trailing_metadata</strong> – The RPC’s trailing metadata.</li>
  807. <li><strong>code</strong> – The RPC’s status code.</li>
  808. <li><strong>details</strong> – The RPC’s status details.</li>
  809. </ul>
  810. </td>
  811. </tr>
  812. </tbody>
  813. </table>
  814. </dd></dl>
  815. </dd></dl>
  816. <dl class="class">
  817. <dt id="grpc_testing.UnaryUnaryServerRpc">
  818. <em class="property">class </em><code class="descclassname">grpc_testing.</code><code class="descname">UnaryUnaryServerRpc</code><a class="reference internal" href="_modules/grpc_testing.html#UnaryUnaryServerRpc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryUnaryServerRpc" title="Permalink to this definition">¶</a></dt>
  819. <dd><p>Fixture for a unary-unary RPC serviced by a system under test.</p>
  820. <p>Enables users to “play client” for the RPC.</p>
  821. <dl class="method">
  822. <dt id="grpc_testing.UnaryUnaryServerRpc.cancel">
  823. <code class="descname">cancel</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#UnaryUnaryServerRpc.cancel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryUnaryServerRpc.cancel" title="Permalink to this definition">¶</a></dt>
  824. <dd><p>Cancels the RPC.</p>
  825. </dd></dl>
  826. <dl class="method">
  827. <dt id="grpc_testing.UnaryUnaryServerRpc.initial_metadata">
  828. <code class="descname">initial_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#UnaryUnaryServerRpc.initial_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryUnaryServerRpc.initial_metadata" title="Permalink to this definition">¶</a></dt>
  829. <dd><p>Accesses the initial metadata emitted by the system under test.</p>
  830. <p>This method blocks until the system under test has added initial
  831. metadata to the RPC (or has provided one or more response messages or
  832. has terminated the RPC, either of which will cause gRPC Python to
  833. synthesize initial metadata for the RPC).</p>
  834. <table class="docutils field-list" frame="void" rules="none">
  835. <col class="field-name" />
  836. <col class="field-body" />
  837. <tbody valign="top">
  838. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The initial metadata for the RPC.</td>
  839. </tr>
  840. </tbody>
  841. </table>
  842. </dd></dl>
  843. <dl class="method">
  844. <dt id="grpc_testing.UnaryUnaryServerRpc.termination">
  845. <code class="descname">termination</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#UnaryUnaryServerRpc.termination"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.UnaryUnaryServerRpc.termination" title="Permalink to this definition">¶</a></dt>
  846. <dd><p>Blocks until the system under test has terminated the RPC.</p>
  847. <table class="docutils field-list" frame="void" rules="none">
  848. <col class="field-name" />
  849. <col class="field-body" />
  850. <tbody valign="top">
  851. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><dl class="docutils">
  852. <dt>A (response, trailing_metadata, code, details) sequence with the RPC’s</dt>
  853. <dd>response, trailing metadata, code, and details.</dd>
  854. </dl>
  855. </td>
  856. </tr>
  857. </tbody>
  858. </table>
  859. </dd></dl>
  860. </dd></dl>
  861. <dl class="function">
  862. <dt id="grpc_testing.channel">
  863. <code class="descclassname">grpc_testing.</code><code class="descname">channel</code><span class="sig-paren">(</span><em>service_descriptors</em>, <em>time</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#channel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.channel" title="Permalink to this definition">¶</a></dt>
  864. <dd><p>Creates a Channel for use in tests of a gRPC Python-using system.</p>
  865. <table class="docutils field-list" frame="void" rules="none">
  866. <col class="field-name" />
  867. <col class="field-body" />
  868. <tbody valign="top">
  869. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  870. <li><strong>service_descriptors</strong> – An iterable of descriptor.ServiceDescriptors
  871. describing the RPCs that will be made on the returned Channel by the
  872. system under test.</li>
  873. <li><strong>time</strong> – A Time to be used for tests.</li>
  874. </ul>
  875. </td>
  876. </tr>
  877. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A Channel for use in tests.</p>
  878. </td>
  879. </tr>
  880. </tbody>
  881. </table>
  882. </dd></dl>
  883. <dl class="function">
  884. <dt id="grpc_testing.server_from_dictionary">
  885. <code class="descclassname">grpc_testing.</code><code class="descname">server_from_dictionary</code><span class="sig-paren">(</span><em>descriptors_to_servicers</em>, <em>time</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#server_from_dictionary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.server_from_dictionary" title="Permalink to this definition">¶</a></dt>
  886. <dd><p>Creates a Server for use in tests of a gRPC Python-using system.</p>
  887. <table class="docutils field-list" frame="void" rules="none">
  888. <col class="field-name" />
  889. <col class="field-body" />
  890. <tbody valign="top">
  891. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  892. <li><strong>descriptors_to_servicers</strong> – A dictionary from descriptor.ServiceDescriptors
  893. defining RPC services to servicer objects (usually instances of classes
  894. that implement “Servicer” interfaces defined in generated “_pb2_grpc”
  895. modules) implementing those services.</li>
  896. <li><strong>time</strong> – A Time to be used for tests.</li>
  897. </ul>
  898. </td>
  899. </tr>
  900. <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A Server for use in tests.</p>
  901. </td>
  902. </tr>
  903. </tbody>
  904. </table>
  905. </dd></dl>
  906. <dl class="function">
  907. <dt id="grpc_testing.strict_fake_time">
  908. <code class="descclassname">grpc_testing.</code><code class="descname">strict_fake_time</code><span class="sig-paren">(</span><em>now</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#strict_fake_time"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.strict_fake_time" title="Permalink to this definition">¶</a></dt>
  909. <dd><p>Creates a Time that can be manipulated by test code.</p>
  910. <p>The returned instance maintains an internal representation of time
  911. independent of real time. This internal representation only advances
  912. when user code calls the instance’s sleep_for and sleep_until methods.</p>
  913. <p>The returned instance will be “strict” with respect to callbacks
  914. submitted to it: it will ensure that all callbacks registered to
  915. be called at time t have been called before it describes the time
  916. as having advanced beyond t.</p>
  917. <table class="docutils field-list" frame="void" rules="none">
  918. <col class="field-name" />
  919. <col class="field-body" />
  920. <tbody valign="top">
  921. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A Time that simulates the passage of time.</td>
  922. </tr>
  923. </tbody>
  924. </table>
  925. </dd></dl>
  926. <dl class="function">
  927. <dt id="grpc_testing.strict_real_time">
  928. <code class="descclassname">grpc_testing.</code><code class="descname">strict_real_time</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/grpc_testing.html#strict_real_time"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#grpc_testing.strict_real_time" title="Permalink to this definition">¶</a></dt>
  929. <dd><p>Creates a Time backed by the Python interpreter’s time.</p>
  930. <p>The returned instance will be “strict” with respect to callbacks
  931. submitted to it: it will ensure that all callbacks registered to
  932. be called at time t have been called before it describes the time
  933. as having advanced beyond t.</p>
  934. <table class="docutils field-list" frame="void" rules="none">
  935. <col class="field-name" />
  936. <col class="field-body" />
  937. <tbody valign="top">
  938. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A Time backed by the “system” (Python interpreter’s) time.</td>
  939. </tr>
  940. </tbody>
  941. </table>
  942. </dd></dl>
  943. </div>
  944. </div>
  945. </div>
  946. </div>
  947. </div>
  948. <div class="clearer"></div>
  949. </div>
  950. <div class="footer">
  951. &copy;2018, The gRPC Authors.
  952. |
  953. <a href="_sources/grpc_testing.rst.txt"
  954. rel="nofollow">Page source</a>
  955. </div>
  956. <script type="text/javascript">
  957. var _gaq = _gaq || [];
  958. _gaq.push(['_setAccount', 'UA-60127042-1']);
  959. _gaq.push(['_setDomainName', 'none']);
  960. _gaq.push(['_setAllowLinker', true]);
  961. _gaq.push(['_trackPageview']);
  962. (function() {
  963. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  964. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  965. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  966. })();
  967. </script>
  968. </body>
  969. </html>