# retoor <retoor@molodetz.nl>

import pytest
from fastapi.testclient import TestClient

from devplacepy.database import internal_gateway_key, set_setting
from devplacepy.main import app
from devplacepy.services.manager import service_manager


@pytest.fixture(scope="module")
def client():
    set_setting("pubsub_allow_guests", "0")
    with TestClient(app) as test_client:
        service_manager.set_lock_owner(True)
        yield test_client
        service_manager.set_lock_owner(False)


@pytest.fixture
def auth(client):
    return {"X-API-KEY": internal_gateway_key()}
