Exemple #1
0
    def test_empty_comment_form(self):
        """empty comment should send user to preview form"""
        self.c.login(username='******', password='******')

        # all this bullshit to create an empty f*****g comment
        data = {'content_type': 'stories.story',
                'object_pk': '1',
                'timestamp': str(int(time.time())),
                'comment': ''}
        csf = CommentSecurityForm(self.story)
        security_hash = csf.generate_security_hash(data['content_type'],
                                                   data['object_pk'],
                                                   data['timestamp'])
        data['security_hash'] = security_hash
        response = self.c.post('/comments/post/', data)
        self.assertTemplateUsed(response, 'comments/preview.html')