Esempio n. 1
0
    def test_not_anonymous_form(self):
        idea = create_idea()
        data = get_valid_form_data(idea)

        f = MPTTCommentForm(idea, data=data)
        c = f.get_comment_object()
        self.assertTrue(isinstance(c, MPTTComment))
        self.assertEqual(c.is_anonymous, False)
Esempio n. 2
0
    def test_not_anonymous_form(self):
        idea = create_idea()
        data = get_valid_form_data(idea)

        f = MPTTCommentForm(idea, data=data)
        c = f.get_comment_object()
        self.assertTrue(isinstance(c, MPTTComment))
        self.assertEqual(c.is_anonymous, False)
Esempio n. 3
0
    def test_anonymous_form(self):
        idea = create_idea()
        data = get_valid_form_data(idea)
        data['is_anonymous'] = True

        f = MPTTCommentForm(idea, data=data)
        c = f.get_comment_object()
        self.assertTrue(isinstance(c, MPTTComment))
        self.assertEqual(c.is_anonymous, True)
        # (It is up to the front end to hide the name)
        self.assertEqual(c.user_name, data['name'])
Esempio n. 4
0
    def test_anonymous_form(self):
        idea = create_idea()
        data = get_valid_form_data(idea)
        data['is_anonymous'] = True

        f = MPTTCommentForm(idea, data=data)
        c = f.get_comment_object()
        self.assertTrue(isinstance(c, MPTTComment))
        self.assertEqual(c.is_anonymous, True)
        # (It is up to the front end to hide the name)
        self.assertEqual(c.user_name, data['name'])
Esempio n. 5
0
    def test_anonymous_comment_hidden_name(self):
        idea = create_idea()
        data = get_valid_form_data(idea)
        data['is_anonymous'] = True

        f = MPTTCommentForm(idea, data=data)
        c = f.get_comment_object()
        c.save()

        create_superuser()
        login(self)
        resp = self.client.get(reverse('idea:idea_detail', args=(idea.id, )))
        self.assertFalse(data['name'] in resp.content)

        # add a second comment where anonymous = False
        data['is_anonymous'] = False
        data['comment'] = "new comment"
        f = MPTTCommentForm(idea, data=data)
        c = f.get_comment_object()
        c.save()

        resp = self.client.get(reverse('idea:idea_detail', args=(idea.id, )))
        self.assertTrue(data['name'] in resp.content)
Esempio n. 6
0
    def test_anonymous_comment_hidden_name(self):
        idea = create_idea()
        data = get_valid_form_data(idea)
        data['is_anonymous'] = True

        f = MPTTCommentForm(idea, data=data)
        c = f.get_comment_object()
        c.save()

        create_superuser()
        login(self)
        resp = self.client.get(reverse('idea:idea_detail', args=(idea.id,)))
        self.assertFalse(data['name'] in resp.content)

        # add a second comment where anonymous = False
        data['is_anonymous'] = False
        data['comment'] = "new comment"
        f = MPTTCommentForm(idea, data=data)
        c = f.get_comment_object()
        c.save()

        resp = self.client.get(reverse('idea:idea_detail', args=(idea.id,)))
        self.assertTrue(data['name'] in resp.content)