Skip to content

Commit

Permalink
Feature/upgrade package (#36)
Browse files Browse the repository at this point in the history
* upgrade package

* bump version

* fix exception

* improve test coverage

Co-authored-by: Schwannden Kuo <schwannden@mobagel.com>
  • Loading branch information
schwannden and Schwannden Kuo committed Jul 20, 2022
1 parent 97e2007 commit 15418f1
Show file tree
Hide file tree
Showing 14 changed files with 171 additions and 513 deletions.
78 changes: 0 additions & 78 deletions awesome_sso/exceptions/__init__.py

This file was deleted.

3 changes: 1 addition & 2 deletions awesome_sso/service/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from awesome_exception.exceptions import HTTPException
from fastapi import FastAPI, Request
from fastapi.logger import logger
from fastapi.responses import JSONResponse

from awesome_sso.exceptions import HTTPException
from awesome_sso.service.route import router


Expand Down
2 changes: 1 addition & 1 deletion awesome_sso/service/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
from pydantic import BaseModel

from awesome_sso.exceptions import BadRequest, NotFound, Unauthorized
from awesome_exception.exceptions import BadRequest, NotFound, Unauthorized
from awesome_sso.service.settings import Settings
from awesome_sso.service.user.schema import AwesomeUserType, RegisterModel
from awesome_sso.util.constant import MOCK_USER_ID
Expand Down
2 changes: 1 addition & 1 deletion awesome_sso/service/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from fastapi import APIRouter, Depends, Response
from fastapi.logger import logger

from awesome_sso.exceptions import BadRequest, HTTPException, InternalServerError
from awesome_exception.exceptions import BadRequest, HTTPException, InternalServerError
from awesome_sso.service.depends import get_sso_user_id, sso_registration, sso_user
from awesome_sso.service.settings import Settings
from awesome_sso.service.user.schema import AccessToken, AwesomeUserType, RegisterModel
Expand Down
2 changes: 1 addition & 1 deletion awesome_sso/service/user/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class AwesomeUser(Document):
line_linked: bool = False
language: Language = Language.ZH_TW

class Collection:
class Settings:
name = "user"

@classmethod
Expand Down
3 changes: 2 additions & 1 deletion awesome_sso/service/user/sync_user.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import requests
from awesome_exception.exceptions import InternalServerError

from awesome_sso.service.settings import Settings
from awesome_sso.service.user.schema import AwesomeUserType
Expand All @@ -12,7 +13,7 @@ async def sync_user(user: AwesomeUserType):
)
resp.close()
if resp.status_code / 2 != 100:
raise RuntimeError(
raise InternalServerError(
"update vendor info failed: " + str(resp.content.decode("utf-8"))
)
sso_user = resp.json()
Expand Down

0 comments on commit 15418f1

Please sign in to comment.