本文整理汇总了Python中blogengine.models.Category.descritption方法的典型用法代码示例。如果您正苦于以下问题:Python Category.descritption方法的具体用法?Python Category.descritption怎么用?Python Category.descritption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blogengine.models.Category
的用法示例。
在下文中一共展示了Category.descritption方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_create_post
# 需要导入模块: from blogengine.models import Category [as 别名]
# 或者: from blogengine.models.Category import descritption [as 别名]
def test_create_post(self):
#create category
category = Category()
category.name = 'python'
category.descritption = 'python'
category.save()
#create tag
tag = Tag()
tag.name = 'python'
tag.description = 'python'
tag.save()
self.client.login(username='bobsmith',password='password')
response = self.client.get( '/admin/blogengine/post/add/')
self.assertEquals(response.status_code,200)
response = self.client.post('/admin/blogengine/post/add/',{
'title':'My first Post',
'text' :'this is my first post text',
'pub_date_0':'2014-10-07',
'pub_date_1':'22:00:04',
'slug':'my-first-test',
'category': Category.objects.all()[0].id,
'tags':Tag.objects.all()[0].id,
},
follow=True)
self.assertEqual(response.status_code,200)
self.assertTrue( 'success' in response.content )
all_posts = Post.objects.all()
self.assertEquals(len(all_posts), 1)
示例2: test_edit_post
# 需要导入模块: from blogengine.models import Category [as 别名]
# 或者: from blogengine.models.Category import descritption [as 别名]
def test_edit_post(self):
#create category
category = Category()
category.name = 'python'
category.descritption = 'python'
category.save()
#create author
author = User.objects.create_user('testuser','[email protected]','password')
author.save()
#create tag
tag = Tag()
tag.name = 'python'
tag.description = 'python'
tag.save()
post = Post()
post.title = 'My first Post'
post.text = 'first blog post'
post.pub_date = timezone.now()
post.author = author
post.category = category
post.save()
post.tags.add(tag)
post.save()
self.client.login(username='bobsmith',password='password')
url = '/admin/blogengine/post/%d/' % Post.objects.all()[0].id
response = self.client.post(url,{
'title':'my second post',
'text':'this is my second post',
'pub_date_0':'2014-10-9',
'pub_date_1':'22:00:04',
'slug':'my-first-test',
'category': Category.objects.all()[0].id,
'tags' : Tag.objects.all()[0].id,
},follow=True)
self.assertEquals(response.status_code,200)
self.assertTrue('changed successfully' in response.content)
all_posts = Post.objects.all()
self.assertEquals(len(all_posts),1)
self.assertEquals(all_posts[0].title,'my second post'),
self.assertEquals(all_posts[0].text,'this is my second post')
示例3: test_edit_category
# 需要导入模块: from blogengine.models import Category [as 别名]
# 或者: from blogengine.models.Category import descritption [as 别名]
def test_edit_category(self):
category = Category()
category.name = 'python'
category.descritption = 'python'
category.save()
self.client.login(username='bobsmith',password='password')
url = '/admin/blogengine/category/%d/' % Category.objects.all()[0].id
r = self.client.post(url,{
'name':'peee',
'description':'asdf'
},follow=True)
self.assertEquals(r.status_code,200)
self.assertTrue( 'success' in r.content)
self.assertEquals(len(Category.objects.all()),1)
self.assertEquals(Category.objects.all()[0].name,'peee')
self.assertEquals(Category.objects.all()[0].description,'asdf')
示例4: test_post_page
# 需要导入模块: from blogengine.models import Category [as 别名]
# 或者: from blogengine.models.Category import descritption [as 别名]
def test_post_page(self):
#create category
category = Category()
category.name = 'python'
category.descritption = 'python'
category.save()
#tag
tag = Tag()
tag.name = 'python'
tag.description = 'not perl'
tag.save()
#create author
author = User.objects.create_user('adsf','[email protected]','asdf')
author.save()
post = Post()
post.title = 'my first page'
post.text = 'This is my [first blog post](http://localhost:8000/)'
post.pub_date = timezone.now()
post.slug = 'my-first-post'
post.author = author
post.category = category
post.save()
post.tags.add(tag)
post.save()
self.assertEquals(len(Post.objects.all()),1)
self.assertEqual(Post.objects.all()[0],post)
p = Post.objects.all()[0]
p_url = p.get_absolute_url()
r = self.client.get(p_url)
self.assertEquals(r.status_code,200)
self.assertTrue(post.title in r.content)
self.assertTrue(post.category.name in r.content)
self.assertTrue(markdown.markdown(post.text) in r.content)
self.assertTrue( str(post.pub_date.year) in r.content)
self.assertTrue( str(post.pub_date.day) in r.content)
self.assertTrue(tag.name in r.content)
self.assertTrue( '<a href="http://localhost:8000/">first blog post</a>' in r.content)
示例5: test_index
# 需要导入模块: from blogengine.models import Category [as 别名]
# 或者: from blogengine.models.Category import descritption [as 别名]
def test_index(self):
#create category
category = Category()
category.name = 'python'
category.descritption = 'python'
category.save()
#create tag
tag = Tag()
tag.name = 'perl'
tag.description = 'perl'
tag.save()
author = User.objects.create_user('test','[email protected]','test')
author.save()
post = Post()
post.title = 'first post'
post.text = 'this is [my first blog post](http://localhost:8000/)'
post.pub_date = timezone.now()
post.author = author
post.category = category
post.save()
post.tags.add(tag)
post.save()
self.assertEqual(len(Post.objects.all()),1)
r = self.client.get('/')
self.assertEquals(r.status_code,200)
self.assertTrue( post.category.name in r.content)
self.assertTrue( Tag.objects.all()[0].name in r.content)
self.assertTrue( post.title in r.content)
self.assertTrue( markdown.markdown(post.text) in r.content)
self.assertTrue( str(post.pub_date.year) in r.content)
self.assertTrue( str(post.pub_date.day) in r.content)
#Check the link is makred down properly
self.assertTrue('<a href="http://localhost:8000/">my first blog post</a>' in r.content)
示例6: test_delete_post
# 需要导入模块: from blogengine.models import Category [as 别名]
# 或者: from blogengine.models.Category import descritption [as 别名]
def test_delete_post(self):
#create category
category = Category()
category.name = 'python'
category.descritption = 'python'
category.save()
#create user
author = User.objects.create_user('testuser','[email protected]','password')
author.save()
#creat tag
tag = Tag()
tag.name = 'python'
tag.description = 'python'
tag.save()
post = Post()
post.title = 'first'
post.text = 'first text'
post.pub_date = timezone.now()
post.author = author
post.category = category
post.save()
post.tags.add(tag)
post.save()
self.assertEquals( len(Post.objects.all()) ,1)
self.client.login(username='bobsmith',password='password')
url = '/admin/blogengine/post/%d/delete/' % Post.objects.all()[0].id
r = self.client.post(url,{'post':'yes'},follow=True)
self.assertEquals(r.status_code,200)
self.assertEqual(len(Post.objects.all()),0)