/usr/share/doc/python3-paste/docs/modules/fixture.html is in python3-paste 1.7.5.1-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>paste.fixture – Test applications — Paste 1.7.5.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.7.5.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Paste 1.7.5.1 documentation" href="../index.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Paste 1.7.5.1 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="paste-fixture-test-applications">
<h1><a class="toc-backref" href="#id5"><a class="reference internal" href="#module-paste.fixture" title="paste.fixture"><tt class="xref py py-mod docutils literal"><span class="pre">paste.fixture</span></tt></a> – Test applications</a><a class="headerlink" href="#paste-fixture-test-applications" title="Permalink to this headline">¶</a></h1>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#paste-fixture-test-applications" id="id5"><a class="reference internal" href="#module-paste.fixture" title="paste.fixture"><tt class="xref py py-mod docutils literal"><span class="pre">paste.fixture</span></tt></a> – Test applications</a><ul>
<li><a class="reference internal" href="#module-contents" id="id6">Module Contents</a></li>
<li><a class="reference internal" href="#forms" id="id7">Forms</a></li>
<li><a class="reference internal" href="#script-testing" id="id8">Script Testing</a></li>
</ul>
</li>
</ul>
</div>
<span class="target" id="module-paste.fixture"></span><p>Routines for testing WSGI applications.</p>
<p>Most interesting is the <a class="reference external" href="class-paste.fixture.TestApp.html">TestApp</a>
for testing WSGI applications, and the <a class="reference external" href="class-paste.fixture.TestFileEnvironment.html">TestFileEnvironment</a> class for testing the
effects of command-line scripts.</p>
<div class="section" id="module-contents">
<h2><a class="toc-backref" href="#id6">Module Contents</a><a class="headerlink" href="#module-contents" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="paste.fixture.TestApp">
<em class="property">class </em><tt class="descclassname">paste.fixture.</tt><tt class="descname">TestApp</tt><big>(</big><em>app</em>, <em>namespace=None</em>, <em>relative_to=None</em>, <em>extra_environ=None</em>, <em>pre_request_hook=None</em>, <em>post_request_hook=None</em><big>)</big><a class="headerlink" href="#paste.fixture.TestApp" title="Permalink to this definition">¶</a></dt>
<dd><dl class="method">
<dt id="paste.fixture.TestApp.delete">
<tt class="descname">delete</tt><big>(</big><em>url</em>, <em>params=''</em>, <em>headers=None</em>, <em>extra_environ=None</em>, <em>status=None</em>, <em>expect_errors=False</em><big>)</big><a class="headerlink" href="#paste.fixture.TestApp.delete" title="Permalink to this definition">¶</a></dt>
<dd><p>Do a DELETE request. Very like the <tt class="docutils literal"><span class="pre">.get()</span></tt> method.
<tt class="docutils literal"><span class="pre">params</span></tt> are put in the body of the request.</p>
<p>Returns a <a class="reference external" href="class-paste.fixture.TestResponse.html">response object</a></p>
</dd></dl>
<dl class="method">
<dt id="paste.fixture.TestApp.do_request">
<tt class="descname">do_request</tt><big>(</big><em>req</em>, <em>status</em><big>)</big><a class="headerlink" href="#paste.fixture.TestApp.do_request" title="Permalink to this definition">¶</a></dt>
<dd><p>Executes the given request (<tt class="docutils literal"><span class="pre">req</span></tt>), with the expected
<tt class="docutils literal"><span class="pre">status</span></tt>. Generally <tt class="docutils literal"><span class="pre">.get()</span></tt> and <tt class="docutils literal"><span class="pre">.post()</span></tt> are used
instead.</p>
</dd></dl>
<dl class="method">
<dt id="paste.fixture.TestApp.encode_multipart">
<tt class="descname">encode_multipart</tt><big>(</big><em>params</em>, <em>files</em><big>)</big><a class="headerlink" href="#paste.fixture.TestApp.encode_multipart" title="Permalink to this definition">¶</a></dt>
<dd><p>Encodes a set of parameters (typically a name/value list) and
a set of files (a list of (name, filename, file_body)) into a
typical POST body, returning the (content_type, body).</p>
</dd></dl>
<dl class="method">
<dt id="paste.fixture.TestApp.get">
<tt class="descname">get</tt><big>(</big><em>url</em>, <em>params=None</em>, <em>headers=None</em>, <em>extra_environ=None</em>, <em>status=None</em>, <em>expect_errors=False</em><big>)</big><a class="headerlink" href="#paste.fixture.TestApp.get" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the given url (well, actually a path like
<tt class="docutils literal"><span class="pre">'/page.html'</span></tt>).</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">params</span></tt>:</dt>
<dd>A query string, or a dictionary that will be encoded
into a query string. You may also include a query
string on the <tt class="docutils literal"><span class="pre">url</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">headers</span></tt>:</dt>
<dd>A dictionary of extra headers to send.</dd>
<dt><tt class="docutils literal"><span class="pre">extra_environ</span></tt>:</dt>
<dd>A dictionary of environmental variables that should
be added to the request.</dd>
<dt><tt class="docutils literal"><span class="pre">status</span></tt>:</dt>
<dd>The integer status code you expect (if not 200 or 3xx).
If you expect a 404 response, for instance, you must give
<tt class="docutils literal"><span class="pre">status=404</span></tt> or it will be an error. You can also give
a wildcard, like <tt class="docutils literal"><span class="pre">'3*'</span></tt> or <tt class="docutils literal"><span class="pre">'*'</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">expect_errors</span></tt>:</dt>
<dd>If this is not true, then if anything is written to
<tt class="docutils literal"><span class="pre">wsgi.errors</span></tt> it will be an error. If it is true, then
non-200/3xx responses are also okay.</dd>
</dl>
<p>Returns a <a class="reference external" href="class-paste.fixture.TestResponse.html">response object</a></p>
</dd></dl>
<dl class="method">
<dt id="paste.fixture.TestApp.post">
<tt class="descname">post</tt><big>(</big><em>url</em>, <em>params=''</em>, <em>headers=None</em>, <em>extra_environ=None</em>, <em>status=None</em>, <em>upload_files=None</em>, <em>expect_errors=False</em><big>)</big><a class="headerlink" href="#paste.fixture.TestApp.post" title="Permalink to this definition">¶</a></dt>
<dd><p>Do a POST request. Very like the <tt class="docutils literal"><span class="pre">.get()</span></tt> method.
<tt class="docutils literal"><span class="pre">params</span></tt> are put in the body of the request.</p>
<p><tt class="docutils literal"><span class="pre">upload_files</span></tt> is for file uploads. It should be a list of
<tt class="docutils literal"><span class="pre">[(fieldname,</span> <span class="pre">filename,</span> <span class="pre">file_content)]</span></tt>. You can also use
just <tt class="docutils literal"><span class="pre">[(fieldname,</span> <span class="pre">filename)]</span></tt> and the file content will be
read from disk.</p>
<p>Returns a <a class="reference external" href="class-paste.fixture.TestResponse.html">response object</a></p>
</dd></dl>
<dl class="method">
<dt id="paste.fixture.TestApp.put">
<tt class="descname">put</tt><big>(</big><em>url</em>, <em>params=''</em>, <em>headers=None</em>, <em>extra_environ=None</em>, <em>status=None</em>, <em>upload_files=None</em>, <em>expect_errors=False</em><big>)</big><a class="headerlink" href="#paste.fixture.TestApp.put" title="Permalink to this definition">¶</a></dt>
<dd><p>Do a PUT request. Very like the <tt class="docutils literal"><span class="pre">.get()</span></tt> method.
<tt class="docutils literal"><span class="pre">params</span></tt> are put in the body of the request.</p>
<p><tt class="docutils literal"><span class="pre">upload_files</span></tt> is for file uploads. It should be a list of
<tt class="docutils literal"><span class="pre">[(fieldname,</span> <span class="pre">filename,</span> <span class="pre">file_content)]</span></tt>. You can also use
just <tt class="docutils literal"><span class="pre">[(fieldname,</span> <span class="pre">filename)]</span></tt> and the file content will be
read from disk.</p>
<p>Returns a <a class="reference external" href="class-paste.fixture.TestResponse.html">response object</a></p>
</dd></dl>
<dl class="method">
<dt id="paste.fixture.TestApp.reset">
<tt class="descname">reset</tt><big>(</big><big>)</big><a class="headerlink" href="#paste.fixture.TestApp.reset" title="Permalink to this definition">¶</a></dt>
<dd><p>Resets the state of the application; currently just clears
saved cookies.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="paste.fixture.TestRequest">
<em class="property">class </em><tt class="descclassname">paste.fixture.</tt><tt class="descname">TestRequest</tt><big>(</big><em>url</em>, <em>environ</em>, <em>expect_errors=False</em><big>)</big><a class="headerlink" href="#paste.fixture.TestRequest" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</div>
<div class="section" id="forms">
<h2><a class="toc-backref" href="#id7">Forms</a><a class="headerlink" href="#forms" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="paste.fixture.Form">
<em class="property">class </em><tt class="descclassname">paste.fixture.</tt><tt class="descname">Form</tt><big>(</big><em>response</em>, <em>text</em><big>)</big><a class="headerlink" href="#paste.fixture.Form" title="Permalink to this definition">¶</a></dt>
<dd><p>This object represents a form that has been found in a page.
This has a couple useful attributes:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">text</span></tt>:</dt>
<dd>the full HTML of the form.</dd>
<dt><tt class="docutils literal"><span class="pre">action</span></tt>:</dt>
<dd>the relative URI of the action.</dd>
<dt><tt class="docutils literal"><span class="pre">method</span></tt>:</dt>
<dd>the method (e.g., <tt class="docutils literal"><span class="pre">'GET'</span></tt>).</dd>
<dt><tt class="docutils literal"><span class="pre">id</span></tt>:</dt>
<dd>the id, or None if not given.</dd>
<dt><tt class="docutils literal"><span class="pre">fields</span></tt>:</dt>
<dd>a dictionary of fields, each value is a list of fields by
that name. <tt class="docutils literal"><span class="pre"><input</span> <span class="pre">type="radio"></span></tt> and <tt class="docutils literal"><span class="pre"><select></span></tt> are
both represented as single fields with multiple options.</dd>
</dl>
<dl class="method">
<dt id="paste.fixture.Form.get">
<tt class="descname">get</tt><big>(</big><em>name</em>, <em>index=None</em>, <em>default=<class 'paste.fixture.NoDefault'></em><big>)</big><a class="headerlink" href="#paste.fixture.Form.get" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the named/indexed field object, or <tt class="docutils literal"><span class="pre">default</span></tt> if no field
is found.</p>
</dd></dl>
<dl class="method">
<dt id="paste.fixture.Form.select">
<tt class="descname">select</tt><big>(</big><em>name</em>, <em>value</em>, <em>index=None</em><big>)</big><a class="headerlink" href="#paste.fixture.Form.select" title="Permalink to this definition">¶</a></dt>
<dd><p>Like <tt class="docutils literal"><span class="pre">.set()</span></tt>, except also confirms the target is a
<tt class="docutils literal"><span class="pre"><select></span></tt>.</p>
</dd></dl>
<dl class="method">
<dt id="paste.fixture.Form.set">
<tt class="descname">set</tt><big>(</big><em>name</em>, <em>value</em>, <em>index=None</em><big>)</big><a class="headerlink" href="#paste.fixture.Form.set" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the given name, using <tt class="docutils literal"><span class="pre">index</span></tt> to disambiguate.</p>
</dd></dl>
<dl class="method">
<dt id="paste.fixture.Form.submit">
<tt class="descname">submit</tt><big>(</big><em>name=None</em>, <em>index=None</em>, <em>**args</em><big>)</big><a class="headerlink" href="#paste.fixture.Form.submit" title="Permalink to this definition">¶</a></dt>
<dd><p>Submits the form. If <tt class="docutils literal"><span class="pre">name</span></tt> is given, then also select that
button (using <tt class="docutils literal"><span class="pre">index</span></tt> to disambiguate)``.</p>
<p>Any extra keyword arguments are passed to the <tt class="docutils literal"><span class="pre">.get()</span></tt> or
<tt class="docutils literal"><span class="pre">.post()</span></tt> method.</p>
<p>Returns a response object.</p>
</dd></dl>
<dl class="method">
<dt id="paste.fixture.Form.submit_fields">
<tt class="descname">submit_fields</tt><big>(</big><em>name=None</em>, <em>index=None</em><big>)</big><a class="headerlink" href="#paste.fixture.Form.submit_fields" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of <tt class="docutils literal"><span class="pre">[(name,</span> <span class="pre">value),</span> <span class="pre">...]</span></tt> for the current
state of the form.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="paste.fixture.Field">
<em class="property">class </em><tt class="descclassname">paste.fixture.</tt><tt class="descname">Field</tt><big>(</big><em>form</em>, <em>tag</em>, <em>name</em>, <em>pos</em>, <em>value=None</em>, <em>id=None</em>, <em>**attrs</em><big>)</big><a class="headerlink" href="#paste.fixture.Field" title="Permalink to this definition">¶</a></dt>
<dd><p>Field object.</p>
<dl class="method">
<dt id="paste.fixture.Field.force_value">
<tt class="descname">force_value</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#paste.fixture.Field.force_value" title="Permalink to this definition">¶</a></dt>
<dd><p>Like setting a value, except forces it even for, say, hidden
fields.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="paste.fixture.Select">
<em class="property">class </em><tt class="descclassname">paste.fixture.</tt><tt class="descname">Select</tt><big>(</big><em>*args</em>, <em>**attrs</em><big>)</big><a class="headerlink" href="#paste.fixture.Select" title="Permalink to this definition">¶</a></dt>
<dd><p>Field representing <tt class="docutils literal"><span class="pre"><select></span></tt></p>
</dd></dl>
<dl class="class">
<dt id="paste.fixture.Radio">
<em class="property">class </em><tt class="descclassname">paste.fixture.</tt><tt class="descname">Radio</tt><big>(</big><em>*args</em>, <em>**attrs</em><big>)</big><a class="headerlink" href="#paste.fixture.Radio" title="Permalink to this definition">¶</a></dt>
<dd><p>Field representing <tt class="docutils literal"><span class="pre"><input</span> <span class="pre">type="radio"></span></tt></p>
</dd></dl>
<dl class="class">
<dt id="paste.fixture.Checkbox">
<em class="property">class </em><tt class="descclassname">paste.fixture.</tt><tt class="descname">Checkbox</tt><big>(</big><em>*args</em>, <em>**attrs</em><big>)</big><a class="headerlink" href="#paste.fixture.Checkbox" title="Permalink to this definition">¶</a></dt>
<dd><p>Field representing <tt class="docutils literal"><span class="pre"><input</span> <span class="pre">type="checkbox"></span></tt></p>
</dd></dl>
<dl class="class">
<dt id="paste.fixture.Text">
<em class="property">class </em><tt class="descclassname">paste.fixture.</tt><tt class="descname">Text</tt><big>(</big><em>form</em>, <em>tag</em>, <em>name</em>, <em>pos</em>, <em>value=''</em>, <em>id=None</em>, <em>**attrs</em><big>)</big><a class="headerlink" href="#paste.fixture.Text" title="Permalink to this definition">¶</a></dt>
<dd><p>Field representing <tt class="docutils literal"><span class="pre"><input</span> <span class="pre">type="text"></span></tt></p>
</dd></dl>
<dl class="class">
<dt id="paste.fixture.Textarea">
<em class="property">class </em><tt class="descclassname">paste.fixture.</tt><tt class="descname">Textarea</tt><big>(</big><em>form</em>, <em>tag</em>, <em>name</em>, <em>pos</em>, <em>value=''</em>, <em>id=None</em>, <em>**attrs</em><big>)</big><a class="headerlink" href="#paste.fixture.Textarea" title="Permalink to this definition">¶</a></dt>
<dd><p>Field representing <tt class="docutils literal"><span class="pre"><textarea></span></tt></p>
</dd></dl>
<dl class="class">
<dt id="paste.fixture.Hidden">
<em class="property">class </em><tt class="descclassname">paste.fixture.</tt><tt class="descname">Hidden</tt><big>(</big><em>form</em>, <em>tag</em>, <em>name</em>, <em>pos</em>, <em>value=''</em>, <em>id=None</em>, <em>**attrs</em><big>)</big><a class="headerlink" href="#paste.fixture.Hidden" title="Permalink to this definition">¶</a></dt>
<dd><p>Field representing <tt class="docutils literal"><span class="pre"><input</span> <span class="pre">type="hidden"></span></tt></p>
</dd></dl>
<dl class="class">
<dt id="paste.fixture.Submit">
<em class="property">class </em><tt class="descclassname">paste.fixture.</tt><tt class="descname">Submit</tt><big>(</big><em>form</em>, <em>tag</em>, <em>name</em>, <em>pos</em>, <em>value=None</em>, <em>id=None</em>, <em>**attrs</em><big>)</big><a class="headerlink" href="#paste.fixture.Submit" title="Permalink to this definition">¶</a></dt>
<dd><p>Field representing <tt class="docutils literal"><span class="pre"><input</span> <span class="pre">type="submit"></span></tt> and <tt class="docutils literal"><span class="pre"><button></span></tt></p>
</dd></dl>
</div>
<div class="section" id="script-testing">
<h2><a class="toc-backref" href="#id8">Script Testing</a><a class="headerlink" href="#script-testing" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="paste.fixture.TestFileEnvironment">
<em class="property">class </em><tt class="descclassname">paste.fixture.</tt><tt class="descname">TestFileEnvironment</tt><big>(</big><em>base_path</em>, <em>template_path=None</em>, <em>script_path=None</em>, <em>environ=None</em>, <em>cwd=None</em>, <em>start_clear=True</em>, <em>ignore_paths=None</em>, <em>ignore_hidden=True</em><big>)</big><a class="headerlink" href="#paste.fixture.TestFileEnvironment" title="Permalink to this definition">¶</a></dt>
<dd><p>This represents an environment in which files will be written, and
scripts will be run.</p>
<dl class="method">
<dt id="paste.fixture.TestFileEnvironment.clear">
<tt class="descname">clear</tt><big>(</big><big>)</big><a class="headerlink" href="#paste.fixture.TestFileEnvironment.clear" title="Permalink to this definition">¶</a></dt>
<dd><p>Delete all the files in the base directory.</p>
</dd></dl>
<dl class="method">
<dt id="paste.fixture.TestFileEnvironment.run">
<tt class="descname">run</tt><big>(</big><em>script</em>, <em>*args</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#paste.fixture.TestFileEnvironment.run" title="Permalink to this definition">¶</a></dt>
<dd><p>Run the command, with the given arguments. The <tt class="docutils literal"><span class="pre">script</span></tt>
argument can have space-separated arguments, or you can use
the positional arguments.</p>
<p>Keywords allowed are:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">expect_error</span></tt>: (default False)</dt>
<dd>Don’t raise an exception in case of errors</dd>
<dt><tt class="docutils literal"><span class="pre">expect_stderr</span></tt>: (default <tt class="docutils literal"><span class="pre">expect_error</span></tt>)</dt>
<dd>Don’t raise an exception if anything is printed to stderr</dd>
<dt><tt class="docutils literal"><span class="pre">stdin</span></tt>: (default <tt class="docutils literal"><span class="pre">""</span></tt>)</dt>
<dd>Input to the script</dd>
<dt><tt class="docutils literal"><span class="pre">printresult</span></tt>: (default True)</dt>
<dd>Print the result after running</dd>
<dt><tt class="docutils literal"><span class="pre">cwd</span></tt>: (default <tt class="docutils literal"><span class="pre">self.cwd</span></tt>)</dt>
<dd>The working directory to run in</dd>
</dl>
<p>Returns a <a class="reference external" href="class-paste.fixture.ProcResponse.html">ProcResponse</a> object.</p>
</dd></dl>
<dl class="method">
<dt id="paste.fixture.TestFileEnvironment.writefile">
<tt class="descname">writefile</tt><big>(</big><em>path</em>, <em>content=None</em>, <em>frompath=None</em><big>)</big><a class="headerlink" href="#paste.fixture.TestFileEnvironment.writefile" title="Permalink to this definition">¶</a></dt>
<dd><p>Write a file to the given path. If <tt class="docutils literal"><span class="pre">content</span></tt> is given then
that text is written, otherwise the file in <tt class="docutils literal"><span class="pre">frompath</span></tt> is
used. <tt class="docutils literal"><span class="pre">frompath</span></tt> is relative to <tt class="docutils literal"><span class="pre">self.template_path</span></tt></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="paste.fixture.ProcResult">
<em class="property">class </em><tt class="descclassname">paste.fixture.</tt><tt class="descname">ProcResult</tt><big>(</big><em>test_env</em>, <em>args</em>, <em>stdin</em>, <em>stdout</em>, <em>stderr</em>, <em>returncode</em>, <em>files_before</em>, <em>files_after</em><big>)</big><a class="headerlink" href="#paste.fixture.ProcResult" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents the results of running a command in
<a class="reference external" href="class-paste.fixture.TestFileEnvironment.html">TestFileEnvironment</a>.</p>
<p>Attributes to pay particular attention to:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">stdout</span></tt>, <tt class="docutils literal"><span class="pre">stderr</span></tt>:</dt>
<dd>What is produced</dd>
<dt><tt class="docutils literal"><span class="pre">files_created</span></tt>, <tt class="docutils literal"><span class="pre">files_deleted</span></tt>, <tt class="docutils literal"><span class="pre">files_updated</span></tt>:</dt>
<dd>Dictionaries mapping filenames (relative to the <tt class="docutils literal"><span class="pre">base_dir</span></tt>)
to <a class="reference external" href="class-paste.fixture.FoundFile.html">FoundFile</a> or
<a class="reference external" href="class-paste.fixture.FoundDir.html">FoundDir</a> objects.</dd>
</dl>
</dd></dl>
<dl class="class">
<dt id="paste.fixture.FoundFile">
<em class="property">class </em><tt class="descclassname">paste.fixture.</tt><tt class="descname">FoundFile</tt><big>(</big><em>base_path</em>, <em>path</em><big>)</big><a class="headerlink" href="#paste.fixture.FoundFile" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a single file found as the result of a command.</p>
<p>Has attributes:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">path</span></tt>:</dt>
<dd>The path of the file, relative to the <tt class="docutils literal"><span class="pre">base_path</span></tt></dd>
<dt><tt class="docutils literal"><span class="pre">full</span></tt>:</dt>
<dd>The full path</dd>
<dt><tt class="docutils literal"><span class="pre">stat</span></tt>:</dt>
<dd>The results of <tt class="docutils literal"><span class="pre">os.stat</span></tt>. Also <tt class="docutils literal"><span class="pre">mtime</span></tt> and <tt class="docutils literal"><span class="pre">size</span></tt>
contain the <tt class="docutils literal"><span class="pre">.st_mtime</span></tt> and <tt class="docutils literal"><span class="pre">st_size</span></tt> of the stat.</dd>
<dt><tt class="docutils literal"><span class="pre">bytes</span></tt>:</dt>
<dd>The contents of the file.</dd>
</dl>
<p>You may use the <tt class="docutils literal"><span class="pre">in</span></tt> operator with these objects (tested against
the contents of the file), and the <tt class="docutils literal"><span class="pre">.mustcontain()</span></tt> method.</p>
</dd></dl>
<dl class="class">
<dt id="paste.fixture.FoundDir">
<em class="property">class </em><tt class="descclassname">paste.fixture.</tt><tt class="descname">FoundDir</tt><big>(</big><em>base_path</em>, <em>path</em><big>)</big><a class="headerlink" href="#paste.fixture.FoundDir" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a directory created by a command.</p>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#"><tt class="docutils literal"><span class="pre">paste.fixture</span></tt> – Test applications</a><ul>
<li><a class="reference internal" href="#module-contents">Module Contents</a></li>
<li><a class="reference internal" href="#forms">Forms</a></li>
<li><a class="reference internal" href="#script-testing">Script Testing</a></li>
</ul>
</li>
</ul>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/fixture.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Paste 1.7.5.1 documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2008, Ian Bicking.
Last updated on Sep 19, 2013.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>
|