Example #1
0
    def test_content_saved_in_correct_order(self):
        profile = ProfileFactory(guid="1234")
        pinned_content_1 = Content(pinned=True, text="foobar")
        pinned_content_2 = Content(pinned=True, text="foobar")
        pinned_content_3 = Content(pinned=True, text="foobar")
        pinned_content_1.save(author=profile)
        pinned_content_2.save(author=profile)
        pinned_content_3.save(author=profile)

        assert [pinned_content_1.order, pinned_content_2.order, pinned_content_3.order] == [1, 2, 3]
Example #2
0
 def test_raises_on_save_without_user(self):
     content = Content(text="foobar")
     with transaction.atomic(), self.assertRaises(IntegrityError):
         content.save()
Example #3
0
 def test_gets_guid_on_save_with_user(self):
     content = Content(text="foobar")
     content.save(author=ProfileFactory())
     assert content.guid