summaryrefslogtreecommitdiff
path: root/tests/test_jid.py
diff options
context:
space:
mode:
authorNathan Fritz <nathan@andyet.net>2010-08-19 16:09:47 -0700
committerNathan Fritz <nathan@andyet.net>2010-08-19 16:09:47 -0700
commitd150b35464742de7af9b3105bc7eeb55171b96ee (patch)
treef1dce9115efbe4c85d37bc27d6ae35f1e937a043 /tests/test_jid.py
parent21b7109c06695955632692814fed11b3717e0fc7 (diff)
parente4240dd593207a5912de996c42451b3946f113b2 (diff)
downloadslixmpp-d150b35464742de7af9b3105bc7eeb55171b96ee.tar.gz
slixmpp-d150b35464742de7af9b3105bc7eeb55171b96ee.tar.bz2
slixmpp-d150b35464742de7af9b3105bc7eeb55171b96ee.tar.xz
slixmpp-d150b35464742de7af9b3105bc7eeb55171b96ee.zip
fixed todo merge
Diffstat (limited to 'tests/test_jid.py')
-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..cddac424
--- /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)