Exemple #1
0
 def test_comment_post_save(self):
     content_type = ContentType.objects.get(model='issue')
     comment = Comment()
     comment.user_name = self.user.username
     comment.user_email = self.user.email
     comment.content_type = content_type
     comment.object_pk = 1
     comment.comment = "This is a test comment"
     comment.site = Site.objects.get(id=settings.SITE_ID)
     comment.save()
Exemple #2
0
 def test_notify_on_comment(self):
     # post some comment
     comment = Comment()
     content_type = ContentType.objects.get(model='issue')
     comment = Comment()
     comment.user_name = 'somebody'
     comment.user_email = '*****@*****.**'
     comment.content_type = content_type
     comment.object_pk = 1
     comment.comment = "This is a test comment"
     comment.site = Site.objects.get(id=settings.SITE_ID)
     comment.save()
     
     self.assertEquals(len(mail.outbox), 3)        
     self.check_outbox(self.recipient_list, "DjTracker: [unittest-project]: New Comment on Issue #1 by somebody", comment.comment)        
Exemple #3
0
 def test_comment_with_status_change(self):
     global _global_signal_recorder
     self.test_create_issue() # just to create an issue
     content_type = ContentType.objects.get(model='issue')
     comment = Comment()
     comment.user_name = self.user.username
     comment.user_email = self.user.email
     comment.content_type = content_type
     comment.object_pk = 2
     comment.comment = "This is a test comment with status change"
     comment.status = models.Status.objects.get(pk=2)
     comment.site = Site.objects.get(id=settings.SITE_ID)
     comment.save()
     
     self.assertEquals(len(_global_signal_recorder), 2)
     action, comment, issue, status_change, request = _global_signal_recorder[1]
     self.assertEquals(status_change[0].pk,1)
     self.assertEquals(status_change[1].pk,2)
Exemple #4
0
 def test_comment_post_save(self):
     global _global_signal_recorder        
     content_type = ContentType.objects.get(model='issue')
     comment = Comment()
     comment.user_name = self.user.username
     comment.user_email = self.user.email
     comment.content_type = content_type
     comment.object_pk = 1
     comment.comment = "This is a test comment"
     comment.site = Site.objects.get(id=settings.SITE_ID)
     comment.save()
     self.assertEquals(len(_global_signal_recorder), 1)
     action, comment, issue, status_change, request = _global_signal_recorder[0]
     self.assertEquals(action, 'commented')
     self.assertEquals(comment.comment, "This is a test comment")
     self.assertEquals(issue.pk, 1)
     self.assertEquals(status_change, None)
     self.assertEquals(request, None)