| author | Simon Descarpentries <sid@sopinspace.com> |
| Tue, 06 May 2014 13:52:01 +0200 | |
| changeset 651 | 9bbc657f6837 |
| parent 606 | 52f3e090eed9 |
| permissions | -rw-r--r-- |
| 0 | 1 |
from django.core import mail |
2 |
from django.test import TestCase |
|
3 |
from django.test.client import Client |
|
4 |
from django.core import management |
|
5 |
||
6 |
from cm.models import * |
|
7 |
from cm.models_utils import * |
|
8 |
||
9 |
class NotificationTest(TestCase): |
|
|
606
52f3e090eed9
make django tests working again, from ymh, see http://www.iri.centrepompidou.fr/dev/hg/comt/rev/e103299bccc0
gibus
parents:
278
diff
changeset
|
10 |
fixtures = ['initial_data', 'roles_generic','test_content'] |
| 0 | 11 |
|
| 27 | 12 |
def setUp(self): |
13 |
pass |
|
14 |
||
15 |
def test_simple_notification(self): |
|
| 0 | 16 |
c = Client() |
17 |
c.login(username='user1', password='test') |
|
| 27 | 18 |
self.assertEquals(len(Notification.objects.all()), 0) |
| 0 | 19 |
|
| 27 | 20 |
# subscribe to workspace notifications |
| 68 | 21 |
response = c.post('/followup/', {'notif_id': u'workspace_notify_check', |
| 278 | 22 |
'workspace_notify_check': u'true', |
| 68 | 23 |
}) |
| 0 | 24 |
|
| 27 | 25 |
self.assertEquals(len(Notification.objects.all()), 1) |
26 |
||
27 |
# subscribe to own notifications |
|
| 68 | 28 |
response = c.post('/followup/', {'notif_id': u'own_notify_check', |
29 |
'own_notify_check': u'true', |
|
30 |
}) |
|
| 27 | 31 |
|
32 |
self.assertEquals(len(Notification.objects.all()), 2) |
|
33 |
||
34 |
self.assertEquals(len(mail.outbox), 0) |
|
35 |
||
| 0 | 36 |
c.post('/client/', {'content' : 'sdf', |
| 27 | 37 |
'end_offset' : 19, |
| 0 | 38 |
'end_wrapper' : 0, |
39 |
'format' : 'markdown', |
|
40 |
'fun' : 'addComment', |
|
41 |
'key' : 'text_key_1', |
|
| 68 | 42 |
'version_key' : 'textversion_key_1', |
| 27 | 43 |
'start_offset' : 16, |
| 0 | 44 |
'start_wrapper' : 0, |
| 27 | 45 |
'title' : 'sdf', |
46 |
'tags': '', |
|
| 0 | 47 |
}) |
48 |
self.assertEquals(len(mail.outbox), 1) |
|
49 |