From d0c506f93010f62cd447ce29f98ab991f521ec99 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Fri, 5 Nov 2010 14:45:58 -0400 Subject: Simplified SleekTest. * check_stanza does not require stanza_class parameter. Introspection! * check_message, check_iq, and check_presence removed -- use check instead. * stream_send_stanza, stream_send_message, stream_send_iq, and stream_send_presence removed -- use send instead. * Use recv instead of recv_message, recv_presence, etc. * check_jid instead of check_JID * stream_start may accept multi=True to return a new SleekTest instance for testing multiple streams at once. --- tests/test_stream_roster.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/test_stream_roster.py') diff --git a/tests/test_stream_roster.py b/tests/test_stream_roster.py index 6eda7e3e..165a8bc9 100644 --- a/tests/test_stream_roster.py +++ b/tests/test_stream_roster.py @@ -20,12 +20,12 @@ class TestStreamRoster(SleekTest): t = threading.Thread(name='get_roster', target=self.xmpp.get_roster) t.start() - self.stream_send_iq(""" + self.send(""" """) - self.stream_recv(""" + self.recv(""" """) - self.stream_send_iq(""" + self.send(""" -- cgit v1.2.3 From 673545c7e48d86b02f811ad239ed317e4bca0bbc Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 26 Oct 2010 23:47:17 -0400 Subject: First pass at integrating the new roster manager. --- tests/test_stream_roster.py | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'tests/test_stream_roster.py') diff --git a/tests/test_stream_roster.py b/tests/test_stream_roster.py index 165a8bc9..8ffd86aa 100644 --- a/tests/test_stream_roster.py +++ b/tests/test_stream_roster.py @@ -13,8 +13,7 @@ class TestStreamRoster(SleekTest): def testGetRoster(self): """Test handling roster requests.""" - self.stream_start(mode='client') - self.failUnless(self.xmpp.roster == {}, "Initial roster not empty.") + self.stream_start(mode='client', jid='tester@localhost') # Since get_roster blocks, we need to run it in a thread. t = threading.Thread(name='get_roster', target=self.xmpp.get_roster) @@ -26,11 +25,12 @@ class TestStreamRoster(SleekTest): """) self.recv(""" - + + subscription="from" + ask="subscribe"> Friends Examples @@ -41,21 +41,20 @@ class TestStreamRoster(SleekTest): # Wait for get_roster to return. t.join() - roster = {'user@localhost': {'name': 'User', - 'subscription': 'both', - 'groups': ['Friends', 'Examples'], - 'presence': {}, - 'in_roster': True}} - self.failUnless(self.xmpp.roster == roster, - "Unexpected roster values: %s" % self.xmpp.roster) + print self.xmpp.rosters['tester@localhost']['user@localhost']._state + self.check_roster('tester@localhost', 'user@localhost', + name='User', + subscription='from', + afrom=True, + pending_out=True, + groups=['Friends', 'Examples']) def testRosterSet(self): """Test handling pushed roster updates.""" - self.stream_start(mode='client') - self.failUnless(self.xmpp.roster == {}, "Initial roster not empty.") + self.stream_start(mode='client', jid='tester@localhost') self.recv(""" - + """) - roster = {'user@localhost': {'name': 'User', - 'subscription': 'both', - 'groups': ['Friends', 'Examples'], - 'presence': {}, - 'in_roster': True}} - self.failUnless(self.xmpp.roster == roster, - "Unexpected roster values: %s" % self.xmpp.roster) - - + self.check_roster('tester@localhost', 'user@localhost', + name='User', + subscription='both', + groups=['Friends', 'Examples']) suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamRoster) -- cgit v1.2.3 From 69d430dd75f526984fd6ea6f9db294731698712c Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 27 Oct 2010 08:09:50 -0400 Subject: Cleaned up names. --- tests/test_stream_roster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test_stream_roster.py') diff --git a/tests/test_stream_roster.py b/tests/test_stream_roster.py index 8ffd86aa..7edaecd1 100644 --- a/tests/test_stream_roster.py +++ b/tests/test_stream_roster.py @@ -41,7 +41,7 @@ class TestStreamRoster(SleekTest): # Wait for get_roster to return. t.join() - print self.xmpp.rosters['tester@localhost']['user@localhost']._state + print self.xmpp.roster['tester@localhost']['user@localhost']._state self.check_roster('tester@localhost', 'user@localhost', name='User', subscription='from', -- cgit v1.2.3 From 5424ede413393db5b835686e8544a9b703fb113b Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 27 Oct 2010 15:02:21 -0400 Subject: More cleanup. --- tests/test_stream_roster.py | 1 - 1 file changed, 1 deletion(-) (limited to 'tests/test_stream_roster.py') diff --git a/tests/test_stream_roster.py b/tests/test_stream_roster.py index 7edaecd1..dffd6713 100644 --- a/tests/test_stream_roster.py +++ b/tests/test_stream_roster.py @@ -41,7 +41,6 @@ class TestStreamRoster(SleekTest): # Wait for get_roster to return. t.join() - print self.xmpp.roster['tester@localhost']['user@localhost']._state self.check_roster('tester@localhost', 'user@localhost', name='User', subscription='from', -- cgit v1.2.3