Mercurial > libervia-backend
annotate tests/unit/test_plugin_xep_0338.py @ 4112:bc60875cb3b8
plugin XEP-0166, XEP-0167, XEP-0234, XEP-0353: call events management to prepare for UI:
- XEP-0166: add `jingle_preflight` and `jingle_preflight_cancel` methods to prepare a
jingle session, principally used by XEP-0353 to create and cancel a session
- XEP-0167: preflight methods implementation, workflow split in more methods/signals to
handle UI and call events (e.g.: retract or reject a call)
- XEP-0234: implementation of preflight methods as they are now mandatory
- XEP-0353: handle various events using the new preflight methods
rel 423
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 09 Aug 2023 00:07:37 +0200 |
parents | 4b842c1fb686 |
children | 716dd791be46 |
rev | line source |
---|---|
4065
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 # Libervia: an XMPP client |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # Copyright (C) 2009-2023 Jérôme Poisson (goffi@goffi.org) |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 # This program is free software: you can redistribute it and/or modify |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # it under the terms of the GNU Affero General Public License as published by |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # the Free Software Foundation, either version 3 of the License, or |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # (at your option) any later version. |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # GNU Affero General Public License for more details. |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 # You should have received a copy of the GNU Affero General Public License |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 from twisted.words.xish import domish |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 |
4071
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4065
diff
changeset
|
22 from libervia.backend.plugins.plugin_xep_0338 import NS_JINGLE_GROUPING, XEP_0338 |
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4065
diff
changeset
|
23 from libervia.backend.tools.xml_tools import parse |
4065
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 class TestXEP0338: |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 def test_parse_sdp(self, host): |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 """'group' attribute in SDP is correctly parsed""" |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 xep_0338 = XEP_0338(host) |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 call_data = {} |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 metadata = {} |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 media_type = "video" |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 application_data = {} |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 transport_data = {} |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 # SDP: a=group:BUNDLE audio video |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 attribute = "group" |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 parts = ["BUNDLE", "audio", "video"] |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 xep_0338._parse_sdp_a_trigger( |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 attribute, |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 parts, |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 call_data, |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
45 metadata, |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
46 media_type, |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
47 application_data, |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
48 transport_data, |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 ) |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 assert metadata == {"group": {"BUNDLE": ["audio", "video"]}} |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
53 def test_generate_sdp(self, host): |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 """'group' attribute in SDP is correctly generated""" |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
55 xep_0338 = XEP_0338(host) |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
56 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
57 session = {"metadata": {"group": {"BUNDLE": ["audio", "video"]}}} |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
58 sdp_lines = [] |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
59 local = True |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
61 xep_0338._generate_sdp_session_trigger(session, local, sdp_lines) |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
62 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
63 assert sdp_lines == ["a=group:BUNDLE audio video"] |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
65 def test_group_building(self, host, client): |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
66 """<group> element are built from session in session init trigger""" |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
67 xep_0338 = XEP_0338(host) |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
69 session = { |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
70 "jingle_elt": domish.Element((None, "jingle")), |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
71 "metadata": {"group": {"BUNDLE": ["audio", "video"]}}, |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
72 } |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 content_name = "audio" |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
74 media = "audio" |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
75 media_data = {} |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
76 desc_elt = domish.Element((None, "description")) |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
77 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
78 xep_0338._jingle_session_init_trigger( |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
79 client, session, content_name, media, media_data, desc_elt |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
80 ) |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
81 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
82 group_elts = list(session["jingle_elt"].elements(NS_JINGLE_GROUPING, "group")) |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
83 assert len(group_elts) == 1 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
84 group_elt = group_elts[0] |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
85 assert group_elt["semantics"] == "BUNDLE" |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
86 content_names = [ |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
87 content_elt["name"] |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
88 for content_elt in group_elt.elements(NS_JINGLE_GROUPING, "content") |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
89 ] |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
90 assert content_names == ["audio", "video"] |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
91 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
92 def test_group_parsing(self, host, client): |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
93 """<group> elements are correctly parsed in jingle_handler trigger""" |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
94 xep_0338 = XEP_0338(host) |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
95 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
96 action = xep_0338._j.A_SESSION_INITIATE |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
97 session = { |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
98 "contents": ["audio", "video"], |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
99 "metadata": {}, |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
100 } |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
101 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
102 raw_xml = """ |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
103 <jingle xmlns='urn:xmpp:jingle:1' |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
104 action='session-initiate' |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
105 initiator='user@example.org/orchard' |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
106 sid='a73sjjvkla37jfea'> |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
107 <group xmlns='urn:xmpp:jingle:apps:grouping:0' semantics='BUNDLE'> |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
108 <content name='audio'/> |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
109 <content name='video'/> |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
110 </group> |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
111 <content creator='initiator' name='audio'> |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
112 <description xmlns='urn:xmpp:jingle:apps:rtp:1' media='audio'/> |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
113 </content> |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 <content creator='initiator' name='video'> |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
115 <description xmlns='urn:xmpp:jingle:apps:rtp:1' media='video'/> |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 </content> |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
117 </jingle> |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
118 """ |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
119 session["jingle_elt"] = parse(raw_xml) |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
120 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
121 for content_elt in session["jingle_elt"].elements("urn:xmpp:jingle:1", "content"): |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
122 content_name = content_elt["name"] |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
123 desc_elt = next( |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
124 content_elt.elements("urn:xmpp:jingle:apps:rtp:1", "description") |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
125 ) |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
126 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
127 xep_0338._jingle_handler_trigger( |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
128 client, action, session, content_name, desc_elt |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
129 ) |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
130 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
131 group_elts = list(session["jingle_elt"].elements(NS_JINGLE_GROUPING, "group")) |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
132 assert len(group_elts) == 1 |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
133 group_elt = group_elts[0] |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
134 assert group_elt["semantics"] == "BUNDLE" |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
135 content_names = [ |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
136 content_elt["name"] |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
137 for content_elt in group_elt.elements(NS_JINGLE_GROUPING, "content") |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
138 ] |
34c8e7e4fa52
tests (units): tests for plugin XEP-0338:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
139 assert content_names == ["audio", "video"] |