/usr/share/doc/iptables-optimizer-doc/html/unittests.html is in iptables-optimizer-doc 0.9.13-2.
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 | <!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>iptables_optimizer_tests.py - unittests — iptables-optimizer 0.9.13 documentation</title>
<link rel="stylesheet" href="_static/cloud.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Noticia+Text|Open+Sans|Droid+Sans+Mono" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.9.13',
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>
<script type="text/javascript" src="_static/cloud.js"></script>
<link rel="top" title="iptables-optimizer 0.9.13 documentation" href="index.html" />
<link rel="next" title="iptables-optimizer - python classes" href="sources.html" />
<link rel="prev" title="iptables-optimizer-tests.sh - shell tests" href="shunit2.html" />
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="relbar-top">
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="py-modindex.html" title="Python Module Index"
>modules</a></li>
<li class="right" >
<a href="sources.html" title="iptables-optimizer - python classes"
accesskey="N">next</a> </li>
<li class="right" >
<a href="shunit2.html" title="iptables-optimizer-tests.sh - shell tests"
accesskey="P">previous</a> </li>
<li><a href="index.html">iptables-optimizer 0.9.13 documentation</a> »</li>
</ul>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="iptables-optimizer-tests-py-unittests">
<h1>iptables_optimizer_tests.py - unittests<a class="headerlink" href="#iptables-optimizer-tests-py-unittests" title="Permalink to this headline">¶</a></h1>
<div class="section" id="nosetests">
<h2>nosetests<a class="headerlink" href="#nosetests" title="Permalink to this headline">¶</a></h2>
<p>The two python classes come along with some unittests.
A reference-input file is present as it is needed to run the tests.
The prepared nosetests show like this:</p>
<div class="highlight-python"><div class="highlight"><pre>nostests -v --with-coverage
Chain_Test: create a chainobject ... ok
Chain_Test: make partitions from no rules ... ok
Chain_Test: make partitions from one rule a ... ok
Chain_Test: make partitions from one rule d ... ok
Chain_Test: make partitions from one rule r ... ok
Chain_Test: make partitions from one rule l ... ok
Chain_Test: make partitions from two rules aa ... ok
Chain_Test: make partitions from two rules ad ... ok
Chain_Test: make partitions from five rules adaaa ... ok
Chain_Test: optimize an empty chainobject ... ok
Chain_Test: optimize three rules aaa ... ok
Chain_Test: optimize three rules aar ... ok
Chain_Test: optimize five rules aalaa ... ok
Filter_Test: non existant input-file ... ok
Filter_Test: read reference-input ... ok
Filter_Test: optimize, check 30 moves and partitions ... ok
Filter_Test: check output for reference-input ... ok
Name Stmts Miss Cover Missing
--------------------------------------------------
iptables_optimizer 167 15 91% 33-34, 162-163, 236-246
----------------------------------------------------------------------
Ran 17 tests in 0.048s
OK
</pre></div>
</div>
<p>The missing statements are the following:</p>
<div class="highlight-python"><div class="highlight"><pre> 33 except:
34 pass # python2.6
162 except:
163 self.chains = {} # python2.6
236 file_to_read = "reference-input"
237 if len(sys.argv) > 1:
238 file_to_read = sys.argv[1]
239 try:
240 f = Filter(filename=file_to_read)
241 result, msg = f.opti()
242 sys.stderr.write(msg) # print partition-table to stderr
243 outmsg = f.show()
244 print(outmsg),
245 except KeyboardInterrupt as err:
246 print("\rUser stopped, execution terminated")
</pre></div>
</div>
<p>That’s not perfect, but it seems to be sufficient.</p>
</div>
<div class="section" id="tox">
<h2>tox<a class="headerlink" href="#tox" title="Permalink to this headline">¶</a></h2>
<p>This is done with the operating systems standard python. For
your convenience, a <strong>tox.ini</strong> is present as well for
tests using different python versions, for now these are
Python2.7 and Python3.4 which are used in debian jessie.</p>
</div>
<div class="section" id="pep-8">
<h2>pep 8<a class="headerlink" href="#pep-8" title="Permalink to this headline">¶</a></h2>
<p>tox runs a pep 8 test as well, there are no complains.</p>
<p>Testing is great fun.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"><div class="sphinxlocaltoc">
<h3><a href="index.html">Page contents</a></h3>
<ul>
<li><a class="reference internal" href="#">iptables_optimizer_tests.py - unittests</a><ul>
<li><a class="reference internal" href="#nosetests">nosetests</a></li>
<li><a class="reference internal" href="#tox">tox</a></li>
<li><a class="reference internal" href="#pep-8">pep 8</a></li>
</ul>
</li>
</ul>
</div>
<div class="sphinxprev">
<h4>Previous page</h4>
<p class="topless"><a href="shunit2.html"
title="Previous page">← iptables-optimizer-tests.sh - shell tests</a></p>
</div>
<div class="sphinxnext">
<h4>Next page</h4>
<p class="topless"><a href="sources.html"
title="Next page">→ iptables-optimizer - python classes</a></p>
</div>
<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="relbar-bottom">
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="py-modindex.html" title="Python Module Index"
>modules</a></li>
<li class="right" >
<a href="sources.html" title="iptables-optimizer - python classes"
>next</a> </li>
<li class="right" >
<a href="shunit2.html" title="iptables-optimizer-tests.sh - shell tests"
>previous</a> </li>
<li><a href="index.html">iptables-optimizer 0.9.13 documentation</a> »</li>
</ul>
</div>
</div>
<div class="footer">
© Copyright 2014, 2015, Johannes Hubertz.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
</div>
<!-- cloud_sptheme 1.4 -->
</body>
</html>
|