summaryrefslogtreecommitdiff
path: root/tests/test_stream_xep_0066.py
blob: 159333c7d158c4d15c5bae56d50ceac440c74671 (plain)
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
import threading

import unittest
from slixmpp.test import SlixTest


class TestOOB(SlixTest):

    def tearDown(self):
        self.stream_close()

    def testSendOOB(self):
        """Test sending an OOB transfer request."""
        self.stream_start(plugins=['xep_0066', 'xep_0030'])

        url = 'http://github.com/fritzy/Slixmpp/blob/master/README'

        self.xmpp['xep_0066'].send_oob('user@example.com', url,
                                       desc='Slixmpp README')

        self.send("""
          <iq to="user@example.com" type="set" id="1">
            <query xmlns="jabber:iq:oob">
              <url>http://github.com/fritzy/Slixmpp/blob/master/README</url>
              <desc>Slixmpp README</desc>
            </query>
          </iq>
        """)

        self.recv("""
          <iq id="1" type="result"
              to="tester@localhost"
              from="user@example.com" />
        """)


suite = unittest.TestLoader().loadTestsFromTestCase(TestOOB)