summaryrefslogtreecommitdiff
path: root/tests/test_stanza_xep_0422.py
blob: 9d2cc396c3b678d0f1aa480a7e2a5f24ec64d6e3 (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
import unittest
from slixmpp import Message
from slixmpp.test import SlixTest
from slixmpp.xmlstream import ET
from slixmpp.plugins.xep_0422 import stanza


class TestFastening(SlixTest):

    def setUp(self):
        stanza.register_plugins()

    def testFastenExternal(self):
        message = Message()
        message['apply_to']['id'] = 'some-id'
        message['apply_to'].xml.append(
            ET.fromstring('<test xmlns="urn:tmp:test">Test</test>')
        )
        message['apply_to']['external']['name'] = 'body'
        message['body'] = 'Toto'

        self.check(message, """
<message>
  <apply-to xmlns="urn:xmpp:fasten:0" id="some-id">
      <test xmlns="urn:tmp:test">Test</test>
      <external name='body'/>
  </apply-to>
  <body>Toto</body>
</message>
        """, use_values=False)


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