Back to index

moin  1.9.0~rc2
test_xmlrpcbot.py
Go to the documentation of this file.
00001 # -*- coding: iso-8859-1 -*-
00002 """
00003     MoinMoin - XMLRPC bot tests
00004 
00005     @copyright: 2007 by Karol Nowak <grywacz@gmail.com>
00006     @license: GNU GPL, see COPYING for details.
00007 """
00008 
00009 import py
00010 from Queue import Queue
00011 
00012 try:
00013     import pyxmpp
00014 except ImportError:
00015     py.test.skip("Skipping jabber bot tests - pyxmpp is not installed")
00016 
00017 import jabberbot.xmlrpcbot as xmlrpcbot
00018 from jabberbot.config import BotConfig
00019 
00020 
00021 class TestXMLRPCBotAPIs:
00022     def setup_class(self):
00023         self.queue_in = Queue()
00024         self.queue_out = Queue()
00025         self.bot = xmlrpcbot.XMLRPCClient(BotConfig, self.queue_in, self.queue_out)
00026 
00027     def testReportError(self):
00028         print "report_error() should put a command in the output queue"
00029         self.bot.report_error(["dude@example.com"], "Error %(err)s!", data={'err': 'bar!'})
00030         self.queue_out.get(False)
00031 
00032     def testWanrNoCredentials(self):
00033         print "warn_no_credentials() should put a command in the output queue"
00034         self.bot.warn_no_credentials(["dude@example.com"])
00035         self.queue_out.get(False)
00036