[asterisk-commits] mjordan: testsuite/asterisk/trunk r4706 - in /asterisk/trunk/tests/apps: ./ a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Feb 15 22:04:29 CST 2014


Author: mjordan
Date: Sat Feb 15 22:04:25 2014
New Revision: 4706

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4706
Log:
agent_login: Add two basic tests for the AgentLogin application

This patch adds two basic tests for AgentLogin:
* A nominal test verifies that an agent can log in successfully and enter
  the pool.
* A test that verifies that login errors are caught by the application.
  The login_errors test checks to see if the following scenarios work as
  intended:
  1. An agent logs in successfully and is placed in the pool. The same
     agent then attempts to log in while already logged in, causing
     AGENT_STATUS to return ALREADY_LOGGED_IN.
  2. An invalid agent login attempt, causing AGENT_STATUS to return INVALID.

Note that this test was written by Ben Ford.

Review: https://reviewboard.asterisk.org/r/3219/

Added:
    asterisk/trunk/tests/apps/agents/
    asterisk/trunk/tests/apps/agents/agent_login/
    asterisk/trunk/tests/apps/agents/agent_login/login_errors/
    asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/
    asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/
    asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/agents.conf   (with props)
    asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/apps/agents/agent_login/login_errors/test-config.yaml   (with props)
    asterisk/trunk/tests/apps/agents/agent_login/nominal/
    asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/
    asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/
    asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/agents.conf   (with props)
    asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/apps/agents/agent_login/nominal/test-config.yaml   (with props)
    asterisk/trunk/tests/apps/agents/agent_login/tests.yaml   (with props)
    asterisk/trunk/tests/apps/agents/tests.yaml   (with props)
Modified:
    asterisk/trunk/tests/apps/tests.yaml

Added: asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/agents.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/agents.conf?view=auto&rev=4706
==============================================================================
--- asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/agents.conf (added)
+++ asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/agents.conf Sat Feb 15 22:04:25 2014
@@ -1,0 +1,3 @@
+[1000]
+
+fullname=James Bond

Propchange: asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/agents.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/agents.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/agents.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/extensions.conf?view=auto&rev=4706
==============================================================================
--- asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/extensions.conf Sat Feb 15 22:04:25 2014
@@ -1,0 +1,56 @@
+; Tests basic AgentLogin errors.
+[default]
+
+; ----------------------------------------------------------------------
+; ***Required***
+; ----------------------------------------------------------------------
+
+exten => sendDTMF,1,NoOp()
+	same => n,Verbose(1, Sending DTMF Signal ${DTMF_TO_SEND})
+	same => n,SendDTMF(${DTMF_TO_SEND})
+	same => n,Goto(caller,wait,1)
+
+exten => sendAudio,1,NoOp()
+	same => n,Verbose(1, Sending audio file ${TALK_AUDIO})
+	same => n,Playback(${TALK_AUDIO})
+	same => n,Goto(caller,wait,1)
+
+exten => sendAudioWithDTMF,1,NoOp()
+	same => n,Verbose(1, Sending audio file ${TALK_AUDIO})
+	same => n,Playback(${TALK_AUDIO})
+	same => n,Verbose(1, Sending DTMF Signal ${DTMF_TO_SEND})
+	same => n,SendDTMF(${DTMF_TO_SEND})
+	same => n,Goto(caller,wait,1)
+
+exten => hangup,1,NoOp()
+	same => n,Verbose(1, Hanging up)
+	same => n,Hangup()
+
+exten => wait,1,NoOp()
+	same => n,Wait(10000)
+
+; ----------------------------------------------------------------------
+; Tests to see if an invalid agent login returns AGENT_STATUS = INVALID.
+; ----------------------------------------------------------------------
+exten => invalid-login,1,NoOp()
+    same => n,Answer()
+    same => n,AgentLogin(4321)
+    same => n,ExecIf($[${AGENT_STATUS}=INVALID]?UserEvent(InvalidLogin,result:pass))
+    same => n,Hangup()
+
+; ----------------------------------------------------------------------
+; A valid agent logs in and enters the pool.
+; ----------------------------------------------------------------------
+exten => valid-login,1,NoOp()
+    same => n,Answer()
+    same => n,AgentLogin(1000)
+
+; ----------------------------------------------------------------------
+; Tests to see if a valid login while that same agent is already logged on
+; returns AGENT_STATUS = ALREADY_LOGGED_IN.
+; ----------------------------------------------------------------------
+exten => same-login,1,NoOp()
+    same => n,Answer()
+    same => n,AgentLogin(1000)
+    same => n,ExecIf($[${AGENT_STATUS}=ALREADY_LOGGED_IN]?UserEvent(AlreadyLoggedIn,result:pass))
+    same => n,Hangup()

Propchange: asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/agents/agent_login/login_errors/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/agents/agent_login/login_errors/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/agents/agent_login/login_errors/test-config.yaml?view=auto&rev=4706
==============================================================================
--- asterisk/trunk/tests/apps/agents/agent_login/login_errors/test-config.yaml (added)
+++ asterisk/trunk/tests/apps/agents/agent_login/login_errors/test-config.yaml Sat Feb 15 22:04:25 2014
@@ -1,0 +1,158 @@
+testinfo:
+    summary: 'Tests basic AgentLogin functionality.'
+    description:
+        This test verifies that the following AgentLogin functions and variables work
+        as intended - AgentLogin and AGENT_STATUS.
+        Scenario 1 verifies that an agent can log in and is put in a pool. Then the
+        same agent attempts to log in directly after that to test if AGENT_STATUS returns
+        ALREADY_LOGGED_IN.
+        Scenario 2 verifies that an invalid agent login will cause AGENT_STATUS
+        to return INVALID.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'apptest.AppTest'
+
+test-object-config:
+  app: 'AgentLogin'
+  scenarios:
+    -
+      # Scenario 1
+      # AgentLogin() receives a valid agent, and then the same agent attempts to
+      # log in again.
+      channels:
+        -
+          channel-id: 'Valid-agent'
+          channel-name: 'Local/valid-login at default'
+          context: 'default'
+          exten: 'wait'
+          start-on-create: True
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'AgentLogin'
+                  Agent: '1000'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'An agent attempted valid login 1000'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'MusicOnHoldStart'
+                  Channel: 'Local/valid-login at default-.*'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'MusicOnHoldStart Event received for valid login'
+                -
+                  action-type: 'start-call'
+                  channel-id: 'Same-agent'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'BridgeEnter'
+                  BridgeType: 'agent_hold'
+                  Channel: 'Local/valid-login at default-.*'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Valid agent channel entered bridge.'
+        -
+          channel-id: 'Same-agent'
+          channel-name: 'Local/same-login at default'
+          context: 'default'
+          exten: 'wait'
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'AlreadyLoggedIn'
+              requirements:
+                match:
+                  Result: 'pass'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'An agent attempted valid login 1000 while already logged in.'
+                -
+                  action-type: 'hangup'
+                  channel-id: 'Valid-agent'
+                -
+                  action-type: 'end-scenario'
+    -
+      # Scenario 2
+      # AgentLogin() receives an invalid agent.
+      channels:
+        -
+          channel-id: 'Invalid-agent'
+          channel-name: 'Local/invalid-login at default'
+          context: 'default'
+          exten: 'wait'
+          start-on-create: True
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'InvalidLogin'
+              requirements:
+                match:
+                  Result: 'pass'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Detected invalid agent 4321 and now hanging up.'
+                -
+                  action-type: 'hangup'
+                  channel-id: 'Invalid-agent'
+                -
+                  action-type: 'end-scenario'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'AgentLogin'
+                  Agent: '4321'
+              actions:
+                -
+                  action-type: 'fail-test'
+                  message: 'Invalid agent 4321 logged in!'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'MusicOnHoldStart'
+                  Channel: 'Local/invalid-login at default-.*'
+              actions:
+                -
+                  action-type: 'fail-test'
+                  message: 'MusicOnHoldStart Event received for invalid login.'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'BridgeEnter'
+                  BridgeType: 'agent_hold'
+                  Channel: 'Local/invalid-login at default-.*'
+              actions:
+                -
+                  action-type: 'fail-test'
+                  message: 'Channel entered bridge for invalid login.'
+
+properties:
+    minversion: '1.8.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+    tags:
+        - agents
+        - apps

Propchange: asterisk/trunk/tests/apps/agents/agent_login/login_errors/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/agents/agent_login/login_errors/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/agents/agent_login/login_errors/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/agents.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/agents.conf?view=auto&rev=4706
==============================================================================
--- asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/agents.conf (added)
+++ asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/agents.conf Sat Feb 15 22:04:25 2014
@@ -1,0 +1,4 @@
+[1000]
+
+fullname=James Bond
+

Propchange: asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/agents.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/agents.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/agents.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/extensions.conf?view=auto&rev=4706
==============================================================================
--- asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/extensions.conf Sat Feb 15 22:04:25 2014
@@ -1,0 +1,37 @@
+; Tests basic AgentLogin functionality.
+[default]
+
+; ----------------------------------------------------------------------
+; ***Required***
+; ----------------------------------------------------------------------
+
+exten => sendDTMF,1,NoOp()
+	same => n,Verbose(1, Sending DTMF Signal ${DTMF_TO_SEND})
+	same => n,SendDTMF(${DTMF_TO_SEND})
+	same => n,Goto(caller,wait,1)
+
+exten => sendAudio,1,NoOp()
+	same => n,Verbose(1, Sending audio file ${TALK_AUDIO})
+	same => n,Playback(${TALK_AUDIO})
+	same => n,Goto(caller,wait,1)
+
+exten => sendAudioWithDTMF,1,NoOp()
+	same => n,Verbose(1, Sending audio file ${TALK_AUDIO})
+	same => n,Playback(${TALK_AUDIO})
+	same => n,Verbose(1, Sending DTMF Signal ${DTMF_TO_SEND})
+	same => n,SendDTMF(${DTMF_TO_SEND})
+	same => n,Goto(caller,wait,1)
+
+exten => hangup,1,NoOp()
+	same => n,Verbose(1, Hanging up)
+	same => n,Hangup()
+
+exten => wait,1,NoOp()
+	same => n,Wait(10000)
+
+; ----------------------------------------------------------------------
+; Tests to see if a valid agent login enters the pool.
+; ----------------------------------------------------------------------
+exten => valid-login,1,NoOp()
+    same => n,Answer()
+    same => n,AgentLogin(1000)

Propchange: asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/agents/agent_login/nominal/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/agents/agent_login/nominal/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/agents/agent_login/nominal/test-config.yaml?view=auto&rev=4706
==============================================================================
--- asterisk/trunk/tests/apps/agents/agent_login/nominal/test-config.yaml (added)
+++ asterisk/trunk/tests/apps/agents/agent_login/nominal/test-config.yaml Sat Feb 15 22:04:25 2014
@@ -1,0 +1,70 @@
+testinfo:
+    summary: 'Tests basic AgentLogin functionality.'
+    description:
+        This test verifies that the following scenario works...
+        An agent can log in and is put in a pool.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'apptest.AppTest'
+
+test-object-config:
+  app: 'AgentLogin'
+  scenarios:
+    -
+      # Scenario 1
+      # AgentLogin() receives a valid agent.
+      channels:
+        -
+          channel-id: 'Valid-agent'
+          channel-name: 'Local/valid-login at default'
+          context: 'default'
+          exten: 'wait'
+          start-on-create: True
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'AgentLogin'
+                  Agent: '1000'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'An agent attempted valid login 1000'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'MusicOnHoldStart'
+                  Channel: 'Local/valid-login at default-.*'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'MusicOnHoldStart Event received for valid login'
+                -
+                  action-type: 'hangup'
+                  channel-id: 'Valid-agent'
+                -
+                  action-type: 'end-scenario'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'BridgeEnter'
+                  BridgeType: 'agent_hold'
+                  Channel: 'Local/valid-login at default-.*'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Valid agent channel entered bridge.'
+
+properties:
+    minversion: '1.8.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+    tags:
+        - agents
+        - apps

Propchange: asterisk/trunk/tests/apps/agents/agent_login/nominal/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/agents/agent_login/nominal/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/agents/agent_login/nominal/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/agents/agent_login/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/agents/agent_login/tests.yaml?view=auto&rev=4706
==============================================================================
--- asterisk/trunk/tests/apps/agents/agent_login/tests.yaml (added)
+++ asterisk/trunk/tests/apps/agents/agent_login/tests.yaml Sat Feb 15 22:04:25 2014
@@ -1,0 +1,4 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'nominal'
+    - test: 'login_errors'

Propchange: asterisk/trunk/tests/apps/agents/agent_login/tests.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/agents/agent_login/tests.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/agents/agent_login/tests.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/agents/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/agents/tests.yaml?view=auto&rev=4706
==============================================================================
--- asterisk/trunk/tests/apps/agents/tests.yaml (added)
+++ asterisk/trunk/tests/apps/agents/tests.yaml Sat Feb 15 22:04:25 2014
@@ -1,0 +1,3 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - dir: 'agent_login'

Propchange: asterisk/trunk/tests/apps/agents/tests.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/agents/tests.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/agents/tests.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/apps/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/tests.yaml?view=diff&rev=4706&r1=4705&r2=4706
==============================================================================
--- asterisk/trunk/tests/apps/tests.yaml (original)
+++ asterisk/trunk/tests/apps/tests.yaml Sat Feb 15 22:04:25 2014
@@ -1,5 +1,6 @@
 # Enter tests here in the order they should be considered for execution:
 tests:
+    - dir: 'agents'
     - dir: 'directory'
     - dir: 'bridge'
     - dir: 'dial'




More information about the asterisk-commits mailing list