Esempio n. 1
0
 def test_one(self):
     user = User.objects.create(username='******')
     request = Mock()
     request.user = user
     pm = PM.objects.create(subject='test', sender=user)
     rec = Recipient.objects.create(message=pm, recipient=user)
     self.assertEqual(new_pm(request)['new_pms'], 1)
     rec.read = True
     rec.save()
     self.assertEqual(new_pm(request)['new_pms'], 0)
 def test_one(self):
     user = User.objects.create(username='******')
     request = Mock()
     request.user = user
     pm = PM.objects.create(subject = 'test', sender=user)
     rec = Recipient.objects.create(message=pm, recipient=user)
     self.assertEqual(new_pm(request)['new_pms'], 1)
     rec.read = True
     rec.save()
     self.assertEqual(new_pm(request)['new_pms'], 0)
 def test_anon(self):
     req = Mock()
     req.user.is_authenticated = lambda : False
     npm = new_pm(req)
     assert(npm == { 'new_pms' : 0})
Esempio n. 4
0
 def test_anon(self):
     req = Mock()
     req.user.is_authenticated = lambda: False
     npm = new_pm(req)
     assert (npm == {'new_pms': 0})