예제 #1
0
def base():
    from app import db
    db.drop_all()
    db.create_all()
    Role.insert_roles()
    from app.models import User
    user = User(email='[email protected],
                username='******',
                password='******',
                confirmed=True)
    db.session.add(user)
    db.session.commit()
    Category.generate_fake()
    Tag.generate_fake()
    Post.generate_fake(100)
    BlogInfo.insert_system_indo()

    # 统计分类和标签的文章数量
    Category.category_count()
    Tag.tags_count()
    User.articles_count()
예제 #2
0
def categoryfake():
    Category.generate_fake()
예제 #3
0
def fake():
    User.generate_fake()
    Category.generate_fake()
    Post.generate_fake()
    Comment.generate_fake()
예제 #4
0
 def test_02_generate_category(self):
     """测试批量创建分类"""
     Category.generate_fake(20)
     self.assertTrue(Category.query.count() == 20)
예제 #5
0
 def test_10_generate_post(self):
     """测试批量增加文章"""
     Tag.generate_fake(40)
     Category.generate_fake(30)
     Post.generate_fake()
     self.assertTrue(Post.query.count() == 30)
예제 #6
0
 def test_10_generate_post(self):
     """测试批量增加文章"""
     Tag.generate_fake(40)
     Category.generate_fake(30)
     Post.generate_fake()
     self.assertTrue(Post.query.count() == 30)