Skip to content

Commit a1227c6

Browse files
committed
test: Run lint
1 parent 6fa29f0 commit a1227c6

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed
Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
from datetime import date
22

33
import pytest
4-
from devtools import debug
5-
from fastapi import Depends, FastAPI
4+
from fastapi import Depends
65
from fastapi_amis_admin.models.fields import Field
7-
from starlette.testclient import TestClient
86

9-
from fastapi_user_auth.auth import Auth, AuthRouter
10-
from fastapi_user_auth.auth.models import BaseUser, User
7+
from fastapi_user_auth.auth.models import User
118

12-
# 自定义`User`模型,继承`BaseUser`
9+
10+
# 自定义`User`模型,继承`User`
1311
class MyUser(User, table=True):
14-
point: float = Field(default=0, title='积分', description='用户积分')
15-
phone: str = Field(None, title='手机号', max_length=15)
12+
point: float = Field(default=0, title="积分", description="用户积分")
13+
phone: str = Field(None, title="手机号", max_length=15)
1614
parent_id: int = Field(None, title="上级", foreign_key="auth_user.id")
1715
birthday: date = Field(None, title="出生日期")
1816
location: str = Field(None, title="位置")
1917

18+
2019
@pytest.mark.parametrize("logins", ["admin"], indirect=True)
2120
async def test_custom_user_model(fake_auth, logins):
2221
# 使用自定义的`User`模型,创建auth对象
@@ -25,16 +24,15 @@ async def test_custom_user_model(fake_auth, logins):
2524
client = logins.client
2625

2726
# 注册auth用户管理路由
28-
@app.get('/get_user')
27+
@app.get("/get_user")
2928
async def get_user(user: MyUser = Depends(fake_auth.get_current_user)):
3029
assert isinstance(user, MyUser)
3130
user.point = 100
32-
user.phone = '123456789'
31+
user.phone = "123456789"
3332
return user
3433

35-
response = client.get('/get_user')
34+
response = client.get("/get_user")
3635
data = response.json()
37-
assert 'parent_id' in data
38-
assert data['point'] == 100
39-
assert data['phone'] == '123456789'
40-
36+
assert "parent_id" in data
37+
assert data["point"] == 100
38+
assert data["phone"] == "123456789"

0 commit comments

Comments
 (0)