summaryrefslogtreecommitdiff
path: root/tests/test_stanza_xep_0403.py
blob: 7d7a5daaf7cc65a0b0342a3f22a93cfc7c1de24e (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
import unittest
from slixmpp import Presence, JID
from slixmpp.test import SlixTest
from slixmpp.plugins.xep_0403 import stanza


class TestMIXPresenceStanza(SlixTest):

    def setUp(self):
        stanza.register_plugins()

    def testMIXPresence(self):
        """Test that data is converted to base64"""
        pres = Presence()
        pres['show'] = 'dnd'
        pres['status'] = 'Hey there!'
        pres['mix']['jid'] = JID('toto@example.com')
        pres['mix']['nick'] = 'Toto toto'

        self.check(pres, """
          <presence>
             <show>dnd</show>
             <status>Hey there!</status>
             <mix xmlns="urn:xmpp:mix:presence:0">
                 <jid>toto@example.com</jid>
                 <nick>Toto toto</nick>
             </mix>
          </presence>
        """)


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