--- a/Allura/allura/tests/model/test_discussion.py
+++ b/Allura/allura/tests/model/test_discussion.py
@@ -5,6 +5,7 @@
from cStringIO import StringIO
import time
from datetime import datetime
+from cgi import FieldStorage
from pylons import c, g, request, response
from nose.tools import assert_raises, assert_equals, with_setup
@@ -156,6 +157,18 @@
assert 'wiki/_discuss' in att.url()
assert 'attachment/' in att.url()
+ # Test notification in mail
+ t = M.Thread(discussion_id=d._id, subject='Test comment notification')
+ fs = FieldStorage()
+ fs.name='file_info'
+ fs.filename='fake.txt'
+ fs.type = 'text/plain'
+ fs.file=StringIO('this is the content of the fake file\n')
+ p = t.post(text=u'test message', forum= None, subject= '', file_info=fs)
+ ThreadLocalORMSession.flush_all()
+ n = M.Notification.query.get(subject=u'[test:wiki] Test comment notification')
+ assert u'test message\nfake.txt (37 bytes in text/plain)'==n.text
+
@with_setup(setUp, tearDown)
def test_discussion_delete():
d = M.Discussion(shortname='test', name='test')
@@ -202,4 +215,4 @@
assert False, "Expected an anonymous post to fail."
except exc.HTTPUnauthorized:
pass
- p2 = t.post('This post will pass the check.', ignore_security=True)+ p2 = t.post('This post will pass the check.', ignore_security=True)