changeset 2690:248a1ff78c24

Add two silly tests for the xmlrpc bot.
author Karol Nowak <grzywacz@sul.uni.lodz.pl>
date Fri, 17 Aug 2007 04:27:44 +0200
parents da94375a625c
children 64eae2cfb6dc
files jabberbot/_tests/test_xmlrpcbot.py
diffstat 1 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jabberbot/_tests/test_xmlrpcbot.py	Fri Aug 17 04:27:44 2007 +0200
@@ -0,0 +1,34 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - XMLRPC bot tests
+
+    @copyright: 2007 by Karol Nowak <grywacz@gmail.com>
+    @license: GNU GPL, see COPYING for details.
+"""
+from Queue import Queue
+
+try:
+    import pyxmpp
+except ImportError:
+    py.test.skip("Skipping jabber bot tests - pyxmpp is not installed")
+
+import jabberbot.xmlrpcbot as xmlrpcbot
+from jabberbot.config import BotConfig
+
+
+class TestXMLRPCBotAPIs:
+    def setup_class(self):
+        self.queue_in = Queue()
+        self.queue_out = Queue()
+        self.bot = xmlrpcbot.XMLRPCClient(BotConfig, self.queue_in, self.queue_out)
+
+    def testReportError(self):
+        print "report_error() should put a command in the output queue"
+        self.bot.report_error(["dude@example.com"], "Error %(err)s!", data={'err': 'bar!'})
+        self.queue_out.get(False)
+
+    def testWanrNoCredentials(self):
+        print "warn_no_credentials() should put a command in the output queue"
+        self.bot.warn_no_credentials(["dude@example.com"])
+        self.queue_out.get(False)
+