| Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 1 | <?xml version="1.0" encoding="ascii"?> | 
 | 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | 
 | 3 |           "DTD/xhtml1-transitional.dtd"> | 
 | 4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | 
 | 5 | <head> | 
 | 6 |   <title>apiclient.http.HttpMockSequence</title> | 
 | 7 |   <link rel="stylesheet" href="epydoc.css" type="text/css" /> | 
 | 8 |   <script type="text/javascript" src="epydoc.js"></script> | 
 | 9 | </head> | 
 | 10 |  | 
 | 11 | <body bgcolor="white" text="black" link="blue" vlink="#204080" | 
 | 12 |       alink="#204080"> | 
 | 13 | <!-- ==================== NAVIGATION BAR ==================== --> | 
 | 14 | <table class="navbar" border="0" width="100%" cellpadding="0" | 
 | 15 |        bgcolor="#a0c0ff" cellspacing="0"> | 
 | 16 |   <tr valign="middle"> | 
 | 17 |  | 
 | 18 |   <!-- Tree link --> | 
 | 19 |       <th>   <a | 
 | 20 |         href="module-tree.html">Trees</a>   </th> | 
 | 21 |  | 
 | 22 |   <!-- Index link --> | 
 | 23 |       <th>   <a | 
 | 24 |         href="identifier-index.html">Indices</a>   </th> | 
 | 25 |  | 
 | 26 |   <!-- Help link --> | 
 | 27 |       <th>   <a | 
 | 28 |         href="help.html">Help</a>   </th> | 
 | 29 |  | 
 | 30 |       <th class="navbar" width="100%"></th> | 
 | 31 |   </tr> | 
 | 32 | </table> | 
 | 33 | <table width="100%" cellpadding="0" cellspacing="0"> | 
 | 34 |   <tr valign="top"> | 
 | 35 |     <td width="100%"> | 
 | 36 |       <span class="breadcrumbs"> | 
 | 37 |         <a href="apiclient-module.html">Package apiclient</a> :: | 
 | 38 |         <a href="apiclient.http-module.html">Module http</a> :: | 
 | 39 |         Class HttpMockSequence | 
 | 40 |       </span> | 
 | 41 |     </td> | 
 | 42 |     <td> | 
 | 43 |       <table cellpadding="0" cellspacing="0"> | 
 | 44 |         <!-- hide/show private --> | 
 | 45 |         <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink" | 
 | 46 |     onclick="toggle_private();">hide private</a>]</span></td></tr> | 
 | 47 |         <tr><td align="right"><span class="options" | 
 | 48 |             >[<a href="frames.html" target="_top">frames</a | 
 | 49 |             >] | <a href="apiclient.http.HttpMockSequence-class.html" | 
 | 50 |             target="_top">no frames</a>]</span></td></tr> | 
 | 51 |       </table> | 
 | 52 |     </td> | 
 | 53 |   </tr> | 
 | 54 | </table> | 
 | 55 | <!-- ==================== CLASS DESCRIPTION ==================== --> | 
 | 56 | <h1 class="epydoc">Class HttpMockSequence</h1><p class="nomargin-top"><span class="codelink"><a href="apiclient.http-pysrc.html#HttpMockSequence">source code</a></span></p> | 
 | 57 | <center> | 
| Joe Gregorio | 746096f | 2012-06-15 10:53:36 -0400 | [diff] [blame] | 58 | <center>  <map id="class_hierarchy_for_httpmockse" name="class_hierarchy_for_httpmockse"> | 
| Joe Gregorio | 52a5c53 | 2013-01-24 16:19:07 -0500 | [diff] [blame] | 59 | <area shape="rect" id="node1" href="apiclient.http.HttpMockSequence-class.html" title="HttpMockSequence" alt="" coords="5,6,141,34"/> | 
| Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 60 | </map> | 
| Joe Gregorio | 746096f | 2012-06-15 10:53:36 -0400 | [diff] [blame] | 61 |   <img src="class_hierarchy_for_httpmockse.gif" alt='' usemap="#class_hierarchy_for_httpmockse" ismap="ismap" class="graph-without-title" /> | 
| Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 62 | </center> | 
 | 63 | </center> | 
 | 64 | <hr /> | 
 | 65 | <pre class="literalblock"> | 
 | 66 | Mock of httplib2.Http | 
 | 67 |  | 
 | 68 | Mocks a sequence of calls to request returning different responses for each | 
 | 69 | call. Create an instance initialized with the desired response headers | 
 | 70 | and content and then use as if an httplib2.Http instance. | 
 | 71 |  | 
 | 72 |   http = HttpMockSequence([ | 
 | 73 |     ({'status': '401'}, ''), | 
 | 74 |     ({'status': '200'}, '{"access_token":"1/3w","expires_in":3600}'), | 
 | 75 |     ({'status': '200'}, 'echo_request_headers'), | 
 | 76 |     ]) | 
 | 77 |   resp, content = http.request("http://examples.com") | 
 | 78 |  | 
 | 79 | There are special values you can pass in for content to trigger | 
 | 80 | behavours that are helpful in testing. | 
 | 81 |  | 
 | 82 | 'echo_request_headers' means return the request headers in the response body | 
 | 83 | 'echo_request_headers_as_json' means return the request headers in | 
 | 84 |    the response body | 
 | 85 | 'echo_request_body' means return the request body in the response body | 
 | 86 | 'echo_request_uri' means return the request uri in the response body | 
 | 87 |  | 
 | 88 | </pre> | 
 | 89 |  | 
 | 90 | <!-- ==================== INSTANCE METHODS ==================== --> | 
 | 91 | <a name="section-InstanceMethods"></a> | 
 | 92 | <table class="summary" border="1" cellpadding="3" | 
 | 93 |        cellspacing="0" width="100%" bgcolor="white"> | 
 | 94 | <tr bgcolor="#70b0f0" class="table-header"> | 
 | 95 |   <td colspan="2" class="table-header"> | 
 | 96 |     <table border="0" cellpadding="0" cellspacing="0" width="100%"> | 
 | 97 |       <tr valign="top"> | 
 | 98 |         <td align="left"><span class="table-header">Instance Methods</span></td> | 
 | 99 |         <td align="right" valign="top" | 
 | 100 |          ><span class="options">[<a href="#section-InstanceMethods" | 
 | 101 |          class="privatelink" onclick="toggle_private();" | 
 | 102 |          >hide private</a>]</span></td> | 
 | 103 |       </tr> | 
 | 104 |     </table> | 
 | 105 |   </td> | 
 | 106 | </tr> | 
 | 107 | <tr> | 
 | 108 |     <td width="15%" align="right" valign="top" class="summary"> | 
 | 109 |       <span class="summary-type"> </span> | 
 | 110 |     </td><td class="summary"> | 
 | 111 |       <table width="100%" cellpadding="0" cellspacing="0" border="0"> | 
 | 112 |         <tr> | 
 | 113 |           <td><span class="summary-sig"><a href="apiclient.http.HttpMockSequence-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>, | 
 | 114 |         <span class="summary-sig-arg">iterable</span>)</span><br /> | 
 | 115 |       Args:...</td> | 
 | 116 |           <td align="right" valign="top"> | 
 | 117 |             <span class="codelink"><a href="apiclient.http-pysrc.html#HttpMockSequence.__init__">source code</a></span> | 
 | 118 |              | 
 | 119 |           </td> | 
 | 120 |         </tr> | 
 | 121 |       </table> | 
 | 122 |        | 
 | 123 |     </td> | 
 | 124 |   </tr> | 
 | 125 | <tr> | 
 | 126 |     <td width="15%" align="right" valign="top" class="summary"> | 
 | 127 |       <span class="summary-type"> </span> | 
 | 128 |     </td><td class="summary"> | 
 | 129 |       <table width="100%" cellpadding="0" cellspacing="0" border="0"> | 
 | 130 |         <tr> | 
 | 131 |           <td><span class="summary-sig"><a name="request"></a><span class="summary-sig-name">request</span>(<span class="summary-sig-arg">self</span>, | 
 | 132 |         <span class="summary-sig-arg">uri</span>, | 
| Joe Gregorio | f4839b0 | 2012-09-06 13:47:24 -0400 | [diff] [blame] | 133 |         <span class="summary-sig-arg">method</span>=<span class="summary-sig-default">'GET'</span>, | 
| Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 134 |         <span class="summary-sig-arg">body</span>=<span class="summary-sig-default">None</span>, | 
 | 135 |         <span class="summary-sig-arg">headers</span>=<span class="summary-sig-default">None</span>, | 
 | 136 |         <span class="summary-sig-arg">redirections</span>=<span class="summary-sig-default">1</span>, | 
 | 137 |         <span class="summary-sig-arg">connection_type</span>=<span class="summary-sig-default">None</span>)</span></td> | 
 | 138 |           <td align="right" valign="top"> | 
 | 139 |             <span class="codelink"><a href="apiclient.http-pysrc.html#HttpMockSequence.request">source code</a></span> | 
 | 140 |              | 
 | 141 |           </td> | 
 | 142 |         </tr> | 
 | 143 |       </table> | 
 | 144 |        | 
 | 145 |     </td> | 
 | 146 |   </tr> | 
 | 147 |   <tr> | 
 | 148 |     <td colspan="2" class="summary"> | 
 | 149 |     <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: | 
 | 150 |       <code>__delattr__</code>, | 
 | 151 |       <code>__format__</code>, | 
 | 152 |       <code>__getattribute__</code>, | 
 | 153 |       <code>__hash__</code>, | 
 | 154 |       <code>__new__</code>, | 
 | 155 |       <code>__reduce__</code>, | 
 | 156 |       <code>__reduce_ex__</code>, | 
 | 157 |       <code>__repr__</code>, | 
 | 158 |       <code>__setattr__</code>, | 
 | 159 |       <code>__sizeof__</code>, | 
 | 160 |       <code>__str__</code>, | 
 | 161 |       <code>__subclasshook__</code> | 
 | 162 |       </p> | 
 | 163 |     </td> | 
 | 164 |   </tr> | 
 | 165 | </table> | 
 | 166 | <!-- ==================== PROPERTIES ==================== --> | 
 | 167 | <a name="section-Properties"></a> | 
 | 168 | <table class="summary" border="1" cellpadding="3" | 
 | 169 |        cellspacing="0" width="100%" bgcolor="white"> | 
 | 170 | <tr bgcolor="#70b0f0" class="table-header"> | 
 | 171 |   <td colspan="2" class="table-header"> | 
 | 172 |     <table border="0" cellpadding="0" cellspacing="0" width="100%"> | 
 | 173 |       <tr valign="top"> | 
 | 174 |         <td align="left"><span class="table-header">Properties</span></td> | 
 | 175 |         <td align="right" valign="top" | 
 | 176 |          ><span class="options">[<a href="#section-Properties" | 
 | 177 |          class="privatelink" onclick="toggle_private();" | 
 | 178 |          >hide private</a>]</span></td> | 
 | 179 |       </tr> | 
 | 180 |     </table> | 
 | 181 |   </td> | 
 | 182 | </tr> | 
 | 183 |   <tr> | 
 | 184 |     <td colspan="2" class="summary"> | 
 | 185 |     <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: | 
 | 186 |       <code>__class__</code> | 
 | 187 |       </p> | 
 | 188 |     </td> | 
 | 189 |   </tr> | 
 | 190 | </table> | 
 | 191 | <!-- ==================== METHOD DETAILS ==================== --> | 
 | 192 | <a name="section-MethodDetails"></a> | 
 | 193 | <table class="details" border="1" cellpadding="3" | 
 | 194 |        cellspacing="0" width="100%" bgcolor="white"> | 
 | 195 | <tr bgcolor="#70b0f0" class="table-header"> | 
 | 196 |   <td colspan="2" class="table-header"> | 
 | 197 |     <table border="0" cellpadding="0" cellspacing="0" width="100%"> | 
 | 198 |       <tr valign="top"> | 
 | 199 |         <td align="left"><span class="table-header">Method Details</span></td> | 
 | 200 |         <td align="right" valign="top" | 
 | 201 |          ><span class="options">[<a href="#section-MethodDetails" | 
 | 202 |          class="privatelink" onclick="toggle_private();" | 
 | 203 |          >hide private</a>]</span></td> | 
 | 204 |       </tr> | 
 | 205 |     </table> | 
 | 206 |   </td> | 
 | 207 | </tr> | 
 | 208 | </table> | 
 | 209 | <a name="__init__"></a> | 
 | 210 | <div> | 
 | 211 | <table class="details" border="1" cellpadding="3" | 
 | 212 |        cellspacing="0" width="100%" bgcolor="white"> | 
 | 213 | <tr><td> | 
 | 214 |   <table width="100%" cellpadding="0" cellspacing="0" border="0"> | 
 | 215 |   <tr valign="top"><td> | 
 | 216 |   <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>, | 
 | 217 |         <span class="sig-arg">iterable</span>)</span> | 
 | 218 |     <br /><em class="fname">(Constructor)</em> | 
 | 219 |   </h3> | 
 | 220 |   </td><td align="right" valign="top" | 
 | 221 |     ><span class="codelink"><a href="apiclient.http-pysrc.html#HttpMockSequence.__init__">source code</a></span>  | 
 | 222 |     </td> | 
 | 223 |   </tr></table> | 
 | 224 |    | 
 | 225 |   <pre class="literalblock"> | 
 | 226 |  | 
 | 227 | Args: | 
 | 228 |   iterable: iterable, a sequence of pairs of (headers, body) | 
 | 229 |  | 
 | 230 | </pre> | 
 | 231 |   <dl class="fields"> | 
 | 232 |     <dt>Overrides: | 
 | 233 |         object.__init__ | 
 | 234 |     </dt> | 
 | 235 |   </dl> | 
 | 236 | </td></tr></table> | 
 | 237 | </div> | 
 | 238 | <br /> | 
 | 239 | <!-- ==================== NAVIGATION BAR ==================== --> | 
 | 240 | <table class="navbar" border="0" width="100%" cellpadding="0" | 
 | 241 |        bgcolor="#a0c0ff" cellspacing="0"> | 
 | 242 |   <tr valign="middle"> | 
 | 243 |  | 
 | 244 |   <!-- Tree link --> | 
 | 245 |       <th>   <a | 
 | 246 |         href="module-tree.html">Trees</a>   </th> | 
 | 247 |  | 
 | 248 |   <!-- Index link --> | 
 | 249 |       <th>   <a | 
 | 250 |         href="identifier-index.html">Indices</a>   </th> | 
 | 251 |  | 
 | 252 |   <!-- Help link --> | 
 | 253 |       <th>   <a | 
 | 254 |         href="help.html">Help</a>   </th> | 
 | 255 |  | 
 | 256 |       <th class="navbar" width="100%"></th> | 
 | 257 |   </tr> | 
 | 258 | </table> | 
 | 259 | <table border="0" cellpadding="0" cellspacing="0" width="100%%"> | 
 | 260 |   <tr> | 
 | 261 |     <td align="left" class="footer"> | 
| Joe Gregorio | 41be8e8 | 2013-03-07 10:31:47 -0500 | [diff] [blame^] | 262 |     Generated by Epydoc 3.0.1 on Thu Mar  7 10:31:23 2013 | 
| Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 263 |     </td> | 
 | 264 |     <td align="right" class="footer"> | 
 | 265 |       <a target="mainFrame" href="http://epydoc.sourceforge.net" | 
 | 266 |         >http://epydoc.sourceforge.net</a> | 
 | 267 |     </td> | 
 | 268 |   </tr> | 
 | 269 | </table> | 
 | 270 |  | 
 | 271 | <script type="text/javascript"> | 
 | 272 |   <!-- | 
 | 273 |   // Private objects are initially displayed (because if | 
 | 274 |   // javascript is turned off then we want them to be | 
 | 275 |   // visible); but by default, we want to hide them.  So hide | 
 | 276 |   // them unless we have a cookie that says to show them. | 
 | 277 |   checkCookie(); | 
 | 278 |   // --> | 
 | 279 | </script> | 
 | 280 | </body> | 
 | 281 | </html> |