本文整理汇总了Python中blogengine.models.Post.content方法的典型用法代码示例。如果您正苦于以下问题:Python Post.content方法的具体用法?Python Post.content怎么用?Python Post.content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blogengine.models.Post
的用法示例。
在下文中一共展示了Post.content方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_delete_post
# 需要导入模块: from blogengine.models import Post [as 别名]
# 或者: from blogengine.models.Post import content [as 别名]
def test_delete_post(self):
# create the author
author = User.objects.create_user('testuser', '[email protected]', 'password')
author.save()
# create a site
site = Site()
site.name = 'example.com'
site.domain = 'example.com'
site.save()
# create post
post = Post()
post.title = 'Delete Test'
post.content = 'Test post for delete test'
post.author = author
post.pub_date = timezone.now()
post.slug = 'delete-test'
post.site = site
post.save()
# check the post is saved
all_post = Post.objects.all()
self.assertEquals(len(all_post), 1)
only_post = all_post[0]
# login
self.client.login(username='ngtest', password='password')
# delete post
response = self.client.post('/admin/blogengine/post/1/delete/', dict(post='yes'), follow=True)
self.assertEquals(response.status_code, 200)
self.assertTrue('deleted successfully' in response.content)
all_post = Post.objects.all()
self.assertNotEquals(len(all_post), 1)