Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (direction-service-py3.12) PS D:\Work\Mentor\direction-service> pytest .
- C:\Users\mikko\AppData\Local\pypoetry\Cache\virtualenvs\direction-service-5yPH-rNJ-py3.12\Lib\site-packages\pytest_asyncio\plugin.py:208: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset.
- The event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loo
- p scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session"
- warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET))
- ============================================================= test session starts =============================================================
- platform win32 -- Python 3.12.5, pytest-8.3.3, pluggy-1.5.0
- rootdir: D:\Work\Mentor\direction-service
- configfile: pytest.ini
- plugins: anyio-4.6.2.post1, asyncio-0.24.0, cov-5.0.0, reportlog-0.4.0
- asyncio: mode=Mode.AUTO, default_loop_scope=None
- collected 72 items
- tests\dal\test_admin_direction.py .... [ 5%]
- tests\dal\test_direction.py ....FF... [ 18%]
- tests\dal\test_student_to_direction.py .. [ 20%]
- tests\models\test_direction.py .... [ 26%]
- tests\models\test_direction_to_topic_model.py .... [ 31%]
- tests\models\test_mentor_to_direction.py .... [ 37%]
- tests\models\test_student_to_direction.py .... [ 43%]
- tests\models\test_student_to_topic.py .... [ 48%]
- tests\models\test_topic_model.py .... [ 54%]
- tests\rabbitmq\test_direction_completion_event_producer.py . [ 55%]
- tests\rabbitmq\test_direction_event_producer.py . [ 56%]
- tests\rabbitmq\test_event_producer_with_consumer.py . [ 58%]
- tests\rabbitmq\test_review_complete_handler.py ...... [ 66%]
- tests\rabbitmq\test_review_consumer.py . [ 68%]
- tests\rabbitmq\test_student_create_handler.py ...... [ 76%]
- tests\rabbitmq\test_student_delete_handler.py ... [ 80%]
- tests\rabbitmq\test_topic_completion_event_producer.py . [ 81%]
- tests\rabbitmq\test_user_consumer.py . [ 83%]
- tests\routers\general\test_direction_router.py .. [ 86%]
- tests\routers\moderator\test_admin_direction.py ..... [ 93%]
- tests\routers\moderator\test_direction_router.py ... [ 97%]
- tests\routers\user\test_direction_router.py .. [100%]
- ================================================================== FAILURES ===================================================================
- ____________________________________________ TestDirectionDAL.test_update_direction_by_id_success _____________________________________________
- self = <tests.dal.test_direction.TestDirectionDAL object at 0x0000023DE0B76B70>
- get_test_db = <sqlalchemy.ext.asyncio.session.AsyncSession object at 0x0000023DE0F42BD0>
- async def test_update_direction_by_id_success(
- self,
- get_test_db: AsyncSession,
- ) -> None:
- """Тест успешного обновления направления по ID."""
- dal = DirectionDAL(session=get_test_db)
- new_direction = Direction(
- id_=999,
- name='Original Name',
- description='Original Description',
- topic_version=1,
- is_archived=False
- )
- get_test_db.add(new_direction)
- await get_test_db.commit()
- await get_test_db.refresh(new_direction)
- # Данные для обновления
- > updated_data = DirectionAllSchema(
- name='Updated Name',
- description='Updated Description',
- topic_version=2,
- is_archived=True
- )
- E pydantic_core._pydantic_core.ValidationError: 1 validation error for DirectionAllSchema
- E id
- E Field required [type=missing, input_value={'name': 'Updated Name', ... 2, 'is_archived': True}, input_type=dict]
- E For further information visit https://errors.pydantic.dev/2.9/v/missing
- tests\dal\test_direction.py:155: ValidationError
- ___________________________________________ TestDirectionDAL.test_update_direction_by_id_not_found ____________________________________________
- self = <tests.dal.test_direction.TestDirectionDAL object at 0x0000023DE0B76E40>
- get_test_db = <sqlalchemy.ext.asyncio.session.AsyncSession object at 0x0000023DE0F416D0>
- async def test_update_direction_by_id_not_found(
- self,
- get_test_db: AsyncSession
- ) -> None:
- """Тест, проверяющий ошибку при отсутствии направления."""
- dal = DirectionDAL(session=get_test_db)
- # Убедимся, что запись с данным ID отсутствует
- non_existent_id = 9999
- > updated_data = DirectionAllSchema(name='New Name')
- E pydantic_core._pydantic_core.ValidationError: 2 validation errors for DirectionAllSchema
- E id
- E Field required [type=missing, input_value={'name': 'New Name'}, input_type=dict]
- E For further information visit https://errors.pydantic.dev/2.9/v/missing
- E description
- E Field required [type=missing, input_value={'name': 'New Name'}, input_type=dict]
- E For further information visit https://errors.pydantic.dev/2.9/v/missing
- tests\dal\test_direction.py:192: ValidationError
- =========================================================== short test summary info ===========================================================
- FAILED tests/dal/test_direction.py::TestDirectionDAL::test_update_direction_by_id_success - pydantic_core._pydantic_core.ValidationError: 1 validation error for DirectionAllSchema
- FAILED tests/dal/test_direction.py::TestDirectionDAL::test_update_direction_by_id_not_found - pydantic_core._pydantic_core.ValidationError: 2 validation errors for DirectionAllSchema
- ======================================================== 2 failed, 70 passed in 5.01s =========================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement