# flake8: noqa F811,F401 import asyncio import pytest from conftest import new_user from conftest import use_test_db as utdb from src.backend.logic.audit import runner from tests_backend.conftest import TEST_LABEL_ID @pytest.fixture(autouse=True) def use_test_db(utdb, new_user): """Use the test database for all tests in this module! Important to ensure that the tests do not affect the real database. """ yield utdb @pytest.mark.slow @pytest.mark.asyncio async def test_run(new_user): """Test run function to perform a real audit, which should be successful.""" audit_group_id_callback = asyncio.get_event_loop().create_future() user_id = new_user result = await runner.run( user=user_id, label_id=TEST_LABEL_ID, audit_audio=True, audit_art_track=True, audit_video=True, audit_group_id_callback=audit_group_id_callback, ) assert audit_group_id_callback.result() == 1 assert result is True