Skip to content

Commit

Permalink
increase TU
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielGodoy01 committed May 7, 2024
1 parent 6d9c0c7 commit 513cf02
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 27 deletions.
12 changes: 0 additions & 12 deletions src/modules/get_all_users/app/get_all_users_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,5 @@ def __call__(self, request: IRequest) -> IResponse:
except MissingParameters as err:
return BadRequest(body=f"Parâmetro ausente: {err.message}")

except InvalidCredentials as err:
return BadRequest(body=f"Parâmetro inválido: {err.message}")

except EntityError as err:
return BadRequest(body=f"Parâmetro inválido: {err.message}")

except NoItemsFound as err:
return BadRequest(body=f"Usuário não encontrado: {err.message}")

except InvalidTokenError as err:
return Unauthorized(body="Token inválido ou expirado")

except Exception as err:
return InternalServerError(body=err.args[0])
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,6 @@ def __call__(self, request: IRequest) -> IResponse:

except MissingParameters as err:
return BadRequest(body=f"Parâmetro ausente: {err.message}")

except InvalidCredentials as err:
return BadRequest(body=f"Parâmetro inválido: {err.message}")

except EntityError as err:
return BadRequest(body=f"Parâmetro inválido: {err.message}")

except NoItemsFound as err:
return BadRequest(body=f"Usuário não encontrado: {err.message}")

except InvalidTokenError as err:
return Unauthorized(body="Token inválido ou expirado")

except Exception as err:
return InternalServerError(body=err.args[0])
3 changes: 0 additions & 3 deletions src/modules/refresh_token/app/refresh_token_usecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@ def __call__(self, refresh_token: str) -> str:
raise ForbiddenAction(f'Refresh Token')

access_token, refresh_token, id_token = tokens

if access_token is None or refresh_token is None or id_token is None:
raise ForbiddenAction(f'Refresh Token ou Access Token')

return access_token, refresh_token, id_token
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ def test_list_users_in_group_usecase_user_not_allowed(self):
with pytest.raises(ForbiddenAction):
usecase(group=GROUPS.GAIA, request_user_role=ROLE.USER, request_user_groups=[GROUPS.GAIA])

def test_list_users_in_group_usecase_user_not_in_group(self):
repo = UserRepositoryMock()
usecase = ListUsersInGroupUsecase(repo)

with pytest.raises(ForbiddenAction):
usecase(group=GROUPS.JUNDIAI, request_user_role=ROLE.ADMIN_COLLABORATOR, request_user_groups=[GROUPS.GAIA])


def test_list_users_in_group_usecase_with_user_not_in_group(self):
repo = UserRepositoryMock()
Expand Down

0 comments on commit 513cf02

Please sign in to comment.