-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
1 addition
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |