blob: 642da1cb8eeb690d5c1ddda85a9ee7fdc09ad2d2 (
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
38
39
40
41
42
43
44
45
46
47
48
49
|
# tests for capabilities and the capabilities cache
import unittest
import testlib
testlib.setup_env()
from common import gajim
from common import xmpp
from common.caps import CapsCache
from mock import Mock
class MockLogger(Mock):
def __init__(self, *args):
Mock.__init__(self, *args)
class TestCapsCache(unittest.TestCase):
def setUp(self):
self.logger = MockLogger()
self.cc = CapsCache(self.logger)
def test_examples(self):
'''tests the examples given in common/caps.py'''
caps = ('sha-1', '66/0NaeaBKkwk85efJTGmU47vXI=')
identity = {'category': 'client', 'type': 'pc'}
muc = 'http://jabber.org/protocol/muc'
chatstates = 'http://jabber.org/protocol/chatstates'
self.cc[caps].identities = [identity]
self.cc[caps].features = [muc]
self.assert_(muc in self.cc[caps].features)
self.assert_(chatstates not in self.cc[caps].features)
id = self.cc[caps].identities
self.assertEqual(1, len(id))
id = id[0]
self.assertEqual('client', id['category'])
self.assertEqual('pc', id['type'])
if __name__ == '__main__':
unittest.main()
# vim: se ts=3:
|