<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/4520/">https://reviewboard.asterisk.org/r/4520/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On March 24th, 2015, 11:23 a.m. CDT, <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/4520/diff/1/?file=72752#file72752line53" style="color: black; font-weight: bold; text-decoration: underline;">./asterisk/trunk/tests/rest_api/applications/stasis_status/test_scenario_factory.py</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<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">53</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="c">#for name in ['Babs', 'Bugs', 'Buster', 'Furrball', 'Dizzy']:</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">54</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="p">[</span><span class="s">'Babs'</span><span class="p">,</span> <span class="s">'Bugs'</span><span class="p">,</span> <span class="s">'Buster'</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">55</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">client</span> <span class="o">=</span> <span class="n">AriClient</span><span class="p">(</span><span class="n">host</span><span class="p">,</span> <span class="n">port</span><span class="p">,</span> <span class="n">credentials</span><span class="p">,</span> <span class="n">name</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;">Rather than injecting a name, you can actually use the object type and - from it - use the name of the class as a unique way to identify the scenario:
for scenario in [BabsTestScenario, BugsTestScenario, BusterTestScenario]:
client = AriClient(host, port, credentials, scenario.__name__)
obj = scenario(client, ami)
scnearios.append(obj)
This lets you remove the name parameter passed to the TestScenario objects.</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;">Based on my comment above regarding the get_name() function, I think the cleanest way is to keep this pattern (for now).
Also, in the code above, the AriClient instance is created and then injected into the ctor for the TestScenario. So, the overriden value of 'name' is not available when the value is requested by the AriClient ctor, because the instance of TestScenario has not yet been created.
</pre>
<br />
<p>- Ashley</p>
<br />
<p>On March 22nd, 2015, 11:34 p.m. CDT, Ashley Sanders wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers.</div>
<div>By Ashley Sanders.</div>
<p style="color: grey;"><i>Updated March 22, 2015, 11:34 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://issues.asterisk.org/jira/browse/ASTERISK-24802">ASTERISK-24802</a>
</div>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
testsuite
</div>
<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;">When an error occurs while writing to a web socket, the web socket is disconnected and the event is logged. A side-effect of this, however, is that any application on the other side waiting for a response from Stasis is left hanging indefinitely (as there is no mechanism presently available for notifying interested parties about web socket error states in Stasis).
This patch introduces a new channel variable: STASIS_STATUS to give outside applications context when errors occur in Stasis that interrupt normal processing.
This test exercises three scenarios to elicit updates to the STASIS_STATUS channel variable:
1) The 'Babs' scenario: tests a nominal path of Stasis to verify the 'ACTIVE' state is correctly applied. For this test, a call is originated under normal conditions and then the system is polled for the value of STASIS_STATUS before the channel is hung up.
2) The 'Bugs' scenario: tests the situation where a call is originated requesting an app that was never registered in Stasis to verify the 'FAILED' state is correctly applied.
3) The 'Buster' scenario: tests the situation where an app that was registered in Stasis when call A was originated (and while call A is still active) but is no longer registered when call B is originated. Determines if the 'FAILED' state is correctly applied.
***Note*** This is a test. It is only a test. The review for the Asterisk source can be found at: https://reviewboard.asterisk.org/r/4519/</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/tests/rest_api/applications/tests.yaml <span style="color: grey">(6547)</span></li>
<li>./asterisk/trunk/tests/rest_api/applications/stasis_status/test_scenario_factory.py <span style="color: grey">(PRE-CREATION)</span></li>
<li>./asterisk/trunk/tests/rest_api/applications/stasis_status/test_scenario.py <span style="color: grey">(PRE-CREATION)</span></li>
<li>./asterisk/trunk/tests/rest_api/applications/stasis_status/test_case.py <span style="color: grey">(PRE-CREATION)</span></li>
<li>./asterisk/trunk/tests/rest_api/applications/stasis_status/test-config.yaml <span style="color: grey">(PRE-CREATION)</span></li>
<li>./asterisk/trunk/tests/rest_api/applications/stasis_status/run-test <span style="color: grey">(PRE-CREATION)</span></li>
<li>./asterisk/trunk/tests/rest_api/applications/stasis_status/observable_object.py <span style="color: grey">(PRE-CREATION)</span></li>
<li>./asterisk/trunk/tests/rest_api/applications/stasis_status/configs/ast1/sip.conf <span style="color: grey">(PRE-CREATION)</span></li>
<li>./asterisk/trunk/tests/rest_api/applications/stasis_status/configs/ast1/http.conf <span style="color: grey">(PRE-CREATION)</span></li>
<li>./asterisk/trunk/tests/rest_api/applications/stasis_status/configs/ast1/extensions.conf <span style="color: grey">(PRE-CREATION)</span></li>
<li>./asterisk/trunk/tests/rest_api/applications/stasis_status/configs/ast1/ari.conf <span style="color: grey">(PRE-CREATION)</span></li>
<li>./asterisk/trunk/tests/rest_api/applications/stasis_status/ari_client.py <span style="color: grey">(PRE-CREATION)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/4520/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>