Exemple #1
0
 def test_update_forum_does_not_update_thread(self):
     # Updating/saving an old post in a forum should _not_ update
     # the last_post key in that forum.
     t = ThreadFactory()
     old = PostFactory(thread=t)
     last = PostFactory(thread=t)
     old.content = 'updated content'
     old.save()
     eq_(last.id, t.forum.last_post_id)
Exemple #2
0
 def test_update_post_does_not_update_thread(self):
     # Updating/saving an old post in a thread should _not_ update
     # the last_post key in that thread.
     t = ThreadFactory()
     old = PostFactory(thread=t)
     last = PostFactory(thread=t)
     old.content = "updated content"
     old.save()
     eq_(last.id, old.thread.last_post_id)
Exemple #3
0
 def test_update_forum_does_not_update_thread(self):
     # Updating/saving an old post in a forum should _not_ update
     # the last_post key in that forum.
     t = ThreadFactory()
     old = PostFactory(thread=t)
     last = PostFactory(thread=t)
     old.content = 'updated content'
     old.save()
     eq_(last.id, t.forum.last_post_id)
Exemple #4
0
    def test_save_old_post_no_timestamps(self):
        """Saving an existing post should update the updated date."""
        created = datetime(2010, 5, 4, 14, 4, 22)
        updated = datetime(2010, 5, 4, 14, 4, 31)
        p = PostFactory(thread=self.thread, created=created, updated=updated)

        eq_(updated, p.updated)

        p.content = 'baz'
        p.updated_by = self.user
        p.save()
        now = datetime.now()

        self.assertDateTimeAlmostEqual(now, p.updated, self.delta)
        eq_(created, p.created)
Exemple #5
0
    def test_save_old_post_no_timestamps(self):
        """Saving an existing post should update the updated date."""
        created = datetime(2010, 5, 4, 14, 4, 22)
        updated = datetime(2010, 5, 4, 14, 4, 31)
        p = PostFactory(thread=self.thread, created=created, updated=updated)

        eq_(updated, p.updated)

        p.content = 'baz'
        p.updated_by = self.user
        p.save()
        now = datetime.now()

        self.assertDateTimeAlmostEqual(now, p.updated, self.delta)
        eq_(created, p.created)