[asterisk-commits] lib/python/asterisk/ari: Add a test start event module for ARI (testsuite[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 13 12:53:39 CDT 2015
Matt Jordan has submitted this change and it was merged.
Change subject: lib/python/asterisk/ari: Add a test start event module for ARI
......................................................................
lib/python/asterisk/ari: Add a test start event module for ARI
This patch adds a specific test start event module for the pluggable
frameworks's action/event pluggable module specific to ARI. It waits
until AMI has connected - which the ARI test object ensures occurs after
ARI is fully connected - before triggering subsequent ARI actions.
Change-Id: Icccc342de76dd2c085a2879f29c9e78029313f26
---
M lib/python/asterisk/ari.py
1 file changed, 25 insertions(+), 1 deletion(-)
Approvals:
Matt Jordan: Looks good to me, approved; Verified
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/lib/python/asterisk/ari.py b/lib/python/asterisk/ari.py
index 50c29fe..bb9c95c 100644
--- a/lib/python/asterisk/ari.py
+++ b/lib/python/asterisk/ari.py
@@ -742,6 +742,26 @@
PLUGGABLE_EVENT_REGISTRY.register("ari-events", ARIPluggableEventModule)
+class ARIPluggableStartModule(object):
+ """Pluggable ARI module that kicks off when Asterisk starts
+ """
+
+ def __init__(self, test_object, triggered_callback, config):
+ """Constructor"""
+
+ self.triggered_callback = triggered_callback
+ self.test_object = test_object
+
+ # AMI connects after ARI, so this should call back once we're
+ # good and ready
+ test_object.register_ami_observer(self.on_ami_connect)
+
+ def on_ami_connect(self, ami):
+ """AMI connect handler"""
+ self.triggered_callback(self, self.test_object.ari, None)
+PLUGGABLE_EVENT_REGISTRY.register("ari-start", ARIPluggableStartModule)
+
+
class ARIPluggableRequestModule(object):
"""Pluggable ARI action module.
"""
@@ -764,7 +784,11 @@
if request.delay:
reactor.callLater(request.delay, request.send, extra)
else:
- request.send(extra)
+ result = request.send(extra)
+ if isinstance(result, bool) and not result:
+ self.test_object.set_passed(False)
+ else:
+ self.test_object.set_passed(True)
PLUGGABLE_ACTION_REGISTRY.register("ari-requests", ARIPluggableRequestModule)
# vim:sw=4:ts=4:expandtab:textwidth=79
--
To view, visit https://gerrit.asterisk.org/842
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Icccc342de76dd2c085a2879f29c9e78029313f26
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
More information about the asterisk-commits
mailing list