0fffbb8200
Moved SleekTest to sleekxmpp.test. Organized test suites by their focus. - Suites focused on testing stanza objects are named test_stanza_X.py - Suites focused on testing stream behavior are name test_stream_X.py
28 lines
1.3 KiB
Python
28 lines
1.3 KiB
Python
from sleekxmpp.test 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)
|