<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/9341">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">fax/pjsip/gateway_t38_g711/run-test: Fix PEP8 errors<br><br>Change-Id: Id2e9ec95e45125ce0e90f9af7899b236f9a68938<br>---<br>M tests/fax/pjsip/gateway_t38_g711/run-test<br>1 file changed, 75 insertions(+), 73 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/tests/fax/pjsip/gateway_t38_g711/run-test b/tests/fax/pjsip/gateway_t38_g711/run-test</span><br><span>index fae14b1..980a01a 100755</span><br><span>--- a/tests/fax/pjsip/gateway_t38_g711/run-test</span><br><span>+++ b/tests/fax/pjsip/gateway_t38_g711/run-test</span><br><span>@@ -22,92 +22,94 @@</span><br><span> </span><br><span> logger = logging.getLogger(__name__)</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> class GatewayTest(TestCase):</span><br><span style="color: hsl(0, 100%, 40%);">- event_count = 0</span><br><span style="color: hsl(0, 100%, 40%);">- success_count = 0</span><br><span style="color: hsl(120, 100%, 40%);">+ event_count = 0</span><br><span style="color: hsl(120, 100%, 40%);">+ success_count = 0</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- def __init__(self):</span><br><span style="color: hsl(0, 100%, 40%);">- TestCase.__init__(self)</span><br><span style="color: hsl(0, 100%, 40%);">- self.reactor_timeout = 120</span><br><span style="color: hsl(0, 100%, 40%);">- self.create_asterisk(2)</span><br><span style="color: hsl(120, 100%, 40%);">+ def __init__(self):</span><br><span style="color: hsl(120, 100%, 40%);">+ TestCase.__init__(self)</span><br><span style="color: hsl(120, 100%, 40%);">+ self.reactor_timeout = 120</span><br><span style="color: hsl(120, 100%, 40%);">+ self.create_asterisk(2)</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- # copy the tiff file we are going to send to a good known location</span><br><span style="color: hsl(0, 100%, 40%);">- shutil.copy("%s/send.tiff" % (os.path.dirname(os.path.realpath(__file__)),), "%s%s" % (self.ast[0].base, self.ast[0].directories['astdatadir']))</span><br><span style="color: hsl(120, 100%, 40%);">+ # copy the tiff file we are going to send to a good known location</span><br><span style="color: hsl(120, 100%, 40%);">+ shutil.copy("%s/send.tiff" % (os.path.dirname(os.path.realpath(__file__)),),</span><br><span style="color: hsl(120, 100%, 40%);">+ "%s%s" % (self.ast[0].base, self.ast[0].directories['astdatadir']))</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- def ami_connect(self, ami):</span><br><span style="color: hsl(0, 100%, 40%);">- if ami.id == 0:</span><br><span style="color: hsl(120, 100%, 40%);">+ def ami_connect(self, ami):</span><br><span style="color: hsl(120, 100%, 40%);">+ if ami.id == 0:</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- logger.info("sending a call from ast1 to ast2")</span><br><span style="color: hsl(120, 100%, 40%);">+ logger.info("sending a call from ast1 to ast2")</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ami.registerEvent('UserEvent', self.fax_result)</span><br><span style="color: hsl(0, 100%, 40%);">- df = ami.originate("PJSIP/ast2-t38/sip:1234@127.0.0.2", "sendfax", "1234", 1)</span><br><span style="color: hsl(120, 100%, 40%);">+ ami.registerEvent('UserEvent', self.fax_result)</span><br><span style="color: hsl(120, 100%, 40%);">+ df = ami.originate("PJSIP/ast2-t38/sip:1234@127.0.0.2",</span><br><span style="color: hsl(120, 100%, 40%);">+ "sendfax", "1234", 1)</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- def handle_failure(reason):</span><br><span style="color: hsl(0, 100%, 40%);">- logger.error("error sending originate:")</span><br><span style="color: hsl(0, 100%, 40%);">- logger.error(reason.getTraceback())</span><br><span style="color: hsl(120, 100%, 40%);">+ def handle_failure(reason):</span><br><span style="color: hsl(120, 100%, 40%);">+ logger.error("error sending originate:")</span><br><span style="color: hsl(120, 100%, 40%);">+ logger.error(reason.getTraceback())</span><br><span style="color: hsl(120, 100%, 40%);">+ self.stop_reactor()</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return reason</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ df.addErrback(handle_failure)</span><br><span style="color: hsl(120, 100%, 40%);">+ else:</span><br><span style="color: hsl(120, 100%, 40%);">+ ami.registerEvent('UserEvent', self.fax_gateway_result)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ def fax_gateway_result(self, ami, event):</span><br><span style="color: hsl(120, 100%, 40%);">+ if event['userevent'] != 'FaxStatus':</span><br><span style="color: hsl(120, 100%, 40%);">+ return</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ self.event_count += 1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if event['status'] == "SUCCESS":</span><br><span style="color: hsl(120, 100%, 40%);">+ logger.info("successful gateway operation")</span><br><span style="color: hsl(120, 100%, 40%);">+ self.success_count += 1</span><br><span style="color: hsl(120, 100%, 40%);">+ else:</span><br><span style="color: hsl(120, 100%, 40%);">+ logger.error("gateway error:")</span><br><span style="color: hsl(120, 100%, 40%);">+ logger.error("status: %s" % (event['status'],))</span><br><span style="color: hsl(120, 100%, 40%);">+ logger.error("error: %s" % (event['error'],))</span><br><span style="color: hsl(120, 100%, 40%);">+ logger.error("statusstr: %s" % (event['statusstr'],))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ self.are_we_there_yet()</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ def fax_result(self, ami, event):</span><br><span style="color: hsl(120, 100%, 40%);">+ if event['userevent'] != 'FaxStatus':</span><br><span style="color: hsl(120, 100%, 40%);">+ return</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ self.event_count += 1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if event['status'] == "SUCCESS":</span><br><span style="color: hsl(120, 100%, 40%);">+ logger.info("successful %s through gateway" % (event['operation'],))</span><br><span style="color: hsl(120, 100%, 40%);">+ self.success_count += 1</span><br><span style="color: hsl(120, 100%, 40%);">+ else:</span><br><span style="color: hsl(120, 100%, 40%);">+ logger.error("error sending fax through gateway:")</span><br><span style="color: hsl(120, 100%, 40%);">+ logger.error("operation: %s" % (event['operation'],))</span><br><span style="color: hsl(120, 100%, 40%);">+ logger.error("status: %s" % (event['status'],))</span><br><span style="color: hsl(120, 100%, 40%);">+ logger.error("error: %s" % (event['error'],))</span><br><span style="color: hsl(120, 100%, 40%);">+ logger.error("statusstr: %s" % (event['statusstr'],))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ self.are_we_there_yet()</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ def are_we_there_yet(self):</span><br><span style="color: hsl(120, 100%, 40%);">+ if self.event_count == 3:</span><br><span style="color: hsl(120, 100%, 40%);">+ if self.success_count == 3:</span><br><span style="color: hsl(120, 100%, 40%);">+ self.passed = True</span><br><span> self.stop_reactor()</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- return reason</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- df.addErrback(handle_failure)</span><br><span style="color: hsl(0, 100%, 40%);">- else:</span><br><span style="color: hsl(0, 100%, 40%);">- ami.registerEvent('UserEvent', self.fax_gateway_result)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- def fax_gateway_result(self, ami, event):</span><br><span style="color: hsl(0, 100%, 40%);">- if event['userevent'] != 'FaxStatus':</span><br><span style="color: hsl(0, 100%, 40%);">- return</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- self.event_count += 1</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if event['status'] == "SUCCESS":</span><br><span style="color: hsl(0, 100%, 40%);">- logger.info("successful gateway operation")</span><br><span style="color: hsl(0, 100%, 40%);">- self.success_count += 1</span><br><span style="color: hsl(0, 100%, 40%);">- else:</span><br><span style="color: hsl(0, 100%, 40%);">- logger.error("gateway error:")</span><br><span style="color: hsl(0, 100%, 40%);">- logger.error("status: %s" % (event['status'],))</span><br><span style="color: hsl(0, 100%, 40%);">- logger.error("error: %s" % (event['error'],))</span><br><span style="color: hsl(0, 100%, 40%);">- logger.error("statusstr: %s" % (event['statusstr'],))</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- self.are_we_there_yet()</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- def fax_result(self, ami, event):</span><br><span style="color: hsl(0, 100%, 40%);">- if event['userevent'] != 'FaxStatus':</span><br><span style="color: hsl(0, 100%, 40%);">- return</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- self.event_count += 1</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if event['status'] == "SUCCESS":</span><br><span style="color: hsl(0, 100%, 40%);">- logger.info("successful %s through gateway" % (event['operation'],))</span><br><span style="color: hsl(0, 100%, 40%);">- self.success_count += 1</span><br><span style="color: hsl(0, 100%, 40%);">- else:</span><br><span style="color: hsl(0, 100%, 40%);">- logger.error("error sending fax through gateway:")</span><br><span style="color: hsl(0, 100%, 40%);">- logger.error("operation: %s" % (event['operation'],))</span><br><span style="color: hsl(0, 100%, 40%);">- logger.error("status: %s" % (event['status'],))</span><br><span style="color: hsl(0, 100%, 40%);">- logger.error("error: %s" % (event['error'],))</span><br><span style="color: hsl(0, 100%, 40%);">- logger.error("statusstr: %s" % (event['statusstr'],))</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- self.are_we_there_yet()</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- def are_we_there_yet(self):</span><br><span style="color: hsl(0, 100%, 40%);">- if self.event_count == 3:</span><br><span style="color: hsl(0, 100%, 40%);">- if self.success_count == 3:</span><br><span style="color: hsl(0, 100%, 40%);">- self.passed = True</span><br><span style="color: hsl(0, 100%, 40%);">- self.stop_reactor()</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- def run(self):</span><br><span style="color: hsl(0, 100%, 40%);">- TestCase.run(self)</span><br><span style="color: hsl(0, 100%, 40%);">- self.create_ami_factory(2)</span><br><span style="color: hsl(120, 100%, 40%);">+ def run(self):</span><br><span style="color: hsl(120, 100%, 40%);">+ TestCase.run(self)</span><br><span style="color: hsl(120, 100%, 40%);">+ self.create_ami_factory(2)</span><br><span> </span><br><span> </span><br><span> def main():</span><br><span style="color: hsl(0, 100%, 40%);">- test = GatewayTest()</span><br><span style="color: hsl(0, 100%, 40%);">- reactor.run()</span><br><span style="color: hsl(120, 100%, 40%);">+ test = GatewayTest()</span><br><span style="color: hsl(120, 100%, 40%);">+ reactor.run()</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if not test.passed:</span><br><span style="color: hsl(0, 100%, 40%);">- return 1</span><br><span style="color: hsl(120, 100%, 40%);">+ if not test.passed:</span><br><span style="color: hsl(120, 100%, 40%);">+ return 1</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- return 0</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0</span><br><span> </span><br><span> if __name__ == "__main__":</span><br><span style="color: hsl(0, 100%, 40%);">- sys.exit(main() or 0)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+ sys.exit(main() or 0)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9341">change 9341</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9341"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Id2e9ec95e45125ce0e90f9af7899b236f9a68938 </div>
<div style="display:none"> Gerrit-Change-Number: 9341 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>