test_models.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:volla 作者: sgrowe 项目源码 文件源码
def test_author_of_first_chunk_must_also_be_vollume_author(self):
        vollume = Vollume(
            author=create_and_save_dummy_user(username='Mickey'),
            title='Top dollar mate'
        )
        vollume.save()
        chunk = VollumeChunk(
            vollume=vollume,
            author=create_and_save_dummy_user(username='Steves'),
            text="Huh? Yeah, I just feel like... you know when you roll a blinding spliff?"
        )
        with self.assertRaises(ValidationError) as caught:
            chunk.full_clean()
        error_messages = caught.exception.message_dict[NON_FIELD_ERRORS]
        self.assertIn("The author of the first paragraph of a Vollume must also be the Vollume author.", error_messages)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号