diff options
author | Stephan Erb <steve-e@h3c.de> | 2009-01-11 16:49:03 +0300 |
---|---|---|
committer | Stephan Erb <steve-e@h3c.de> | 2009-01-11 16:49:03 +0300 |
commit | a757177e452f869938583014649266d804dfcb79 (patch) | |
tree | ddf37a9df347cfa05b49f6c1096b539050f255ac /test/test_dispatcher_nb.py | |
parent | 8a19e11bee032a75affe98c17cbfbd7f1cffce2f (diff) |
Improve code coverage of our testsuites and do some refactoring.
* resolver does not depend on GTK anymore
* renamed a few modules for consistency
* moved all mocks to lib/
* let client_nb test work again. Was broken here
There are many failing tests, help appreciated :-)
Diffstat (limited to 'test/test_dispatcher_nb.py')
-rw-r--r-- | test/test_dispatcher_nb.py | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/test/test_dispatcher_nb.py b/test/test_dispatcher_nb.py deleted file mode 100644 index 9af6717b8..000000000 --- a/test/test_dispatcher_nb.py +++ /dev/null @@ -1,55 +0,0 @@ -# tests for xmpppy's dispatcher_nb.py -import unittest - -import lib -lib.setup_env() - -from mock import Mock - -from common.xmpp import dispatcher_nb -from common.xmpp import auth_nb - -class TestDispatcherNB(unittest.TestCase): - def test_unbound_namespace_prefix(self): - '''tests our handling of a message with an unbound namespace prefix''' - d = dispatcher_nb.XMPPDispatcher() - - conn = Mock() - - owner = Mock() - owner._caller = Mock() - owner.defaultNamespace = auth_nb.NS_CLIENT - owner.debug_flags = [] - owner.Connection = conn - owner._component = False - - d._owner = owner - d.plugin(owner) - - msgs = [] - - def _got_message(conn, msg): - msgs.append(msg) - - d.RegisterHandler('message', _got_message) - - d.StreamInit() - - d.ProcessNonBlocking("<stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client'>") - - # should be able to parse a normal message - d.ProcessNonBlocking('<message><body>hello</body></message>') - self.assertEqual(1, len(msgs)) - - d.ProcessNonBlocking('<message><x:y/></message>') - # we should not have been disconnected after that message - self.assertEqual(0, len(conn.mockGetNamedCalls('pollend'))) - - # we should be able to keep parsing - d.ProcessNonBlocking('<message><body>still here?</body></message>') - self.assertEqual(3, len(msgs)) - -if __name__ == '__main__': - unittest.main() - -# vim: se ts=3: |