[Asterisk-code-review] rest_api/message: Add test mixing technology and endpoint subscriptions (testsuite[16])

Jean Aunis - Prescom asteriskteam at digium.com
Wed Jan 13 08:22:53 CST 2021


Jean Aunis - Prescom has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/15348 )


Change subject: rest_api/message: Add test mixing technology and endpoint subscriptions
......................................................................

rest_api/message: Add test mixing technology and endpoint subscriptions

ASTERISK-29229

Change-Id: I653b3ed9409906c3d6d7718dd0d853ca152d8b4c
---
A tests/rest_api/message/mixed_endpoint_technology_subscriptions/configs/ast1/pjsip.conf
A tests/rest_api/message/mixed_endpoint_technology_subscriptions/sipp/message.xml
A tests/rest_api/message/mixed_endpoint_technology_subscriptions/test-config.yaml
M tests/rest_api/message/tests.yaml
4 files changed, 124 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/48/15348/1

diff --git a/tests/rest_api/message/mixed_endpoint_technology_subscriptions/configs/ast1/pjsip.conf b/tests/rest_api/message/mixed_endpoint_technology_subscriptions/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..57d5659
--- /dev/null
+++ b/tests/rest_api/message/mixed_endpoint_technology_subscriptions/configs/ast1/pjsip.conf
@@ -0,0 +1,20 @@
+[local-transport-udp]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+transport=local-transport-udp
+aors=alice
+
+[alice]
+type=aor
+contact=sip:alice at 127.0.0.1:5061\;transport=udp
+
+[alice-identify]
+type=identify
+match=127.0.0.1:50601
+endpoint=alice
diff --git a/tests/rest_api/message/mixed_endpoint_technology_subscriptions/sipp/message.xml b/tests/rest_api/message/mixed_endpoint_technology_subscriptions/sipp/message.xml
new file mode 100644
index 0000000..50a6256
--- /dev/null
+++ b/tests/rest_api/message/mixed_endpoint_technology_subscriptions/sipp/message.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="Basic MESSAGE send and receive">
+  <send retrans="500">
+    <![CDATA[
+
+      MESSAGE sip:alice@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:asterisk@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 MESSAGE
+      Max-Forwards: 70
+      Expires: 3600
+      Content-Type: text/plain
+      Content-Length: 18
+
+      Watson, come here.
+
+    ]]>
+  </send>
+
+  <recv response="202" rtd="true" />
+
+</scenario>
diff --git a/tests/rest_api/message/mixed_endpoint_technology_subscriptions/test-config.yaml b/tests/rest_api/message/mixed_endpoint_technology_subscriptions/test-config.yaml
new file mode 100644
index 0000000..965b399
--- /dev/null
+++ b/tests/rest_api/message/mixed_endpoint_technology_subscriptions/test-config.yaml
@@ -0,0 +1,78 @@
+testinfo:
+    summary: Test receiving a message from an endpoint
+    description: |
+        This test covers mixed endpoint and technology subscriptions
+        to an endpoint and receiving a text message from said endpoint.
+
+test-modules:
+    add-to-search-path:
+        - 'tests/rest_api/message'
+    test-object:
+        config-section: test-object-config
+        typename: ari.AriTestObject
+    modules:
+        -
+            config-section: ari-config
+            typename: pluggable_modules.EventActionModule
+        -
+            config-section: message-sender
+            typename: 'message_modules.SIPMessageRunner'
+        -
+            config-section: message-subscriber
+            typename: 'message_modules.MessageSubscriber'
+
+test-object-config:
+    asterisk-instances: 1
+    test-iterations: None
+    apps: testsuite_technology,testsuite_endpoint
+
+message-subscriber:
+    subscriptions:
+        - { event-source: 'endpoint:PJSIP/alice', app: 'testsuite_endpoint' }
+        - { event-source: 'endpoint:PJSIP', app: 'testsuite_technology' }
+
+message-sender:
+    sipp:
+        - { 'scenario':'message.xml', '-p':'5061' }
+
+ari-config:
+    -   ari-events:
+            match:
+                type: TextMessageReceived
+                application: testsuite_technology
+                message:
+                    to: 'pjsip:asterisk at 127.0.0.1'
+                    from: '"alice" <sip:alice at 127.0.0.1>'
+                    body: 'Watson, come here.'
+                endpoint:
+                    technology: PJSIP
+                    resource: alice
+                    state: online
+            count: 1
+    -   ari-events:
+            match:
+                type: TextMessageReceived
+                application: testsuite_endpoint
+                message:
+                    to: 'pjsip:asterisk at 127.0.0.1'
+                    from: '"alice" <sip:alice at 127.0.0.1>'
+                    body: 'Watson, come here.'
+                endpoint:
+                    technology: PJSIP
+                    resource: alice
+                    state: online
+            count: 1
+        stop_test:
+
+properties:
+    dependencies:
+        - python : autobahn.websocket
+        - python : requests
+        - python : twisted
+        - python : starpy
+        - asterisk : res_ari_endpoints
+        - asterisk : res_ari_applications
+        - asterisk : res_pjsip_messaging
+    tags:
+        - ARI
+        - refleaks
diff --git a/tests/rest_api/message/tests.yaml b/tests/rest_api/message/tests.yaml
index f4164f7..ed1e566 100644
--- a/tests/rest_api/message/tests.yaml
+++ b/tests/rest_api/message/tests.yaml
@@ -1,3 +1,4 @@
 tests:
     - dir: 'endpoint'
     - dir: 'technology'
+    - test: 'mixed_endpoint_technology_subscriptions'

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

Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-Change-Id: I653b3ed9409906c3d6d7718dd0d853ca152d8b4c
Gerrit-Change-Number: 15348
Gerrit-PatchSet: 1
Gerrit-Owner: Jean Aunis - Prescom <jean.aunis at prescom.fr>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210113/72c9aa56/attachment-0001.html>


More information about the asterisk-code-review mailing list