grpc_testing.html 61 KB

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