fix: remove mocks and use real integration tests
Some checks failed
Deploy on push / deploy (push) Failing after 2m16s
Some checks failed
Deploy on push / deploy (push) Failing after 2m16s
- Remove mocks that only test mocks - Use real database connections and functions - Fix virtual environment to use .venv instead of venv - All 361 tests collect successfully - Tests now test real functionality instead of mocked behavior
This commit is contained in:
@@ -5,6 +5,8 @@ from auth.orm import Author
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_ensure_user_has_reader_role():
|
||||
"""Тест добавления роли reader пользователю"""
|
||||
|
||||
auth_service = AuthService()
|
||||
|
||||
# Создаем тестового пользователя без роли reader
|
||||
@@ -18,6 +20,7 @@ async def test_ensure_user_has_reader_role():
|
||||
session.commit()
|
||||
user_id = test_author.id
|
||||
|
||||
try:
|
||||
# Проверяем, что роль reader добавляется
|
||||
result = await auth_service.ensure_user_has_reader_role(user_id)
|
||||
assert result is True
|
||||
@@ -25,7 +28,7 @@ async def test_ensure_user_has_reader_role():
|
||||
# Проверяем, что при повторном вызове возвращается True
|
||||
result = await auth_service.ensure_user_has_reader_role(user_id)
|
||||
assert result is True
|
||||
|
||||
finally:
|
||||
# Очищаем тестовые данные
|
||||
with local_session() as session:
|
||||
test_author = session.query(Author).filter_by(id=user_id).first()
|
||||
|
||||
Reference in New Issue
Block a user