# HG changeset patch # User raph # Date 1260286391 -3600 # Node ID 29b90002451ca9f47f993ec83a7b3a9589426c9b # Parent cef8c0caee3ad1f91a3d6b326e5895bfdb14294e fix test notifications diff -r cef8c0caee3a -r 29b90002451c src/cm/tests/test_notifications.py --- a/src/cm/tests/test_notifications.py Tue Dec 08 16:17:41 2009 +0100 +++ b/src/cm/tests/test_notifications.py Tue Dec 08 16:33:11 2009 +0100 @@ -9,23 +9,40 @@ class NotificationTest(TestCase): fixtures = ['roles_generic','test_content'] - def test_global_notification(self): + def setUp(self): + pass + + def test_simple_notification(self): c = Client() c.login(username='user1', password='test') - print Notification.objects.all() + self.assertEquals(len(Notification.objects.all()), 0) - c.post('/notifications/', {'notify_check': u'true'}) + # subscribe to workspace notifications + response = c.post('/notifications/', {'notif_id': u'workspace_notify_check', + 'workspace_notify_check': u'workspace_notify_check', + }) - # ? error ? django tests system bug? + self.assertEquals(len(Notification.objects.all()), 1) + + # subscribe to own notifications + response = c.post('/notifications/', {'notif_id': u'own_notify_check', + 'own_notify_check': u'true', + }) + + self.assertEquals(len(Notification.objects.all()), 2) + + self.assertEquals(len(mail.outbox), 0) + c.post('/client/', {'content' : 'sdf', - 'end_offset' : 11, + 'end_offset' : 19, 'end_wrapper' : 0, 'format' : 'markdown', 'fun' : 'addComment', 'key' : 'text_key_1', - 'start_offset' : 8, + 'start_offset' : 16, 'start_wrapper' : 0, - 'title' : 'sdf', + 'title' : 'sdf', + 'tags': '', }) self.assertEquals(len(mail.outbox), 1)