<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/1671/">https://reviewboard.asterisk.org/r/1671/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On January 16th, 2012, 9:13 a.m., <b>Matt Jordan</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/1671/diff/2/?file=23174#file23174line125" style="color: black; font-weight: bold; text-decoration: underline;">asterisk/trunk/lib/python/asterisk/CDRTestCase.py</a>
<span style="font-weight: normal;">
(Diff revision 2)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">def ami_logoff(self, ami):</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">124</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">TestCase</span><span class="o">.</span><span class="n">ami_connect</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ami</span><span class="p">)</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">125</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">ami</span><span class="o">.</span><span class="n">registerEvent</span><span class="p">(</span><span class="s">"Hangup"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">ami_test_done</span><span class="p">)</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Granted, ami_connect doesn't do anything in TestCase right now - but its probably not a bad idea to keep this, in case any behavior is added to the base class that all derived classes need... such as your hangup checking code</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Mm.. you're probably right. Best practice is to: either replace 'pass' there with 'raise NotImplementedError' or calling the parent method like you suggest. I'll take a quick peek later to see which is best.</pre>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On January 16th, 2012, 9:13 a.m., <b>Matt Jordan</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/1671/diff/2/?file=23174#file23174line131" style="color: black; font-weight: bold; text-decoration: underline;">asterisk/trunk/lib/python/asterisk/CDRTestCase.py</a>
<span style="font-weight: normal;">
(Diff revision 2)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">def ami_logoff(self, ami):</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">131</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">def</span> <span class="nf">ami_test_done</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ami</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">132</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="k">if</span> <span class="n">event</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">"event"</span><span class="p">)</span> <span class="o">==</span> <span class="s">"Hangup"</span><span class="p">:</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Speaking of which - why don't we put this in TestCase? I can't see how this will hurt any of the current tests, as it doesn't stop the test if any channels are still up and running and doing work. I know we have a few other tests that simply wait for their reactors to time out - this has the potential to speed up a bunch of tests.</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I was reluctant to do that immediately. I was planning on looking at the other tests once these were out of the way. (Moving the no_active_channels method to TestCase is a likely next step, but I planned on doing that whenever it's really needed in a non-CDR-test.)
In the CDRTestCase there is always one call (series of channels), so this should be fine.
For the TestCase there might very well be no call at all OR possibly a series of sequential calls (in which case this could break), so this is probably *not* a good default.</pre>
<br />
<p>- wdoekes</p>
<br />
<p>On January 15th, 2012, 3:16 p.m., wdoekes wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers.</div>
<div>By wdoekes.</div>
<p style="color: grey;"><i>Updated Jan. 15, 2012, 3:16 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Most CDR test cases simply waited for the reactor timeout to fire. Only the tests that had a failing call were terminated in a timely fashion.
Add a check for the Hangup and count 0 active channels.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">5 out of 8 CDR tests run faster now.
Before:
--> Running test 'tests/cdr/console_dial_sip_busy' ...
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="1" time="3.40">
--> Cannot run test 'tests/cdr/console_dial_sip_transfer'
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="0" time="0.00"/>
--> Running test 'tests/cdr/console_dial_sip_answer' ...
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="1" time="33.28">
--> Running test 'tests/cdr/cdr_unanswered_yes' ...
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="1" time="3.60">
--> Running test 'tests/cdr/console_dial_sip_congestion' ...
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="1" time="3.44">
--> Running test 'tests/cdr/console_fork_after_busy_forward' ...
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="1" time="33.25">
--> Cannot run test 'tests/cdr/cdr_originate_sip_congestion_log'
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="0" time="0.00"/>
--> Running test 'tests/cdr/console_fork_before_dial' ...
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="1" time="33.21">
--> Running test 'tests/cdr/cdr_userfield' ...
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="1" time="33.21">
--> Running test 'tests/cdr/nocdr' ...
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="1" time="33.21">
After:
--> Running test 'tests/cdr/console_dial_sip_busy' ...
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="1" time="4.55">
--> Cannot run test 'tests/cdr/console_dial_sip_transfer'
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="0" time="0.00"/>
--> Running test 'tests/cdr/console_dial_sip_answer' ...
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="1" time="4.26">
--> Running test 'tests/cdr/cdr_unanswered_yes' ...
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="1" time="3.62">
--> Running test 'tests/cdr/console_dial_sip_congestion' ...
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="1" time="5.10">
--> Running test 'tests/cdr/console_fork_after_busy_forward' ...
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="1" time="5.05">
--> Cannot run test 'tests/cdr/cdr_originate_sip_congestion_log'
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="0" time="0.00"/>
--> Running test 'tests/cdr/console_fork_before_dial' ...
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="1" time="7.78">
--> Running test 'tests/cdr/cdr_userfield' ...
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="1" time="4.06">
--> Running test 'tests/cdr/nocdr' ...
<testsuite errors="0" failures="0" name="AsteriskTestSuite" tests="1" time="3.95"></pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>asterisk/trunk/lib/python/asterisk/CDRTestCase.py <span style="color: grey">(2991)</span></li>
<li>asterisk/trunk/lib/python/asterisk/asterisk.py <span style="color: grey">(2991)</span></li>
<li>asterisk/trunk/tests/cdr/console_dial_sip_answer/run-test <span style="color: grey">(2991)</span></li>
<li>asterisk/trunk/tests/cdr/console_dial_sip_busy/run-test <span style="color: grey">(2991)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/1671/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>