Commit 4ff3f93d by Őry Máté

dashboard: test notification model

parent c3dcd075
This is a test for {{user.username}}.
Var: {{var}}.
from django.contrib.auth.models import User
from django.test import TestCase
from ..models import Profile
class NotificationTestCase(TestCase):
def setUp(self):
self.u1 = User.objects.create(username='user1')
self.u2 = User.objects.create(username='user2')
def test_notification_send(self):
c1 = self.u1.notification_set.count()
c2 = self.u1.notification_set.count()
profile = self.u1.profile
msg = profile.notify('subj',
{'var': 'testme'})
assert self.u1.notification_set.count() == c1 + 1
assert self.u2.notification_set.count() == c2
assert 'user1' in msg.message
assert 'testme' in msg.message
assert msg in self.u1.notification_set.all()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment