添加测试环境
This commit is contained in:
parent
da221fd817
commit
b5a14ba046
|
@ -9,7 +9,7 @@ from Utils.SqlAlchemyUtils import get_db
|
||||||
router = APIRouter(
|
router = APIRouter(
|
||||||
tags=["应用管理"],
|
tags=["应用管理"],
|
||||||
prefix="/api/app_manage",
|
prefix="/api/app_manage",
|
||||||
# dependencies=[Depends(admin_auth_token_depend)]
|
dependencies=[Depends(admin_auth_token_depend)]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ from Utils.SqlAlchemyUtils import get_db
|
||||||
router = APIRouter(
|
router = APIRouter(
|
||||||
tags=["权限规则"],
|
tags=["权限规则"],
|
||||||
prefix="/api/auth_rule",
|
prefix="/api/auth_rule",
|
||||||
# dependencies=[Depends(admin_auth_token_depend)]
|
dependencies=[Depends(admin_auth_token_depend)]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ from Utils.SqlAlchemyUtils import get_db
|
||||||
router = APIRouter(
|
router = APIRouter(
|
||||||
tags=["职务操作"],
|
tags=["职务操作"],
|
||||||
prefix="/api/post",
|
prefix="/api/post",
|
||||||
# dependencies=[Depends(admin_auth_token_depend)]
|
dependencies=[Depends(admin_auth_token_depend)]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ def create_token(data: dict, secret_key, algorithm, expires_delta: timedelta = t
|
||||||
to_encode_body = dict()
|
to_encode_body = dict()
|
||||||
to_encode_body.update(data.copy())
|
to_encode_body.update(data.copy())
|
||||||
# 设置过期时间
|
# 设置过期时间
|
||||||
|
if timedelta:
|
||||||
expire = datetime.utcnow() + expires_delta
|
expire = datetime.utcnow() + expires_delta
|
||||||
to_encode_body.update({"exp": expire})
|
to_encode_body.update({"exp": expire})
|
||||||
# Token编码
|
# Token编码
|
||||||
|
|
2
main.py
2
main.py
|
@ -7,10 +7,12 @@ from Utils.ConfigUtils import init_common_config
|
||||||
from Utils.RedisUtils import init_redis_pool
|
from Utils.RedisUtils import init_redis_pool
|
||||||
from Utils.SqlAlchemyUtils import Base, init_database
|
from Utils.SqlAlchemyUtils import Base, init_database
|
||||||
from Context.common import ctx
|
from Context.common import ctx
|
||||||
|
from Utils.TestUtils import init_test_env
|
||||||
|
|
||||||
init_common_config()
|
init_common_config()
|
||||||
init_database()
|
init_database()
|
||||||
init_redis_pool()
|
init_redis_pool()
|
||||||
|
init_test_env()
|
||||||
|
|
||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
title="用户模块",
|
title="用户模块",
|
||||||
|
|
Loading…
Reference in New Issue