Mercurial > libervia-backend
annotate tests/unit/test_plugin_xep_0339.py @ 4242:8acf46ed7f36
frontends: remote control implementation:
This is the frontends common part of remote control implementation. It handle the creation
of WebRTC session, and management of inputs. For now the reception use freedesktop.org
Desktop portal, and works mostly with Wayland based Desktop Environments.
rel 436
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 11 May 2024 13:52:43 +0200 |
parents | 4b842c1fb686 |
children |
rev | line source |
---|---|
4068
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 # Libervia: an XMPP client |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # Copyright (C) 2009-2023 Jérôme Poisson (goffi@goffi.org) |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 # This program is free software: you can redistribute it and/or modify |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # it under the terms of the GNU Affero General Public License as published by |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # the Free Software Foundation, either version 3 of the License, or |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # (at your option) any later version. |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # GNU Affero General Public License for more details. |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 # You should have received a copy of the GNU Affero General Public License |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 from twisted.words.xish import domish |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 |
4071
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4068
diff
changeset
|
22 from libervia.backend.plugins.plugin_xep_0339 import NS_JINGLE_RTP_SSMA, XEP_0339 |
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4068
diff
changeset
|
23 from libervia.backend.tools.xml_tools import parse |
4068
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 class TestXEP0339: |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 def test_parse_sdp(self, host): |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 """'ssrc' and 'ssrc-group' attributes in SDP are correctly parsed""" |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 xep_0339 = XEP_0339(host) |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 call_data = {} |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 metadata = {} |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 media_type = "video" |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 application_data = {} |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 transport_data = {} |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 # SDP: a=ssrc:123 label:stream_label |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 attribute = "ssrc" |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 parts = ["123", "label:stream_label"] |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 xep_0339._parse_sdp_a_trigger( |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 attribute, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 parts, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 call_data, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
45 metadata, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
46 media_type, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
47 application_data, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
48 transport_data, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 ) |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 assert application_data == {"ssrc": {123: {"label": "stream_label"}}} |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
53 application_data = {} |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
55 # SDP: a=ssrc-group:FID 123 456 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
56 attribute = "ssrc-group" |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
57 parts = ["FID", "123", "456"] |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
58 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
59 xep_0339._parse_sdp_a_trigger( |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 attribute, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
61 parts, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
62 call_data, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
63 metadata, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 media_type, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
65 application_data, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
66 transport_data, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
67 ) |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
69 assert application_data == {"ssrc-group": {"FID": [123, 456]}} |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
70 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
71 def test_generate_sdp(self, host): |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
72 """'ssrc' and 'ssrc-group' attributes in SDP are correctly generated""" |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 xep_0339 = XEP_0339(host) |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
74 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
75 media_data = { |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
76 "ssrc": {123: {"label": "stream_label"}}, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
77 "ssrc-group": {"FID": [123, 456]}, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
78 } |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
79 sdp_lines = [] |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
80 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
81 xep_0339._generate_sdp_content_trigger( |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
82 {}, True, 1, {}, sdp_lines, {}, "", media_data, "video" |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
83 ) |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
84 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
85 assert sdp_lines == ["a=ssrc:123 label:stream_label", "a=ssrc-group:FID 123 456"] |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
86 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
87 def test_parse_description(self, host): |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
88 """'<source>' and '<ssrc-group>' elements are correctly parsed""" |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
89 xep_0339 = XEP_0339(host) |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
90 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
91 media_data = {} |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
92 raw_xml = """ |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
93 <description xmlns='urn:xmpp:jingle:apps:rtp:1' media='audio'> |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
94 <source xmlns='urn:xmpp:jingle:apps:rtp:ssma:0' ssrc='1'> |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
95 <parameter name='cname' value='some_name'/> |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
96 <parameter name='msid' value='media'/> |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
97 </source> |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
98 <ssrc-group xmlns='urn:xmpp:jingle:apps:rtp:ssma:0' semantics='FEC'> |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
99 <source ssrc='2'/> |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
100 <source ssrc='3'/> |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
101 </ssrc-group> |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
102 </description> |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
103 """ |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
104 desc_elt = parse(raw_xml) |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
105 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
106 xep_0339._parse_description_trigger(desc_elt, media_data) |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
107 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
108 assert media_data == { |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
109 "msid": "media", |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
110 "ssrc": { |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
111 1: { |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
112 "cname": "some_name", |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
113 "msid": "media", |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 } |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
115 }, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 "ssrc-group": {"FEC": [2, 3]}, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
117 } |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
118 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
119 def test_generate_description(self, host): |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
120 """'<source>' and '<ssrc-group>' elements are correctly generated""" |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
121 xep_0339 = XEP_0339(host) |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
122 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
123 media_data = { |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
124 "ssrc": { |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
125 1: { |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
126 "cname": "some_name", |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
127 "msid": "media", |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
128 } |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
129 }, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
130 "ssrc-group": {"FEC": [2, 3]}, |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
131 } |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
132 session = {} |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
133 desc_elt = domish.Element((None, "description")) |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
134 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
135 xep_0339._build_description_trigger(desc_elt, media_data, session) |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
136 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
137 source_elts = list(desc_elt.elements(NS_JINGLE_RTP_SSMA, "source")) |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
138 assert len(source_elts) == 1 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
139 source_elt = source_elts[0] |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
140 assert source_elt["ssrc"] == "1" |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
141 param_elts = list(source_elt.elements(NS_JINGLE_RTP_SSMA, "parameter")) |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
142 assert len(param_elts) == 2 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
143 assert param_elts[0]["name"] == "cname" |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
144 assert param_elts[0]["value"] == "some_name" |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
145 assert param_elts[1]["name"] == "msid" |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
146 assert param_elts[1]["value"] == "media" |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
147 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
148 ssrc_group_elts = list(desc_elt.elements(NS_JINGLE_RTP_SSMA, "ssrc-group")) |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
149 assert len(ssrc_group_elts) == 1 |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
150 ssrc_group_elt = ssrc_group_elts[0] |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
151 assert ssrc_group_elt["semantics"] == "FEC" |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
152 ssrc_ids = [ |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
153 int(source_elt["ssrc"]) |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
154 for source_elt in ssrc_group_elt.elements(NS_JINGLE_RTP_SSMA, "source") |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
155 ] |
5241267a92b3
tests (units): tests for plugin XEP-0339:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
156 assert ssrc_ids == [2, 3] |