def test_app(): from kkblog import create_app app = create_app() with app.test_client() as c: assert 200 == c.get("/").status_code assert 200 == c.get("/login").status_code assert 200 == c.get("/register").status_code
def test_app(): app = create_app() with app.test_client() as c: assert 200 == c.get("/").status_code # assert 200 == c.get("/login").status_code # assert 200 == c.get("/register").status_code assert 200 == c.get("/api/article/list").status_code data = {"username": "******", "password": "******"} login_resp = c.post("/api/user/login", data=data) assert 200 == login_resp.status_code assert "Authorization" in login_resp.headers headers = {"Authorization": login_resp.headers["Authorization"], "Content-Type": "application/json"} data = {"local": False, "rebuild": True} assert 200 == c.post("/api/githooks/update", data=json.dumps(data), headers=headers).status_code
# coding:utf-8 if __name__ == '__main__': # import os # os.environ['KKBLOG_CONFIG'] = 'config/kkblog_config.cfg' from kkblog import create_app app = create_app() app.run(host="0.0.0.0", debug=True)
def app(): db.drop_all_tables(with_all_data=True) app = create_app() return app
def test_create_app(): for i in range(10): db.drop_all_tables(with_all_data=True) with db_session: assert True app = create_app()