summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNathan Fritz <nathan@andyet.net>2010-07-26 18:13:09 -0700
committerNathan Fritz <nathan@andyet.net>2010-07-26 18:13:09 -0700
commit2cb82afc2cd35051a89c5d843f13bbf0132e2003 (patch)
tree5e58480ec09f98859fd52c806a3071620e3fe776 /tests
parent241aba8c767ded0c931b2d70ac223eb81f174f1c (diff)
downloadslixmpp-2cb82afc2cd35051a89c5d843f13bbf0132e2003.tar.gz
slixmpp-2cb82afc2cd35051a89c5d843f13bbf0132e2003.tar.bz2
slixmpp-2cb82afc2cd35051a89c5d843f13bbf0132e2003.tar.xz
slixmpp-2cb82afc2cd35051a89c5d843f13bbf0132e2003.zip
updated and moved jid class -- jids now have setters
Diffstat (limited to 'tests')
-rw-r--r--tests/test_jid.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_jid.py b/tests/test_jid.py
new file mode 100644
index 00000000..8b4c9761
--- /dev/null
+++ b/tests/test_jid.py
@@ -0,0 +1,26 @@
+from sleektest import *
+from sleekxmpp.xmlstream.jid import JID
+
+class TestJIDClass(SleekTest):
+ def testJIDfromfull(self):
+ j = JID('user@someserver/some/resource')
+ self.assertEqual(j.user, 'user', "User does not match")
+ self.assertEqual(j.domain, 'someserver', "Domain does not match")
+ self.assertEqual(j.resource, 'some/resource', "Resource does not match")
+ self.assertEqual(j.bare, 'user@someserver', "Bare does not match")
+ self.assertEqual(j.full, 'user@someserver/some/resource', "Full does not match")
+ self.assertEqual(str(j), 'user@someserver/some/resource', "String does not match")
+
+ def testJIDchange(self):
+ j = JID('user1@someserver1/some1/resource1')
+ j.user = 'user'
+ j.domain = 'someserver'
+ j.resource = 'some/resource'
+ self.assertEqual(j.user, 'user', "User does not match")
+ self.assertEqual(j.domain, 'someserver', "Domain does not match")
+ self.assertEqual(j.resource, 'some/resource', "Resource does not match")
+ self.assertEqual(j.bare, 'user@someserver', "Bare does not match")
+ self.assertEqual(j.full, 'user@someserver/some/resource', "Full does not match")
+ self.assertEqual(str(j), 'user@someserver/some/resource', "String does not match")
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestJIDClass)