refactor: make mock_enqueue_job fixture opt-in instead of autouse

Tests that call POST /api/counter/increment now explicitly request
the mock_enqueue_job fixture. This prevents the mock from masking
issues in other tests that don't need it.
This commit is contained in:
counterweight 2025-12-21 23:29:48 +01:00
parent 6f3e729b25
commit 4d9edd7fd4
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
3 changed files with 10 additions and 8 deletions

View file

@ -97,7 +97,7 @@ async def test_get_counter_authenticated(client_factory):
@pytest.mark.asyncio
async def test_increment_counter(client_factory):
async def test_increment_counter(client_factory, mock_enqueue_job):
async with client_factory.get_db_session() as db:
godfather = await create_user_with_roles(
db, unique_email("gf"), "pass123", [ROLE_REGULAR]
@ -126,7 +126,7 @@ async def test_increment_counter(client_factory):
@pytest.mark.asyncio
async def test_increment_counter_multiple(client_factory):
async def test_increment_counter_multiple(client_factory, mock_enqueue_job):
async with client_factory.get_db_session() as db:
godfather = await create_user_with_roles(
db, unique_email("gf"), "pass123", [ROLE_REGULAR]
@ -157,7 +157,7 @@ async def test_increment_counter_multiple(client_factory):
@pytest.mark.asyncio
async def test_get_counter_after_increment(client_factory):
async def test_get_counter_after_increment(client_factory, mock_enqueue_job):
async with client_factory.get_db_session() as db:
godfather = await create_user_with_roles(
db, unique_email("gf"), "pass123", [ROLE_REGULAR]
@ -187,7 +187,7 @@ async def test_get_counter_after_increment(client_factory):
# Counter is shared between users
@pytest.mark.asyncio
async def test_counter_shared_between_users(client_factory):
async def test_counter_shared_between_users(client_factory, mock_enqueue_job):
# Create godfather and invites for two users
async with client_factory.get_db_session() as db:
godfather = await create_user_with_roles(