def test_send_notification(self):
self.config.testing_securitypolicy(userid='Tobias', permissive=True)
from dbas.views import send_some_notification as ajax
db_len1 = len(DBDiscussionSession.query(Message).filter(and_(Message.topic == 'Some text for a message',
Message.content == 'Some text for a message')).all())
request = testing.DummyRequest(params={
'recipient': 'Christian',
'title': 'Some text for a message',
'text': 'Some text for a message',
}, matchdict={})
response = ajax(request)
db_len2 = len(DBDiscussionSession.query(Message).filter(and_(Message.topic == 'Some text for a message',
Message.content == 'Some text for a message')).all())
self.assertIsNotNone(response)
self.assertTrue(len(response['error']) == 0)
self.assertTrue(db_len1 != db_len2)
DBDiscussionSession.query(Message).filter(and_(Message.topic == 'Some text for a message',
Message.content == 'Some text for a message')).delete()
transaction.commit()
评论列表
文章目录