Example #1
0
 def setUp(self):
     self.app = create_app('testing')
     self.app_context = self.app.app_context()
     self.app_context.push()
     db.create_all()
     Role.insert_roles()
     self.client = self.app.test_client()
Example #2
0
 def setUp(self):
     self.app = create_app('testing')
     self.app_context = self.app.app_context()
     self.app_context.push()
     db.create_all()
     Role.insert_roles()
     self.client = self.app.test_client(
         use_cookies=True)  # 如果启用了use_cookies就可以像浏览器一样发送cookies
def init():
    from app import Role, User
    db.drop_all()
    db.create_all()
    Role.insert_roles()
    User.generate_admin()
    fake_user(10)
    fake_device(15)
 def setUpClass(cls):
     cls.app = create_app('testing')
     cls.app_context = cls.app.app_context()
     cls.app_context.push()
     db.create_all()
     Role.insert_roles()
     cls.acc = Account(password='******', email='*****@*****.**')
     db.session.add(cls.acc)
     db.session.commit()
Example #5
0
def populate():
    Role.insert_roles()
    user = Account(password='******', email='*****@*****.**', confirmed=True)
    user2 = Account(password='******', email='*****@*****.**', confirmed=True)
    new_category = Category(name='Kategoria1')
    new_category2 = Category(name='Kategoria2')
    new_product = Product(name='Produkt1', description='Opis1',
                          weight=1.99, price=12.99, category=new_category, seller=user)
    new_product2 = Product(name='Produkt2', description='Opis2',
                           weight=20, price=100, category=new_category2, seller=user2)
    db.session.add_all([user, user2, new_product, new_product2, new_category, new_category2])
    db.session.commit()
Example #6
0
def init():
    from app import Role, User
    Role.insert_roles()
    User.generate_admin()