def bootstrap(dbinfo):
# Initialize the db layer
config = testing.setUp()
settings = config.get_settings()
here = "/".join(os.path.dirname(__file__).split("/")[:-2])
global_settings = {"__file__": os.path.join(here, "test/testing.ini"),
"here": here, "venv":CONFIG.venv()}
web.init(global_settings, settings, dbinfo)
# Sync the database with mishmash
__main__.main(["-D", dbinfo.url, "-c", "test/testing.ini", "sync"])
# Create test users
session = dbinfo.SessionMaker()
user = models.addUser(session, "test", "test", auth.Roles.def_user_roles)
user.avatar = 3
session.add(user)
session.commit()
session.close()
# Load the users
models.load()
评论列表
文章目录