[svn-commits] mmichelson: branch mmichelson/phone-testsuite r3110 - in /asterisk/team/mmich...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Mar 20 18:35:21 CDT 2012


Author: mmichelson
Date: Tue Mar 20 18:35:19 2012
New Revision: 3110

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3110
Log:
Add initial func_presencstate test.

Not operating correctly right now due to some setup issue on my end.


Added:
    asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/
    asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/configs/
    asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/configs/extensions.conf   (with props)
    asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/run_test   (with props)
    asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/test-config.yaml   (with props)
Modified:
    asterisk/team/mmichelson/phone-testsuite/tests/tests.yaml

Added: asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/configs/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/configs/extensions.conf?view=auto&rev=3110
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/configs/extensions.conf (added)
+++ asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/configs/extensions.conf Tue Mar 20 18:35:19 2012
@@ -1,0 +1,84 @@
+[nominal1]
+exten => 1,1,Set(pass=1)
+same => n,Set(PRESENCESTATE(CustomPresence:bob)=away,down the hall,Quarterly financial meeting)
+same => n,GotoIf($[${PRESENCESTATE(CustomPresence:bob,value)} = away]?:fail)
+same => n,GotoIf($[${PRESENCESTATE(CustomPresence:bob,subtype)} = down the hall]?:fail)
+same => n,GotoIf($[${PRESENCESTATE(CustomPresence:bob,message)} = Quarterly financial meeting]?:fail
+same => n,Hangup
+same => n(fail),Set(pass=0)
+same => n,Hangup
+ 
+exten => h,1,UserEvent(Presence,Pass: ${pass})
+
+[nominal2]
+exten => 1,1,Set(pass=1)
+same => N,Set(PRESENCESTATE(CustomPresence:bob)=away,down the hall,Quarterly financial meeting)
+same => n,GotoIf($[${PRESENCESTATE(CustomPresence:bob,value)} = away]?:fail)
+same => n,GotoIf($[${PRESENCESTATE(CustomPresence:bob,subtype)} = down the hall]?:fail)
+same => n,GotoIf($[${PRESENCESTATE(CustomPresence:bob,message)} = Quarterly financial meeting]?:fail
+same => n,Set(PRESENCESTATE(CustomPresence:bob)=available)
+same => n,GotoIf($[${PRESENCESTATE(CustomPresence:bob,value)} = away]?:fail)
+same => n,GotoIf($["${PRESENCESTATE(CustomPresence:bob,subtype)}" = ""]?:fail)
+same => n,GotoIf($["${PRESENCESTATE(CustomPresence:bob,message)}" = ""]?:fail
+same => n,Hangup
+same => n(fail),Set(pass=0)
+same => n,Hangup
+ 
+exten => h,1,UserEvent(Presence,Pass: ${pass})
+
+[base64read]
+exten => 1,1,Set(pass=1)
+same => n,Set(PRESENCESTATE(CustomPresence:bob)=away,down the hall,Quarterly financial meeting)
+;Note the value is not base64-encoded even if 'e' is specified as an option.
+same => n,GotoIf($[${PRESENCESTATE(CustomPresence:bob,value,e)} = away]?:fail)
+same => n,GotoIf($[${PRESENCESTATE(CustomPresence:bob,subtype,e)} = ${BASE64_ENCODE(down the hall)}]?:fail)
+same => n,GotoIf($[${PRESENCESTATE(CustomPresence:bob,message,e)} = ${BASE64_ENCODE(Quarterly financial meeting)}]?:fail
+same => n,Hangup
+same => n(fail),Set(pass=0)
+same => n,Hangup
+
+exten => h,1,UserEvent(Presence,Pass: ${pass})
+
+[base64write]
+exten => 1,1,Set(pass=1)
+same => n,Set(PRESENCESTATE(CustomPresence:bob,e)=away,down the hall,Quarterly financial meeting)
+same => n,GotoIf($[${DB_EXISTS(CustomPresence/bob)} = 0]?:fail)
+same => n,Set(ARRAY(value,subtype,message)=${DB(CustomPresence/bob)})
+same => n,GotoIf($[${value)} = away]?:fail)
+same => n,GotoIf($[${subtype)} = ${BASE64_ENCODE(down the hall)}]?:fail)
+same => n,GotoIf($[${message)} = ${BASE64_ENCODE(Quarterly financial meeting)}]?:fail
+same => n,Hangup
+same => n(fail),Set(pass=0)
+same => n,Hangup
+
+exten => h,1,UserEvent(Presence,Pass: ${pass})
+
+[no_parameter]
+exten => 1,1,Set(pass=1)
+same => n,Set(PRESENCESTATE()=away,down the hall,Quarterly financial meeting)
+same => n,Set(pass=0)
+ 
+exten => h,1,UserEvent(Presence,Pass: ${pass})
+
+[invalid_provider]
+exten => 1,1,Set(pass=1)
+same => n,Set(PRESENCESTATE(CostumePresence:bob)=away,down the hall,Quarterly financial meeting)
+same => n,Set(pass=0)
+ 
+exten => h,1,UserEvent(Presence,Pass: ${pass})
+
+[no_field]
+exten => 1,1,Set(pass=1)
+same => n,Set(PRESENCESTATE(CustomPresence:bob)=away,down the hall,Quarterly financial meeting)
+same => n,Set(invalid=PRESENCESTATE(CustomPresence:bob))
+same => n,Set(pass=0)
+ 
+exten => h,1,UserEvent(Presence,Pass: ${pass})
+
+[invalid_field]
+exten => 1,1,Set(pass=1)
+same => n,Set(PRESENCESTATE(CustomPresence:bob)=away,down the hall,Quarterly financial meeting)
+same => n,Set(invalid=PRESENCESTATE(CustomPresence:bob,mood))
+same => n,Set(pass=0)
+ 
+e

Propchange: asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/configs/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/configs/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/configs/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/run_test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/run_test?view=auto&rev=3110
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/run_test (added)
+++ asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/run_test Tue Mar 20 18:35:19 2012
@@ -1,0 +1,62 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2012, Digium, Inc.
+Mark Michelson <mmichelson at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+sys.path.append("lib/python")
+
+from twisted.internet import reactor
+
+from asterisk.asterisk import Asterisk
+from asterisk.TestCase import TestCase
+
+class func_presencestate_test(TestCase):
+    def __init__(self):
+        TestCase.__init__(self)
+        self.create_asterisk()
+        self.contexts = [
+            "nominal1",
+            "nominal2",
+            "base64read",
+            "base64write",
+            "no_parameter",
+            "invalid_parameter",
+            "no_field",
+            "invalid_field"]
+    
+    def passOrFail(self):
+        if not event.get("userevent").lower == "presence":
+            return
+
+        if event.get("Pass") == "0":
+            self.passed = False
+            reactor.stop()
+		else:
+			print("Test case passed")
+
+    def ami_connect(self, ami):
+        self.ami[0].registerEvent("UserEvent", self.passOrFail)
+        for context in self.contexts:
+            self.ami[0].originate(channel = "Local/1@%s" %(context), application = "Echo")
+
+    def run(self):
+        TestCase.run(self)
+        self.create_ami_factory()
+
+def main():
+    test = func_presencestate_test()
+    test.start_asterisk()
+    reactor.run()
+    test.stop_asterisk()
+
+    if not test.passed:
+        return 1
+    return 0
+
+if __name__ == "__main__":
+    sys.exit(main() or 0)

Propchange: asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/run_test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/run_test
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/run_test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/test-config.yaml?view=auto&rev=3110
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/test-config.yaml (added)
+++ asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/test-config.yaml Tue Mar 20 18:35:19 2012
@@ -1,0 +1,11 @@
+testinfo:
+    summary:     'Test func_presencestate for correctness'
+    description: |
+        'This test exercises the PRESENCSTATE dialplan function
+        to be certain that the results obtained are what are expected.'
+
+properties:
+    minversion: '1.8'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'

Propchange: asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/team/mmichelson/phone-testsuite/tests/func_presencestate/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/team/mmichelson/phone-testsuite/tests/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/tests.yaml?view=diff&rev=3110&r1=3109&r2=3110
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/tests.yaml (original)
+++ asterisk/team/mmichelson/phone-testsuite/tests/tests.yaml Tue Mar 20 18:35:19 2012
@@ -29,3 +29,4 @@
     - dir: 'apps'
     - dir: 'connected_line'
     - dir: 'redirecting'
+    - test: 'func_presencestate'




More information about the svn-commits mailing list