Skip to content

Commit

Permalink
fix repetitive code
Browse files Browse the repository at this point in the history
  • Loading branch information
aktech committed May 24, 2024
1 parent 5cbc4f6 commit d2d8787
Showing 1 changed file with 1 addition and 31 deletions.
32 changes: 1 addition & 31 deletions jhub_apps/tests/tests_unit/conftest.py
Original file line number Diff line number Diff line change
@@ -1,31 +1 @@
import logging
import os

import pytest

from fastapi.testclient import TestClient

from jhub_apps.tests.common.constants import MOCK_USER


@pytest.fixture
def client():
logging_format = (
"%(asctime)s %(levelname)9s %(name)s:%(lineno)4s: %(message)s"
)
logging.basicConfig(
level=logging.INFO, format=logging_format
)
os.environ["JUPYTERHUB_API_URL"] = "/"
os.environ["JUPYTERHUB_API_TOKEN"] = "token"
os.environ["PUBLIC_HOST"] = "/"
os.environ["JUPYTERHUB_CLIENT_ID"] = "test-client-id"
os.environ["JUPYTERHUB_OAUTH_CALLBACK_URL"] = "/"
from jhub_apps.service.app import app
from jhub_apps.service.security import get_current_user

async def mock_get_user_name():
return MOCK_USER

app.dependency_overrides[get_current_user] = mock_get_user_name
return TestClient(app)
pytest_plugins = ["jhub_apps.tests.common.api_fixtures"]

0 comments on commit d2d8787

Please sign in to comment.