Esempio n. 1
0
 def test_send_comment_no_sender(self):
     bulletin_id = 0;
     pub_date1 = datetime.datetime.now()
     post_text = "This is a back end test in bulletin board"
     posted_by = "Tester Qing"
     bulletin = BulletinPost(bulletin_id=bulletin_id,post_text=post_text,pub_date=pub_date1,posted_by=posted_by)
     bulletin.save()
     reply_text = "This is a back end test about adding comment in one bulletin"
     pub_date = datetime.datetime.now()
     posted_by = ""
     replied_to = bulletin
     comment = BulletinReply(reply_text=reply_text,pub_date=pub_date,posted_by=posted_by,replied_to=replied_to)
     comment.save()
     self.assertFalse(BulletinReply.objects.get(replied_to = bulletin.bulletin_id))
Esempio n. 2
0
 def test_send_comment(self):
     bulletin_id = 0;
     pub_date1 = datetime.datetime.now()
     post_text = "This is a back end test in bulletin board"
     posted_by = "Tester Qing"
     bulletin = BulletinPost(bulletin_id=bulletin_id,post_text=post_text,pub_date=pub_date1,posted_by=posted_by)
     bulletin.save()
     #testBulletin = BulletinPost.objects.get(bulletin_id=bulletin_id)
     reply_text = "This is a back end test about adding comment in one bulletin"
     pub_date = datetime.datetime.now()
     posted_by = "Tester2"
     replied_to = bulletin
     comment = BulletinReply(reply_text=reply_text,pub_date=pub_date,posted_by=posted_by,replied_to=replied_to)
     comment.save()
     testComment = BulletinReply.objects.get(replied_to = bulletin.bulletin_id)
     self.assertTrue(testComment.replied_to.bulletin_id == bulletin.bulletin_id)
     self.assertTrue(testComment.replied_to.posted_by == bulletin.posted_by)
     self.assertTrue(testComment.replied_to.pub_date == bulletin.pub_date)