Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlovetox <philipp@hoerist.com>2022-08-13 22:53:02 +0300
committerlovetox <philipp@hoerist.com>2022-08-13 22:53:02 +0300
commitd8dfff44ea358fd7f752f29263a7d8b2e601313f (patch)
tree112f9b74403fae41bd57eb23ce07c12f21f4efb2 /test
parentf1e8841f1a257477b69c04af89e708d8aff8a700 (diff)
other: Tests: Add contact object tests
Diffstat (limited to 'test')
-rw-r--r--test/no_gui/test_contacts.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/no_gui/test_contacts.py b/test/no_gui/test_contacts.py
new file mode 100644
index 000000000..d9d77c394
--- /dev/null
+++ b/test/no_gui/test_contacts.py
@@ -0,0 +1,30 @@
+
+import unittest
+from unittest.mock import MagicMock
+
+from nbxmpp.protocol import JID
+
+from gajim.common import app
+from gajim.common.modules.contacts import Contacts
+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')
+ module = Contacts(MagicMock())
+
+ app.storage.cache = CacheStorage(in_memory=True)
+ app.storage.cache.init()
+
+ contact = BareContact(module._log, jid, account)
+ contact2 = BareContact(module._log, jid, account)
+
+ self.assertEqual(contact, contact2)
+ self.assertEqual(hash(contact), hash(contact2))
+
+
+if __name__ == '__main__':
+ unittest.main()