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() User.add_admin() User.add_test_user()
def setUpClass(cls): cls.base_url = 'http://127.0.0.1:5000' try: cls.client = webdriver.Firefox() except: pass if cls.client: cls.app = create_app('testing') cls.app_context = cls.app.app_context() cls.app_context.push() import logging logger = logging.getLogger('werkzeug') logger.setLevel("ERROR") db.create_all() Role.insert_roles() User.add_admin() User.add_test_user() Category.add_none() threading.Thread(target=cls.app.run).start()
def deploy(): """Run deployment task""" if not os.path.isfile(app.config['SQLALCHEMY_DATABASE_URI'][10:]): db.create_all() print 'Datebase created.' Role.insert_roles() User.add_self_follows() User.add_admin() User.add_test_user() print 'add admin :'\ '\[email protected]'\ '\npassword=1234' Category.add_none() print 'Category insert None.' else: print 'database already exists!' admin_id = input('admin_id:') while True: if User.query.get(admin_id): User.add_admin_dialogue(admin_id) break else: admin_id = input('get admin error!\nadmin_id:') print 'User config.'