Skip to content

Commit 7c3e238

Browse files
committed
🎨 style: lint
1 parent f9471fc commit 7c3e238

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

app/services/auth.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,9 @@ async def patch_password_by_id(
266266
oauth = await self.repository.read_by_user_id_and_password(
267267
user_id=user_id, eager=True
268268
)
269-
if oauth is None:
269+
if oauth is None or oauth.password is None:
270270
raise NotRegistered
271+
password_new: str
271272
if isinstance(schema, UserPasswordRequest):
272273
# TODO: 비밀번호 변경 전, 후 같으면 예외 발생
273274
if not self.crypt_service.verify(schema.password_old, oauth.password):
@@ -285,7 +286,7 @@ async def patch_password_by_id(
285286
email=user.email,
286287
role=user.role,
287288
refresh_token=user.refresh_token,
288-
oauth=[oauth],
289+
oauth=[self.mapper(oauth)],
289290
)
290291

291292
@database.transactional

app/tests/api/v1/admin/test_users.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def log_in_admin(sync_client: TestClient) -> tuple[MockUser, str]:
1717
admin_user = MockUser(
1818
sync_client=sync_client,
1919
request=PasswordOAuthReigsterRequest(
20-
grant_type=OAuthProvider.PASSWORD,
20+
grant_type=OAuthProvider.PASSWORD.value,
2121
username=configs.ADMIN_EMAIL,
2222
password=configs.ADMIN_PASSWORD,
2323
name=configs.ADMIN_NAME,

app/tests/api/v1/test_auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
def get_mock_request() -> PasswordOAuthReigsterRequest:
1414
return PasswordOAuthReigsterRequest(
15-
grant_type=OAuthProvider.PASSWORD,
15+
grant_type=OAuthProvider.PASSWORD.value,
1616
username=fake.email(),
1717
password=fake.password(),
1818
name=fake.name(),
@@ -76,9 +76,9 @@ def get_me(self, access_token: str) -> int:
7676
assert data["role"] == Role.USER.value
7777
assert data["name"] == self.request.name
7878
assert data["email"] == self.request.username
79-
return data["id"]
8079
assert data["oauth"][0]["provider"] == OAuthProvider.PASSWORD.value
8180
assert data["oauth"][0]["provider"] != self.request.password
81+
return data["id"]
8282

8383

8484
def register_and_log_in(sync_client: TestClient) -> tuple[MockUser, str]:

app/tests/services/test_users.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
from app.core.container import Container
88
from app.exceptions.database import DatabaseException, EntityNotFound
9-
from app.models.enums import OAuthProvider, Role
10-
from app.schemas.auth import AuthIn
9+
from app.models.enums import Role
1110
from app.schemas.users import UserIn, UserRequest
1211

1312
pytestmark = pytest.mark.anyio
@@ -19,7 +18,6 @@ def get_mock_user() -> UserIn:
1918
name=fake.name(),
2019
email=fake.email(),
2120
role=Role.USER,
22-
oauth=[AuthIn(provider=OAuthProvider.PASSWORD, password=fake.password())],
2321
)
2422

2523

0 commit comments

Comments
 (0)