changeset 2947:a7ed0a410ced

Add a test for handle_user_created
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Thu, 29 Nov 2007 17:39:12 +0100
parents 1ed67dfb686c
children 361c8b582018
files MoinMoin/events/_tests/test_events.py
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/events/_tests/test_events.py	Fri Nov 09 08:45:59 2007 +0100
+++ b/MoinMoin/events/_tests/test_events.py	Thu Nov 29 17:39:12 2007 +0100
@@ -48,6 +48,21 @@
     py.test.raises(notification.UnknownChangeType, notification.page_change_message,
                    "StupidType", request, page, "en", revisions=page.getRevList())
 
+def test_user_created_event(request):
+    class server_dummy:
+        def __init__(self):
+            self.sent = False
+
+        def send_notification(self, *args):
+            self.sent = True
+
+    event = events.UserCreatedEvent(request, User(request))
+    request.cfg.notification_server = server_dummy()
+    request.cfg.secret = "dummy"
+
+    jabbernotify.handle_user_created(event)
+    assert request.cfg.notification_server.sent is True
+
 def test_filter_subscriber_list(request):
     user = User(request)
     event = events.Event(request)