[Asterisk-code-review] fax/pjsip/gateway t38 g711/run-test: Fix PEP8 errors (testsuite[13])

Jenkins2 asteriskteam at digium.com
Tue Jul 10 05:26:56 CDT 2018


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/9336 )

Change subject: fax/pjsip/gateway_t38_g711/run-test: Fix PEP8 errors
......................................................................

fax/pjsip/gateway_t38_g711/run-test: Fix PEP8 errors

Change-Id: Id2e9ec95e45125ce0e90f9af7899b236f9a68938
---
M tests/fax/pjsip/gateway_t38_g711/run-test
1 file changed, 75 insertions(+), 73 deletions(-)

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



diff --git a/tests/fax/pjsip/gateway_t38_g711/run-test b/tests/fax/pjsip/gateway_t38_g711/run-test
index fae14b1..980a01a 100755
--- a/tests/fax/pjsip/gateway_t38_g711/run-test
+++ b/tests/fax/pjsip/gateway_t38_g711/run-test
@@ -22,92 +22,94 @@
 
 logger = logging.getLogger(__name__)
 
+
 class GatewayTest(TestCase):
-   event_count = 0
-   success_count = 0
+    event_count = 0
+    success_count = 0
 
-   def __init__(self):
-      TestCase.__init__(self)
-      self.reactor_timeout = 120
-      self.create_asterisk(2)
+    def __init__(self):
+        TestCase.__init__(self)
+        self.reactor_timeout = 120
+        self.create_asterisk(2)
 
-      # copy the tiff file we are going to send to a good known location
-      shutil.copy("%s/send.tiff" % (os.path.dirname(os.path.realpath(__file__)),), "%s%s" % (self.ast[0].base, self.ast[0].directories['astdatadir']))
+        # copy the tiff file we are going to send to a good known location
+        shutil.copy("%s/send.tiff" % (os.path.dirname(os.path.realpath(__file__)),),
+                    "%s%s" % (self.ast[0].base, self.ast[0].directories['astdatadir']))
 
-   def ami_connect(self, ami):
-      if ami.id == 0:
+    def ami_connect(self, ami):
+        if ami.id == 0:
 
-         logger.info("sending a call from ast1 to ast2")
+            logger.info("sending a call from ast1 to ast2")
 
-         ami.registerEvent('UserEvent', self.fax_result)
-         df = ami.originate("PJSIP/ast2-t38/sip:1234 at 127.0.0.2", "sendfax", "1234", 1)
+            ami.registerEvent('UserEvent', self.fax_result)
+            df = ami.originate("PJSIP/ast2-t38/sip:1234 at 127.0.0.2",
+                               "sendfax", "1234", 1)
 
-         def handle_failure(reason):
-            logger.error("error sending originate:")
-            logger.error(reason.getTraceback())
+            def handle_failure(reason):
+                logger.error("error sending originate:")
+                logger.error(reason.getTraceback())
+                self.stop_reactor()
+
+                return reason
+
+            df.addErrback(handle_failure)
+        else:
+            ami.registerEvent('UserEvent', self.fax_gateway_result)
+
+    def fax_gateway_result(self, ami, event):
+        if event['userevent'] != 'FaxStatus':
+            return
+
+        self.event_count += 1
+
+        if event['status'] == "SUCCESS":
+            logger.info("successful gateway operation")
+            self.success_count += 1
+        else:
+            logger.error("gateway error:")
+            logger.error("status: %s" % (event['status'],))
+            logger.error("error: %s" % (event['error'],))
+            logger.error("statusstr: %s" % (event['statusstr'],))
+
+        self.are_we_there_yet()
+
+    def fax_result(self, ami, event):
+        if event['userevent'] != 'FaxStatus':
+            return
+
+        self.event_count += 1
+
+        if event['status'] == "SUCCESS":
+            logger.info("successful %s through gateway" % (event['operation'],))
+            self.success_count += 1
+        else:
+            logger.error("error sending fax through gateway:")
+            logger.error("operation: %s" % (event['operation'],))
+            logger.error("status: %s" % (event['status'],))
+            logger.error("error: %s" % (event['error'],))
+            logger.error("statusstr: %s" % (event['statusstr'],))
+
+        self.are_we_there_yet()
+
+    def are_we_there_yet(self):
+        if self.event_count == 3:
+            if self.success_count == 3:
+                self.passed = True
             self.stop_reactor()
 
-            return reason
-
-         df.addErrback(handle_failure)
-      else:
-         ami.registerEvent('UserEvent', self.fax_gateway_result)
-
-   def fax_gateway_result(self, ami, event):
-      if event['userevent'] != 'FaxStatus':
-         return
-
-      self.event_count += 1
-
-      if event['status'] == "SUCCESS":
-         logger.info("successful gateway operation")
-         self.success_count += 1
-      else:
-         logger.error("gateway error:")
-         logger.error("status: %s" % (event['status'],))
-         logger.error("error: %s" % (event['error'],))
-         logger.error("statusstr: %s" % (event['statusstr'],))
-
-      self.are_we_there_yet()
-
-   def fax_result(self, ami, event):
-      if event['userevent'] != 'FaxStatus':
-         return
-
-      self.event_count += 1
-
-      if event['status'] == "SUCCESS":
-         logger.info("successful %s through gateway" % (event['operation'],))
-         self.success_count += 1
-      else:
-         logger.error("error sending fax through gateway:")
-         logger.error("operation: %s" % (event['operation'],))
-         logger.error("status: %s" % (event['status'],))
-         logger.error("error: %s" % (event['error'],))
-         logger.error("statusstr: %s" % (event['statusstr'],))
-
-      self.are_we_there_yet()
-
-   def are_we_there_yet(self):
-      if self.event_count == 3:
-         if self.success_count == 3:
-            self.passed = True
-         self.stop_reactor()
-
-   def run(self):
-      TestCase.run(self)
-      self.create_ami_factory(2)
+    def run(self):
+        TestCase.run(self)
+        self.create_ami_factory(2)
 
 
 def main():
-   test = GatewayTest()
-   reactor.run()
+    test = GatewayTest()
+    reactor.run()
 
-   if not test.passed:
-      return 1
+    if not test.passed:
+        return 1
 
-   return 0
+    return 0
 
 if __name__ == "__main__":
-   sys.exit(main() or 0)
-
+    sys.exit(main() or 0)

-- 
To view, visit https://gerrit.asterisk.org/9336
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: Id2e9ec95e45125ce0e90f9af7899b236f9a68938
Gerrit-Change-Number: 9336
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180710/533ff608/attachment-0001.html>


More information about the asterisk-code-review mailing list