Example #1
0
 def test_set_jid_aliases(self):
     """Test changing JID using aliases for domain."""
     j = JID('user@someserver/resource')
     j.server = 'anotherserver'
     self.check_jid(j, domain='anotherserver')
     j.host = 'yetanother'
     self.check_jid(j, domain='yetanother')
Example #2
0
 def test_set_jid_aliases(self):
     """Test changing JID using aliases for domain."""
     j = JID('user@someserver/resource')
     j.server = 'anotherserver'
     self.check_jid(j, domain='anotherserver')
     j.host = 'yetanother'
     self.check_jid(j, domain='yetanother')
Example #3
0
 def test_jid_bare_user(self):
     """Test setting the bare JID with a user."""
     j = JID('user@domain/resource')
     j.bare = 'otheruser@otherdomain'
     self.check_jid(j, 'otheruser', 'otherdomain', 'resource',
                    'otheruser@otherdomain',
                    'otheruser@otherdomain/resource',
                    'otheruser@otherdomain/resource')
Example #4
0
 def test_jid_set_full_with_user(self):
     """Test setting the full JID with a user portion."""
     j = JID('user@domain/resource')
     j.full = 'otheruser@otherdomain/otherresource'
     self.check_jid(j, 'otheruser', 'otherdomain', 'otherresource',
                    'otheruser@otherdomain',
                    'otheruser@otherdomain/otherresource',
                    'otheruser@otherdomain/otherresource')
Example #5
0
 def test_jid_change(self):
     """Test changing JID of the form 'user@server/resource/with/slashes'"""
     j = JID('user1@someserver1/some1/resource1')
     j.user = '******'
     j.domain = 'someserver'
     j.resource = 'some/resource'
     self.check_jid(j, 'user', 'someserver', 'some/resource',
                    'user@someserver', 'user@someserver/some/resource',
                    'user@someserver/some/resource')
Example #6
0
 def test_jid_full_no_user_no_resource(self):
     """
     Test setting the full JID without a user
     portion and without a resource.
     """
     j = JID('user@domain/resource')
     j.full = 'otherdomain'
     self.check_jid(j, '', 'otherdomain', '', 'otherdomain', 'otherdomain',
                    'otherdomain')
Example #7
0
 def test_jid_set_full_with_user(self):
     """Test setting the full JID with a user portion."""
     j = JID('user@domain/resource')
     j.full = 'otheruser@otherdomain/otherresource'
     self.check_jid(j,
                    'otheruser',
                    'otherdomain',
                    'otherresource',
                    'otheruser@otherdomain',
                    'otheruser@otherdomain/otherresource',
                    'otheruser@otherdomain/otherresource')
Example #8
0
 def test_jid_bare_no_user(self):
     """Test setting the bare JID without a user."""
     j = JID('user@domain/resource')
     j.bare = 'otherdomain'
     self.check_jid(j,
                    '',
                    'otherdomain',
                    'resource',
                    'otherdomain',
                    'otherdomain/resource',
                    'otherdomain/resource')
Example #9
0
 def test_jid_change(self):
     """Test changing JID of the form 'user@server/resource/with/slashes'"""
     j = JID('user1@someserver1/some1/resource1')
     j.user = '******'
     j.domain = 'someserver'
     j.resource = 'some/resource'
     self.check_jid(j,
                    'user',
                    'someserver',
                    'some/resource',
                    'user@someserver',
                    'user@someserver/some/resource',
                    'user@someserver/some/resource')
Example #10
0
 def test_jid_full_no_user_no_resource(self):
     """
     Test setting the full JID without a user
     portion and without a resource.
     """
     j = JID('user@domain/resource')
     j.full = 'otherdomain'
     self.check_jid(j,
                    '',
                    'otherdomain',
                    '',
                    'otherdomain',
                    'otherdomain',
                    'otherdomain')
Example #11
0
 def test_get_jid_aliases(self):
     """Test JID aliases."""
     j = JID('user@someserver/resource')
     self.assertEqual(j.server, j.host)
     self.assertEqual(j.server, j.domain)
     self.assertEqual(j.user, j.node)
     self.assertEqual(j.full, j.jid)
Example #12
0
 def test_jid_from_domain_and_resource(self):
     """Test using JID of the form 'user@domain'."""
     self.check_jid(JID('domain/resource'), '', 'domain', 'resource',
                    'domain', 'domain/resource', 'domain/resource')
Example #13
0
 def test_jid_no_resource(self):
     """Test using JID of the form 'user@domain'."""
     self.check_jid(JID('user@someserver'), 'user', 'someserver', '',
                    'user@someserver', 'user@someserver', 'user@someserver')
Example #14
0
 def test_jid_no_user(self):
     """Test JID of the form 'component.domain.tld'."""
     self.check_jid(JID('component.someserver'), '', 'component.someserver',
                    '', 'component.someserver', 'component.someserver',
                    'component.someserver')
Example #15
0
 def test_jid_equality(self):
     """Test that JIDs with the same content are equal."""
     jid1 = JID('user@domain/resource')
     jid2 = JID('user@domain/resource')
     self.assertTrue(jid1 == jid2, "Same JIDs are not considered equal")
     self.assertFalse(jid1 != jid2, "Same JIDs are considered not equal")
Example #16
0
 def test_jid_inequality(self):
     jid1 = JID('user@domain/resource')
     jid2 = JID('otheruser@domain/resource')
     self.assertFalse(jid1 == jid2, "Same JIDs are not considered equal")
     self.assertTrue(jid1 != jid2, "Same JIDs are considered not equal")
Example #17
0
 def test_jid_from_full(self):
     """Test using JID of the form 'user@server/resource/with/slashes'."""
     self.check_jid(JID('user@someserver/some/resource'), 'user',
                    'someserver', 'some/resource', 'user@someserver',
                    'user@someserver/some/resource',
                    'user@someserver/some/resource')
Example #18
0
 def test_jid_from_domain(self):
     """Test using JID of the form 'user@domain'."""
     self.check_jid(JID('domain'), '', 'domain', '', 'domain', 'domain',
                    'domain')