update all imports in test files: fastapi_oidc_op → porchlight
This commit is contained in:
parent
14037117e7
commit
7cb1adbd06
31 changed files with 63 additions and 63 deletions
|
|
@ -3,8 +3,8 @@ from collections.abc import AsyncIterator
|
|||
import pytest
|
||||
from httpx import ASGITransport, AsyncClient
|
||||
|
||||
from fastapi_oidc_op.app import create_app
|
||||
from fastapi_oidc_op.config import Settings
|
||||
from porchlight.app import create_app
|
||||
from porchlight.config import Settings
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ echo " DB: ${OIDC_OP_SQLITE_PATH}"
|
|||
OIDC_OP_ISSUER="${TARGET_URL}" \
|
||||
OIDC_OP_DEBUG=true \
|
||||
uv run --directory "$PROJECT_ROOT" \
|
||||
uvicorn fastapi_oidc_op.app:create_app \
|
||||
uvicorn porchlight.app:create_app \
|
||||
--factory --host 127.0.0.1 --port "$PORT" \
|
||||
--log-level warning &
|
||||
SERVER_PID=$!
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ import sys
|
|||
|
||||
import aiosqlite
|
||||
|
||||
from fastapi_oidc_op.authn.password import PasswordService
|
||||
from fastapi_oidc_op.invite.service import MagicLinkService
|
||||
from fastapi_oidc_op.models import PasswordCredential, User
|
||||
from fastapi_oidc_op.store.sqlite.repositories import (
|
||||
from porchlight.authn.password import PasswordService
|
||||
from porchlight.invite.service import MagicLinkService
|
||||
from porchlight.models import PasswordCredential, User
|
||||
from porchlight.store.sqlite.repositories import (
|
||||
SQLiteCredentialRepository,
|
||||
SQLiteMagicLinkRepository,
|
||||
SQLiteUserRepository,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ async def test_app_has_title(client: AsyncClient) -> None:
|
|||
|
||||
|
||||
async def test_app_has_repos_on_state(client: AsyncClient) -> None:
|
||||
from fastapi_oidc_op.store.protocols import (
|
||||
from porchlight.store.protocols import (
|
||||
CredentialRepository,
|
||||
MagicLinkRepository,
|
||||
UserRepository,
|
||||
|
|
@ -31,7 +31,7 @@ async def test_app_has_repos_on_state(client: AsyncClient) -> None:
|
|||
async def test_dependency_functions() -> None:
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from fastapi_oidc_op.dependencies import (
|
||||
from porchlight.dependencies import (
|
||||
get_credential_repo,
|
||||
get_magic_link_repo,
|
||||
get_user_repo,
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ from datetime import UTC, datetime
|
|||
from argon2 import PasswordHasher
|
||||
from httpx import AsyncClient
|
||||
|
||||
from fastapi_oidc_op.authn.password import PasswordService
|
||||
from fastapi_oidc_op.models import PasswordCredential, User, WebAuthnCredential
|
||||
from porchlight.authn.password import PasswordService
|
||||
from porchlight.models import PasswordCredential, User, WebAuthnCredential
|
||||
|
||||
|
||||
async def _create_user_and_login(client: AsyncClient) -> str:
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from datetime import UTC, datetime
|
|||
from argon2 import PasswordHasher
|
||||
from httpx import AsyncClient
|
||||
|
||||
from fastapi_oidc_op.authn.password import PasswordService
|
||||
from fastapi_oidc_op.models import PasswordCredential, User
|
||||
from porchlight.authn.password import PasswordService
|
||||
from porchlight.models import PasswordCredential, User
|
||||
|
||||
|
||||
async def _login(client: AsyncClient, username: str = "alice", password: str = "testpass") -> None:
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from datetime import UTC, datetime
|
|||
from argon2 import PasswordHasher
|
||||
from httpx import AsyncClient
|
||||
|
||||
from fastapi_oidc_op.authn.password import PasswordService
|
||||
from fastapi_oidc_op.models import PasswordCredential, User, WebAuthnCredential
|
||||
from porchlight.authn.password import PasswordService
|
||||
from porchlight.models import PasswordCredential, User, WebAuthnCredential
|
||||
|
||||
|
||||
async def _create_user_and_login(client: AsyncClient) -> str:
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ from fido2.webauthn import (
|
|||
)
|
||||
from httpx import AsyncClient
|
||||
|
||||
from fastapi_oidc_op.authn.password import PasswordService
|
||||
from fastapi_oidc_op.models import PasswordCredential, User, WebAuthnCredential
|
||||
from porchlight.authn.password import PasswordService
|
||||
from porchlight.models import PasswordCredential, User, WebAuthnCredential
|
||||
|
||||
RP_ID = "localhost"
|
||||
ORIGIN = "http://localhost:8000"
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from datetime import UTC, datetime
|
|||
from argon2 import PasswordHasher
|
||||
from httpx import AsyncClient
|
||||
|
||||
from fastapi_oidc_op.authn.password import PasswordService
|
||||
from fastapi_oidc_op.models import PasswordCredential, User
|
||||
from porchlight.authn.password import PasswordService
|
||||
from porchlight.models import PasswordCredential, User
|
||||
|
||||
|
||||
async def test_password_login_unknown_user_returns_error_fragment(client: AsyncClient) -> None:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from datetime import UTC, datetime, timedelta
|
|||
|
||||
from httpx import AsyncClient
|
||||
|
||||
from fastapi_oidc_op.models import MagicLink
|
||||
from porchlight.models import MagicLink
|
||||
|
||||
|
||||
async def test_register_invalid_token_returns_error_page(client: AsyncClient) -> None:
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from unittest.mock import MagicMock
|
|||
import pytest
|
||||
from fastapi import HTTPException
|
||||
|
||||
from fastapi_oidc_op.dependencies import get_session_user, require_session_user
|
||||
from porchlight.dependencies import get_session_user, require_session_user
|
||||
|
||||
|
||||
def test_get_session_user_none_when_missing() -> None:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from fido2.webauthn import (
|
|||
)
|
||||
from httpx import AsyncClient
|
||||
|
||||
from fastapi_oidc_op.models import User, WebAuthnCredential
|
||||
from porchlight.models import User, WebAuthnCredential
|
||||
|
||||
RP_ID = "localhost"
|
||||
ORIGIN = "http://localhost:8000"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from argon2 import PasswordHasher
|
||||
|
||||
from fastapi_oidc_op.authn.password import PasswordService
|
||||
from porchlight.authn.password import PasswordService
|
||||
|
||||
|
||||
def test_hash_returns_argon2_string() -> None:
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ from fido2.webauthn import (
|
|||
RegistrationResponse,
|
||||
)
|
||||
|
||||
from fastapi_oidc_op.authn.webauthn import WebAuthnService
|
||||
from porchlight.authn.webauthn import WebAuthnService
|
||||
|
||||
RP_ID = "localhost"
|
||||
RP_NAME = "Test RP"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# tests/test_config.py
|
||||
import pytest
|
||||
|
||||
from fastapi_oidc_op.config import Settings, StorageBackend
|
||||
from porchlight.config import Settings, StorageBackend
|
||||
|
||||
|
||||
def test_default_settings() -> None:
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ from pathlib import Path
|
|||
import aiosqlite
|
||||
import pytest
|
||||
|
||||
from fastapi_oidc_op.invite.service import MagicLinkService
|
||||
from fastapi_oidc_op.store.sqlite.migrations import run_migrations
|
||||
from fastapi_oidc_op.store.sqlite.repositories import SQLiteMagicLinkRepository
|
||||
from porchlight.invite.service import MagicLinkService
|
||||
from porchlight.store.sqlite.migrations import run_migrations
|
||||
from porchlight.store.sqlite.repositories import SQLiteMagicLinkRepository
|
||||
|
||||
MIGRATIONS_DIR = (
|
||||
Path(__file__).resolve().parent.parent.parent / "src" / "fastapi_oidc_op" / "store" / "sqlite" / "migrations"
|
||||
Path(__file__).resolve().parent.parent.parent / "src" / "porchlight" / "store" / "sqlite" / "migrations"
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from datetime import UTC, datetime, timedelta
|
||||
|
||||
from fastapi_oidc_op.models import (
|
||||
from porchlight.models import (
|
||||
CredentialType,
|
||||
MagicLink,
|
||||
PasswordCredential,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from datetime import UTC, datetime
|
||||
|
||||
from fastapi_oidc_op.models import User
|
||||
from fastapi_oidc_op.oidc.claims import PorchlightUserInfo, user_to_claims
|
||||
from porchlight.models import User
|
||||
from porchlight.oidc.claims import PorchlightUserInfo, user_to_claims
|
||||
|
||||
|
||||
def test_user_to_claims_minimal() -> None:
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ from cryptojwt.jwk.jwk import key_from_jwk_dict
|
|||
from cryptojwt.jws.jws import JWS
|
||||
from httpx import AsyncClient
|
||||
|
||||
from fastapi_oidc_op.authn.password import PasswordService
|
||||
from fastapi_oidc_op.models import PasswordCredential, User
|
||||
from porchlight.authn.password import PasswordService
|
||||
from porchlight.models import PasswordCredential, User
|
||||
|
||||
|
||||
async def test_full_authorization_code_flow(client: AsyncClient) -> None:
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ from datetime import UTC, datetime
|
|||
from argon2 import PasswordHasher
|
||||
from httpx import AsyncClient
|
||||
|
||||
from fastapi_oidc_op.authn.password import PasswordService
|
||||
from fastapi_oidc_op.models import PasswordCredential, User
|
||||
from porchlight.authn.password import PasswordService
|
||||
from porchlight.models import PasswordCredential, User
|
||||
|
||||
|
||||
def _register_test_client(client: AsyncClient) -> None:
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi_oidc_op.config import Settings
|
||||
from fastapi_oidc_op.oidc.provider import create_oidc_server
|
||||
from porchlight.config import Settings
|
||||
from porchlight.oidc.provider import create_oidc_server
|
||||
|
||||
|
||||
def test_create_server_has_endpoints() -> None:
|
||||
|
|
@ -49,7 +49,7 @@ def test_create_server_userinfo_is_porchlight() -> None:
|
|||
try:
|
||||
settings = Settings(issuer="http://localhost:8000", sqlite_path=":memory:", signing_key_path=str(key_path))
|
||||
server = create_oidc_server(settings)
|
||||
from fastapi_oidc_op.oidc.claims import PorchlightUserInfo
|
||||
from porchlight.oidc.claims import PorchlightUserInfo
|
||||
|
||||
assert isinstance(server.context.userinfo, PorchlightUserInfo)
|
||||
finally:
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ from urllib.parse import parse_qs, urlparse
|
|||
from argon2 import PasswordHasher
|
||||
from httpx import AsyncClient
|
||||
|
||||
from fastapi_oidc_op.authn.password import PasswordService
|
||||
from fastapi_oidc_op.models import PasswordCredential, User
|
||||
from porchlight.authn.password import PasswordService
|
||||
from porchlight.models import PasswordCredential, User
|
||||
|
||||
|
||||
def _register_test_client(client: AsyncClient) -> str:
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ from urllib.parse import parse_qs, urlparse
|
|||
from argon2 import PasswordHasher
|
||||
from httpx import AsyncClient
|
||||
|
||||
from fastapi_oidc_op.authn.password import PasswordService
|
||||
from fastapi_oidc_op.models import PasswordCredential, User
|
||||
from porchlight.authn.password import PasswordService
|
||||
from porchlight.models import PasswordCredential, User
|
||||
|
||||
|
||||
def _register_test_client(client: AsyncClient) -> str:
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ from pathlib import Path
|
|||
import aiosqlite
|
||||
import pytest
|
||||
|
||||
from fastapi_oidc_op.store.sqlite.migrations import run_migrations
|
||||
from porchlight.store.sqlite.migrations import run_migrations
|
||||
|
||||
MIGRATIONS_DIR = (
|
||||
Path(__file__).resolve().parent.parent.parent / "src" / "fastapi_oidc_op" / "store" / "sqlite" / "migrations"
|
||||
Path(__file__).resolve().parent.parent.parent / "src" / "porchlight" / "store" / "sqlite" / "migrations"
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from fastapi_oidc_op.store.exceptions import DuplicateError
|
||||
from porchlight.store.exceptions import DuplicateError
|
||||
|
||||
|
||||
def test_duplicate_error_is_exception() -> None:
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ from pathlib import Path
|
|||
|
||||
import aiosqlite
|
||||
|
||||
from fastapi_oidc_op.store.sqlite.migrations import run_migrations
|
||||
from porchlight.store.sqlite.migrations import run_migrations
|
||||
|
||||
MIGRATIONS_DIR = (
|
||||
Path(__file__).resolve().parent.parent.parent / "src" / "fastapi_oidc_op" / "store" / "sqlite" / "migrations"
|
||||
Path(__file__).resolve().parent.parent.parent / "src" / "porchlight" / "store" / "sqlite" / "migrations"
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from typing import runtime_checkable
|
||||
|
||||
from fastapi_oidc_op.store.protocols import (
|
||||
from porchlight.store.protocols import (
|
||||
CredentialRepository,
|
||||
MagicLinkRepository,
|
||||
UserRepository,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import aiosqlite
|
||||
import pytest
|
||||
|
||||
from fastapi_oidc_op.models import PasswordCredential, User, WebAuthnCredential
|
||||
from fastapi_oidc_op.store.exceptions import DuplicateError
|
||||
from fastapi_oidc_op.store.protocols import CredentialRepository
|
||||
from fastapi_oidc_op.store.sqlite.repositories import (
|
||||
from porchlight.models import PasswordCredential, User, WebAuthnCredential
|
||||
from porchlight.store.exceptions import DuplicateError
|
||||
from porchlight.store.protocols import CredentialRepository
|
||||
from porchlight.store.sqlite.repositories import (
|
||||
SQLiteCredentialRepository,
|
||||
SQLiteUserRepository,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ from datetime import UTC, datetime, timedelta
|
|||
import aiosqlite
|
||||
import pytest
|
||||
|
||||
from fastapi_oidc_op.models import MagicLink
|
||||
from fastapi_oidc_op.store.exceptions import DuplicateError
|
||||
from fastapi_oidc_op.store.protocols import MagicLinkRepository
|
||||
from fastapi_oidc_op.store.sqlite.repositories import SQLiteMagicLinkRepository
|
||||
from porchlight.models import MagicLink
|
||||
from porchlight.store.exceptions import DuplicateError
|
||||
from porchlight.store.protocols import MagicLinkRepository
|
||||
from porchlight.store.sqlite.repositories import SQLiteMagicLinkRepository
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import aiosqlite
|
||||
import pytest
|
||||
|
||||
from fastapi_oidc_op.models import User
|
||||
from fastapi_oidc_op.store.exceptions import DuplicateError
|
||||
from fastapi_oidc_op.store.protocols import UserRepository
|
||||
from fastapi_oidc_op.store.sqlite.repositories import SQLiteUserRepository
|
||||
from porchlight.models import User
|
||||
from porchlight.store.exceptions import DuplicateError
|
||||
from porchlight.store.protocols import UserRepository
|
||||
from porchlight.store.sqlite.repositories import SQLiteUserRepository
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from unittest.mock import AsyncMock
|
|||
|
||||
import pytest
|
||||
|
||||
from fastapi_oidc_op.models import User
|
||||
from fastapi_oidc_op.userid import generate_unique_userid, generate_userid
|
||||
from porchlight.models import User
|
||||
from porchlight.userid import generate_unique_userid, generate_userid
|
||||
|
||||
|
||||
def test_generate_userid_format() -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue