This file is indexed.

/usr/share/doc/python-webtest-doc/testresponse.html is in python-webtest-doc 2.0.24-1.

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
<!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>TestResponse &#8212; WebTest 2.0.24 documentation</title>
    
    <link rel="stylesheet" href="_static/nature.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '2.0.24',
        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="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="top" title="WebTest 2.0.24 documentation" href="index.html" />
    <link rel="up" title="Functional Testing of Web Applications" href="webtest.html" />
    <link rel="next" title="Form handling" href="forms.html" />
    <link rel="prev" title="TestApp" href="testapp.html" /> 
  </head>
  <body role="document">
    <div class="related" role="navigation" aria-label="related navigation">
      <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 class="right" >
          <a href="forms.html" title="Form handling"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="testapp.html" title="TestApp"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">WebTest 2.0.24 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="webtest.html" accesskey="U">Functional Testing of Web Applications</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="testresponse">
<h1>TestResponse<a class="headerlink" href="#testresponse" title="Permalink to this headline"></a></h1>
<p>The response object is based on <code class="xref py py-class docutils literal"><span class="pre">webob.response.Response</span></code> with some additions
to help with testing.</p>
<p>The inherited attributes that are most interesting:</p>
<dl class="docutils">
<dt><code class="docutils literal"><span class="pre">response.status</span></code>:</dt>
<dd>The text status of the response, e.g., <code class="docutils literal"><span class="pre">&quot;200</span> <span class="pre">OK&quot;</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">response.status_int</span></code>:</dt>
<dd>The text status_int of the response, e.g., <code class="docutils literal"><span class="pre">200</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">response.headers</span></code>:</dt>
<dd>A dictionary-like object of the headers in the response.</dd>
<dt><code class="docutils literal"><span class="pre">response.body</span></code>:</dt>
<dd>The text body of the response.</dd>
<dt><code class="docutils literal"><span class="pre">response.text</span></code>:</dt>
<dd>The unicode text body of the response.</dd>
<dt><code class="docutils literal"><span class="pre">response.normal_body</span></code>:</dt>
<dd>The whitespace-normalized <a class="footnote-reference" href="#whitespace-normalized" id="id1">[1]</a> body of the response.</dd>
<dt><code class="docutils literal"><span class="pre">response.request</span></code>:</dt>
<dd>The <code class="xref py py-class docutils literal"><span class="pre">webob.request.BaseRequest</span></code> object used to generate
this response.</dd>
</dl>
<p>The added methods:</p>
<dl class="docutils">
<dt><code class="docutils literal"><span class="pre">response.follow(**kw)</span></code>:</dt>
<dd>Follows the redirect, returning the new response.  It is an error
if this response wasn&#8217;t a redirect. All keyword arguments are
passed to <a class="reference internal" href="api.html#webtest.app.TestApp" title="webtest.app.TestApp"><code class="xref py py-class docutils literal"><span class="pre">webtest.app.TestApp</span></code></a> (e.g., <code class="docutils literal"><span class="pre">status</span></code>). Returns
another response object.</dd>
<dt><code class="docutils literal"><span class="pre">response.maybe_follow(**kw)</span></code>:</dt>
<dd>Follows all redirects; does nothing if this response
is not a redirect. All keyword arguments are passed
to <a class="reference internal" href="api.html#webtest.app.TestApp" title="webtest.app.TestApp"><code class="xref py py-class docutils literal"><span class="pre">webtest.app.TestApp</span></code></a> (e.g., <code class="docutils literal"><span class="pre">status</span></code>). Returns another
response object.</dd>
<dt><code class="docutils literal"><span class="pre">x</span> <span class="pre">in</span> <span class="pre">response</span></code>:</dt>
<dd>Returns True if the string is found in the response body.
Whitespace is normalized for this test.</dd>
<dt><code class="docutils literal"><span class="pre">response.mustcontain(string1,</span> <span class="pre">string2,</span> <span class="pre">no=string3)</span></code>:</dt>
<dd>Raises an error if any of the strings are not found in the
response.  If a string of a string list is given as <cite>no</cite> keyword
argument, raise an error if one of those are found in the
response.  It also prints out the response in that case, so you
can see the real response.</dd>
<dt><code class="docutils literal"><span class="pre">response.showbrowser()</span></code>:</dt>
<dd>Opens the HTML response in a browser; useful for debugging.</dd>
<dt><code class="docutils literal"><span class="pre">str(response)</span></code>:</dt>
<dd>Gives a slightly-compacted version of the response.  This is
compacted to remove newlines, making it easier to use with
<a class="reference external" href="http://python.org/doc/current/lib/module-doctest.html">doctest</a></dd>
<dt><code class="docutils literal"><span class="pre">response.click(description=None,</span> <span class="pre">linkid=None,</span> <span class="pre">href=None,</span> <span class="pre">anchor=None,</span> <span class="pre">index=None,</span> <span class="pre">verbose=False)</span></code>:</dt>
<dd>Clicks the described link (see <a class="reference internal" href="api.html#webtest.response.TestResponse.click" title="webtest.response.TestResponse.click"><code class="xref py py-meth docutils literal"><span class="pre">click()</span></code></a>)</dd>
<dt><code class="docutils literal"><span class="pre">response.forms</span></code>:</dt>
<dd>Return a dictionary of forms; you can use both indexes (refer to
the forms in order) or the string ids of forms (if you&#8217;ve given
them ids) to identify the form. See <a class="reference internal" href="forms.html"><span class="doc">Form handling</span></a> for more on the form
objects.</dd>
<dt><code class="docutils literal"><span class="pre">response.form</span></code>:</dt>
<dd>If there is just a single form, this returns that.  It is an error
if you use this and there are multiple forms.</dd>
</dl>
<p class="rubric">Footnotes</p>
<table class="docutils footnote" frame="void" id="whitespace-normalized" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>The whitespace normalization replace sequences of whitespace characters and <code class="docutils literal"><span class="pre">\n</span></code> <code class="docutils literal"><span class="pre">\r</span></code> <code class="docutils literal"><span class="pre">\t</span></code> by a single space.</td></tr>
</tbody>
</table>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="forms.html">Form handling</a><ul>
<li class="toctree-l2"><a class="reference internal" href="forms.html#getting-a-form">Getting a form</a></li>
<li class="toctree-l2"><a class="reference internal" href="forms.html#filling-a-form">Filling a form</a></li>
<li class="toctree-l2"><a class="reference internal" href="forms.html#field-types">Field types</a><ul>
<li class="toctree-l3"><a class="reference internal" href="forms.html#input-and-textarea-fields">Input and textarea fields</a></li>
<li class="toctree-l3"><a class="reference internal" href="forms.html#select-fields">Select fields</a></li>
<li class="toctree-l3"><a class="reference internal" href="forms.html#checkbox">Checkbox</a></li>
<li class="toctree-l3"><a class="reference internal" href="forms.html#radio">Radio</a></li>
<li class="toctree-l3"><a class="reference internal" href="forms.html#file">File</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="forms.html#submit-a-form">Submit a form</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="parsing-the-body">
<h2>Parsing the Body<a class="headerlink" href="#parsing-the-body" title="Permalink to this headline"></a></h2>
<p>There are several ways to get parsed versions of the response.  These
are the attributes:</p>
<dl class="docutils">
<dt><code class="docutils literal"><span class="pre">response.html</span></code>:</dt>
<dd><p class="first">Return a <a class="reference external" href="http://www.crummy.com/software/BeautifulSoup/">BeautifulSoup</a> version of the
response body:</p>
<div class="last highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">res</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;/index.html&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">res</span><span class="o">.</span><span class="n">html</span>
<span class="go">&lt;html&gt;&lt;body&gt;&lt;div id=&quot;content&quot;&gt;hey!&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">res</span><span class="o">.</span><span class="n">html</span><span class="o">.</span><span class="n">__class__</span>
<span class="go">&lt;class &#39;...BeautifulSoup&#39;&gt;</span>
</pre></div>
</div>
</dd>
<dt><code class="docutils literal"><span class="pre">response.xml</span></code>:</dt>
<dd><p class="first">Return an <a class="reference external" href="http://python.org/doc/current/lib/module-xml.etree.ElementTree.html">ElementTree</a>
version of the response body:</p>
<div class="last highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">res</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;/document.xml&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">res</span><span class="o">.</span><span class="n">xml</span>
<span class="go">&lt;Element &#39;xml&#39; ...&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">res</span><span class="o">.</span><span class="n">xml</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">tag</span>
<span class="go">&#39;message&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">res</span><span class="o">.</span><span class="n">xml</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">text</span>
<span class="go">&#39;hey!&#39;</span>
</pre></div>
</div>
</dd>
<dt><code class="docutils literal"><span class="pre">response.lxml</span></code>:</dt>
<dd><p class="first">Return an <a class="reference external" href="http://codespeak.net/lxml/">lxml</a> version of the
response body:</p>
<div class="last highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">res</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;/index.html&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">res</span><span class="o">.</span><span class="n">lxml</span>
<span class="go">&lt;Element html at ...&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">res</span><span class="o">.</span><span class="n">lxml</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s1">&#39;//body/div&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">text</span>
<span class="go">&#39;hey!&#39;</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">res</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;/document.xml&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">res</span><span class="o">.</span><span class="n">lxml</span>
<span class="go">&lt;Element xml at ...&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">res</span><span class="o">.</span><span class="n">lxml</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">tag</span>
<span class="go">&#39;message&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">res</span><span class="o">.</span><span class="n">lxml</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">text</span>
<span class="go">&#39;hey!&#39;</span>
</pre></div>
</div>
</dd>
<dt><code class="docutils literal"><span class="pre">response.pyquery</span></code>:</dt>
<dd><p class="first">Return an <a class="reference external" href="http://pypi.python.org/pypi/pyquery">PyQuery</a> version of the
response body:</p>
<div class="last highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">res</span><span class="o">.</span><span class="n">pyquery</span><span class="p">(</span><span class="s1">&#39;message&#39;</span><span class="p">)</span>
<span class="go">[&lt;message&gt;]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">res</span><span class="o">.</span><span class="n">pyquery</span><span class="p">(</span><span class="s1">&#39;message&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">text</span><span class="p">()</span>
<span class="go">&#39;hey!&#39;</span>
</pre></div>
</div>
</dd>
<dt><code class="docutils literal"><span class="pre">response.json</span></code>:</dt>
<dd><p class="first">Return the parsed JSON (parsed with <a class="reference external" href="http://svn.red-bean.com/bob/simplejson/tags/simplejson-1.7/docs/index.html">simplejson</a>):</p>
<div class="last highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">res</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;/object.json&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">sorted</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">json</span><span class="o">.</span><span class="n">values</span><span class="p">())</span>
<span class="go">[1, 2]</span>
</pre></div>
</div>
</dd>
</dl>
<p>In each case the content-type must be correct or an AttributeError is
raised.  If you do not have the necessary library installed (none of
them are required by WebTest), you will get an ImportError.</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">TestResponse</a><ul>
<li><a class="reference internal" href="#parsing-the-body">Parsing the Body</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="testapp.html"
                        title="previous chapter">TestApp</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="forms.html"
                        title="next chapter">Form handling</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/testresponse.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <div><input type="text" name="q" /></div>
      <div><input type="submit" value="Go" /></div>
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <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 class="right" >
          <a href="forms.html" title="Form handling"
             >next</a> |</li>
        <li class="right" >
          <a href="testapp.html" title="TestApp"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">WebTest 2.0.24 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="webtest.html" >Functional Testing of Web Applications</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2016, Ian Bicking.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.9.
    </div>
  </body>
</html>