File: test_contacts.py

package info (click to toggle)
gajim 2.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,584 kB
  • sloc: python: 80,560; sh: 591; xml: 67; makefile: 6
file content (31 lines) | stat: -rw-r--r-- 808 bytes parent folder | download
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
# This file is part of Gajim.
#
# SPDX-License-Identifier: GPL-3.0-or-later

import unittest
from unittest.mock import MagicMock

from nbxmpp.protocol import JID

from gajim.common import app
from gajim.common.modules.contacts import BareContact
from gajim.common.storage.cache import CacheStorage


class ContactTest(unittest.TestCase):
    def test_contact_object(self):
        account = "testacc"
        jid = JID.from_string("user@example.org")

        app.storage.cache = CacheStorage(in_memory=True)
        app.storage.cache.init()

        contact = BareContact(MagicMock(), jid, account)
        contact2 = BareContact(MagicMock(), jid, account)

        self.assertEqual(contact, contact2)
        self.assertEqual(hash(contact), hash(contact2))


if __name__ == "__main__":
    unittest.main()