Skip to content
Browse files

JID unit tests

  • Loading branch information...
1 parent 2af3b77 commit 7e400ea0ebf1c94aadd6ee78d6ea8a8838bb5d99 @master master committed
Showing with 31 additions and 0 deletions.
  1. +31 −0 headstock/test/jid_test.py
View
31 headstock/test/jid_test.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+import unittest
+from headstock.lib.jid import JID
+
+class TestJID(unittest.TestCase):
+
+ def setUp(self):
+ self.jid = JID("user", "domain", "resource")
+
+ def test_parse(self):
+ jid = JID.parse("bob@work/mobile")
+ self.assertEqual(str(jid), "bob@work/mobile")
+
+ def test_str(self):
+ self.assertEqual(str(self.jid), "user@domain/resource")
+
+ def test_domainid(self):
+ self.assertEqual(self.jid.domainid(), "domain")
+
+ def test_nodeid(self):
+ self.assertEqual(self.jid.nodeid(), "user@domain")
+
+ def test_ressourceid(self):
+ self.assertEqual(self.jid.ressourceid(), "user@domain/resource")
+
+ def test_hashed(self):
+ self.assertEqual(self.jid.hashed, "4b8b6b2035fefaeae824f59bd54ebaf763cd61ce")
+
+if __name__ == '__main__':
+ unittest.main()

0 comments on commit 7e400ea

Please sign in to comment.
Something went wrong with that request. Please try again.