changeset 2316:02824b69a95c

Merge with my devel branch.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Fri, 22 Jun 2007 19:00:44 +0200
parents e8b6de8fbcb4 (current diff) 69ed234c3241 (diff)
children 062b76cf8d48
files
diffstat 3 files changed, 19 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_events.py	Fri Jun 22 17:59:11 2007 +0200
+++ b/MoinMoin/_tests/test_events.py	Fri Jun 22 19:00:44 2007 +0200
@@ -9,13 +9,12 @@
 from MoinMoin.request.CLI import Request
 import MoinMoin.events as events
 
-def test_get_handlers():
+def test_get_handlers(request):
     """Test if there are any event handlers. There should be some internal ones"""
     
-    request = Request()
-    assert(events.get_handlers(request.cfg))
+    assert events.get_handlers(request.cfg)
 
-def test_send_event():
+def test_send_event(request):
     """Test if event handlers are called and if proper messages are returned"""
     
     return_string = u"test_send_event"
@@ -23,15 +22,16 @@
     def event_handler(event):
         return return_string
     
-    request = Request()
     request.cfg.event_handlers = [event_handler]
     event = events.Event(request)
     
     print "A proper event handler should be called, and an 1-element list of messages returned"
-    assert(events.send_event(event)[0] == return_string)
+    assert events.send_event(event)[0] == return_string
 
-def test_subscribable_events():
+def test_subscribable_events(request):
     """Test if there are any subscribable events. There should be some."""
     
     print "There should be at least a few subscribable events!"
-    assert(events.get_subscribable_events())
+    assert events.get_subscribable_events()
+    
+coverage_modules = ["MoinMoin.events"]
--- a/MoinMoin/_tests/test_xmlrpc_multicall.py	Fri Jun 22 17:59:11 2007 +0200
+++ b/MoinMoin/_tests/test_xmlrpc_multicall.py	Fri Jun 22 19:00:44 2007 +0200
@@ -7,14 +7,13 @@
 """
 
 from MoinMoin.xmlrpc import XmlRpcBase
-from MoinMoin.request.CLI import Request
 from xmlrpclib import Fault
 
 def xmlrpc_return_fault():
     return Fault(666, "Fault description")
 
-def test_fault_serialization():
-    xmlrpc = XmlRpcBase(Request())
+def test_fault_serialization(request):
+    xmlrpc = XmlRpcBase(request)
     xmlrpc.xmlrpc_return_fault = xmlrpc_return_fault
     args = [{'methodName': 'return_fault', 'params': [ ]}]
     
@@ -23,6 +22,5 @@
     8b7d6d70fc95 for details"""
     
     result = xmlrpc.xmlrpc_system_multicall(args)
-    assert(type(result[0]) == dict)
-    assert(result[0].has_key("faultCode") and result[0].has_key("faultString"))
-    
\ No newline at end of file
+    assert type(result[0]) == dict
+    assert result[0].has_key("faultCode") and result[0].has_key("faultString")
--- a/MoinMoin/events/jabbernotify.py	Fri Jun 22 17:59:11 2007 +0200
+++ b/MoinMoin/events/jabbernotify.py	Fri Jun 22 19:00:44 2007 +0200
@@ -10,11 +10,12 @@
 
 import xmlrpclib
 
+from MoinMoin import error
+from MoinMoin.Page import Page
 from MoinMoin.user import User, getUserList
-from MoinMoin.Page import Page
+from MoinMoin.events.messages import page_change_message
 
 import MoinMoin.events as ev
-from MoinMoin.events.messages import page_change_message
 
 
 def handle(event):
@@ -23,6 +24,10 @@
     # Check for desired event type and if notification bot is configured
     if not cfg.jabber_enabled:
         return
+    
+    if not cfg.secret:
+        errmsg = "You must set a (long) secret string to send notifications!"
+        raise error.ConfigurationError(errmsg)
 
     if isinstance(event, ev.PageChangedEvent):
         return handle_page_changed(event)