grpc_testing.html 59 KB

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