Esempio n. 1
0
    def test_save_new_post_timestamps(self):
        """
        Saving a new post should not allow you to override auto_add_now- and
        auto_now-like functionality.
        """
        created_ = datetime.datetime(1992, 1, 12, 10, 12, 32)
        p = post_(thread=self.thread, content='bar', creator=self.user,
                  created=created_, updated=created_)
        p.save()

        now = datetime.datetime.now()
        self.assertDateTimeAlmostEqual(now, p.created, self.delta)
        self.assertDateTimeAlmostEqual(now, p.updated, self.delta)
Esempio n. 2
0
    def test_save_new_post_timestamps(self):
        """
        Saving a new post should not allow you to override auto_add_now- and
        auto_now-like functionality.
        """
        created_ = datetime.datetime(1992, 1, 12, 10, 12, 32)
        p = post_(thread=self.thread, content='bar', creator=self.user,
                  created=created_, updated=created_)
        p.save()

        now = datetime.datetime.now()
        self.assertDateTimeAlmostEqual(now, p.created, self.delta)
        self.assertDateTimeAlmostEqual(now, p.updated, self.delta)
Esempio n. 3
0
    def test_edit_post_moderator(self):
        """Editing post as a moderator works."""
        u = user(save=True)
        add_permission(u, Post, 'change_post')
        self.client.login(username=u.username, password='******')

        p = post_(save=True)
        t = p.thread
        d = t.document

        r = post(self.client, 'wiki.discuss.edit_post',
                 {'content': 'More new content'}, args=[d.slug, t.id, p.id])
        eq_(200, r.status_code)

        edited_p = Post.uncached.get(pk=p.pk)
        eq_('More new content', edited_p.content)
Esempio n. 4
0
 def test_content_parsed_sanity(self):
     """The content_parsed field is populated."""
     p = post_(content='yet another post', save=True)
     eq_('<p>yet another post\n</p>', p.content_parsed)
Esempio n. 5
0
 def test_content_parsed_sanity(self):
     """The content_parsed field is populated."""
     p = post_(content='yet another post', save=True)
     eq_('<p>yet another post\n</p>', p.content_parsed)