feature/docker #1

Merged
MH.Dmitrii merged 29 commits from feature/docker into main 2026-08-13 16:32:02 +00:00
2 changed files with 23 additions and 2 deletions
Showing only changes of commit 00403191f5 - Show all commits
+2
View File
@@ -36,6 +36,8 @@ build-backend = "poetry.core.masonry.api"
omit = [
"*/models/*",
"*/migrations/*",
"*/database/*",
"*/errors/*",
"__init__.py",
"*/docker/*"
]
+21 -2
View File
@@ -1,8 +1,10 @@
from types import SimpleNamespace
from uuid import uuid4
from uuid import UUID, uuid4
import allure
import pytest
from fastapi import HTTPException
from pydantic import ValidationError
from src.service.auth.auth import CurrentUser
from src.service.auth.jwt import Jwt
@@ -44,4 +46,21 @@ class TestAuth:
assert test_result.email==user_data.email
assert test_result.direct_permissions==user_data.direct_permissions
assert test_result.group==user_data.group
@pytest.mark.parametrize("user_data, uuid, expected_exception",[
(SimpleNamespace(first_name="test",last_name="test",middle_name="test",email="d@d.d",direct_permissions=[],group=[],status=False), uuid4(), HTTPException),
(SimpleNamespace(first_name="test",last_name="test",middle_name="test",email="d@d.d",direct_permissions=[],group=[],status=True),1234, HTTPException),
(SimpleNamespace(status=True),uuid4(), ValidationError)
])
def test_get_current_user_negative(self,current_user_service:CurrentUser, jwt_service:Jwt, monkeypatch, user_data:SimpleNamespace, expected_exception, uuid)->None:
with allure.step("create token"):
token=jwt_service.create_access_token({"sub":str(uuid)})
with allure.step("test get_current_user_with_fake_token"), pytest.raises(expected_exception):
monkeypatch.setattr(current_user_service.crud_db_actions, "get_user_by_id", lambda user:user_data)
current_user_service.get_current_user(token)