def test_19_add_self_follows(self): user = User.query.filter_by(username='******').first() user.not_follow(user) self.assertTrue(user.followers.count() == 0) User.add_self_follows() self.assertTrue(user.followers.count() == 1) self.assertTrue(user.is_following(user))
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() User.add_admin_dialogue(1) User.add_self_follows()
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.'