unit & interga tests
This commit is contained in:
@@ -2,6 +2,7 @@ import pytest_asyncio
|
||||
from fastapi import Request
|
||||
|
||||
from src.service.auth.auth import CurrentUserService
|
||||
from src.service.users_crud.users_crud import CrudService
|
||||
|
||||
|
||||
@pytest_asyncio.fixture
|
||||
@@ -13,4 +14,9 @@ async def current_user_service()->CurrentUserService:
|
||||
async def requests(mocker):
|
||||
fake_request = mocker.MagicMock(spec=Request)
|
||||
fake_request.headers = {"user-agent": "pytest-agent", "x-forwarded-for":"127.0.0.1"}
|
||||
return fake_request
|
||||
return fake_request
|
||||
|
||||
@pytest_asyncio.fixture
|
||||
async def crud_service()->CrudService:
|
||||
crud_service=CrudService()
|
||||
return crud_service
|
||||
@@ -41,6 +41,8 @@ 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
|
||||
assert not hasattr(test_result, "password") or not hasattr(test_result, "plain_password") or not hasattr(test_result, "hashed_password")
|
||||
assert not hasattr(test_result, "status")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("user_data, uuid, expected_exception,expected_status",[
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import AsyncMock
|
||||
|
||||
import allure
|
||||
import pytest
|
||||
|
||||
from src.service.users_crud.users_crud import CrudService
|
||||
|
||||
|
||||
@pytest.mark.integra
|
||||
class TestCrud:
|
||||
|
||||
async def test_create_user_positive(self, crud_service:CrudService, monkeypatch)->None:
|
||||
|
||||
with allure.step("Patching functions"):
|
||||
pass
|
||||
Reference in New Issue
Block a user