def setUp(self): diary_entry = Diary.objects.create( body="What I did on October...", allow_comments=True, publish=datetime.now()) form = django_comments.get_form()(diary_entry) self.user = User.objects.create_user("bob", "*****@*****.**", "pwd") data = {"name": "Bob", "email": "*****@*****.**", "followup": True, "reply_to": 0, "level": 1, "order": 1, "comment": "Es war einmal eine kleine..."} data.update(form.initial) post_diary_comment(data, diary_entry, auth_user=self.user)
def post_valid_data(self, auth_user=None): data = {"name": "Bob", "email": "*****@*****.**", "followup": True, "reply_to": 0, "level": 1, "order": 1, "comment": "Es war einmal eine kleine..."} data.update(self.form.initial) response = post_diary_comment(data, self.diary_entry, auth_user=auth_user) self.assertEqual(response.status_code, 302) self.assertTrue(response.url.startswith('/comments/posted/?c='))