~singpolyma/biboumi

ref: 0bb4f144fcded6b5753b5de7493b7b10474c9a1f biboumi/tests/end_to_end/scenarios/multisession_kick.py -rw-r--r-- 2.9 KiB
0bb4f144 — Félix Baylac-Jacqué CLI: Add a test config flag 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from scenarios import *

scenario = (
    scenarios.simple_channel_join.scenario,

    # Second user joins, from two resources
    send_stanza("<presence from='{jid_two}/{resource_one}' to='#foo%{irc_server_one}/{nick_two}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
    sequences.connection("irc.localhost", '{jid_two}/{resource_one}'),
    expect_unordered(
                     ["/presence[@to='{jid_one}/{resource_one}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant']"],
                     ["/presence[@to='{jid_two}/{resource_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']"],
                     ["/presence[@to='{jid_two}/{resource_one}']/muc_user:x/muc_user:item[@affiliation='none'][@role='participant']",
                      "/presence[@to='{jid_two}/{resource_one}']/muc_user:x/muc_user:status[@code='110']"],
                     ["/message/subject"]
    ),
    # Second resource
    send_stanza("<presence from='{jid_two}/{resource_two}' to='#foo%{irc_server_one}/{nick_two}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
    expect_unordered(
    ["/presence[@to='{jid_two}/{resource_two}'][@from='#foo%{irc_server_one}/{nick_one}']"],
    ["/presence[@to='{jid_two}/{resource_two}'][@from='#foo%{irc_server_one}/{nick_two}']",
     "/presence/muc_user:x/muc_user:status[@code='110']"]
    ),
    expect_stanza("/message[@from='#foo%{irc_server_one}'][@type='groupchat'][@to='{jid_two}/{resource_two}']/subject[not(text())]"),

    # Moderator kicks participant
    send_stanza("<iq id='kick1' to='#foo%{irc_server_one}' from='{jid_one}/{resource_one}' type='set'><query xmlns='http://jabber.org/protocol/muc#admin'><item nick='{nick_two}' role='none'><reason>reported</reason></item></query></iq>"),
    expect_unordered(
        [
            "/presence[@type='unavailable'][@to='{jid_two}/{resource_one}']/muc_user:x/muc_user:item[@role='none']/muc_user:actor[@nick='{nick_one}']",
            "/presence/muc_user:x/muc_user:item/muc_user:reason[text()='reported']",
            "/presence/muc_user:x/muc_user:status[@code='307']",
            "/presence/muc_user:x/muc_user:status[@code='110']"
        ],
        [
            "/presence[@type='unavailable'][@to='{jid_two}/{resource_two}']/muc_user:x/muc_user:item[@role='none']/muc_user:actor[@nick='{nick_one}']",
            "/presence/muc_user:x/muc_user:item/muc_user:reason[text()='reported']",
            "/presence/muc_user:x/muc_user:status[@code='307']",
            "/presence/muc_user:x/muc_user:status[@code='110']"
        ],
        ["/presence[@type='unavailable']/muc_user:x/muc_user:item[@role='none']/muc_user:actor[@nick='{nick_one}']",
        "/presence/muc_user:x/muc_user:item/muc_user:reason[text()='reported']",
        "/presence/muc_user:x/muc_user:status[@code='307']",
        ],
        [
            "/iq[@id='kick1'][@type='result']"
        ]
    ),
)