Creator App Tests / PR Spam Gate (push) Skipped
Frontend Tests / PR Spam Gate (push) Skipped
NPM Format (website & console) / PR Spam Gate (push) Skipped
Pre-commit Checks / PR Spam Gate (push) Skipped
QwenPaw Creator Plugin Release / check-version (push) Canceled after 0s
QwenPaw Creator Plugin Release / upload-oss (push) Canceled after 0s
Tests / PR Spam Gate (push) Skipped
CodeQL / CodeQL (python) (push) Canceled after 0s
CodeQL / CodeQL (typescript) (push) Canceled after 0s
Creator App Tests / Creator Backend Tests (push) Canceled after 0s
Creator App Tests / Creator UI Build & Tests (push) Canceled after 0s
E2E Smoke Tests / Playwright UI Smoke (push) Canceled after 0s
Frontend Tests / Detect console changes (push) Canceled after 0s
NPM Format (website & console) / website format check (push) Canceled after 0s
NPM Format (website & console) / console format check (push) Canceled after 0s
Pre-commit Checks / Pre-commit (push) Canceled after 0s
QwenPaw Data Plugin Release / check-version (push) Canceled after 0s
Tests / Detect code changes (push) Canceled after 0s
Frontend Tests / Vitest Unit Tests (push) Canceled after 0s
Frontend Tests / Frontend Summary (push) Canceled after 0s
QwenPaw Data Plugin Release / upload-oss (push) Canceled after 0s
Tests / Maintainer Approval (push) Canceled after 0s
Tests / Unit Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - fallback (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p2 (push) Canceled after 0s
Tests / Coverage Report (push) Canceled after 0s
Tests / Test Summary (push) Canceled after 0s
113 lines
3.1 KiB
Python
113 lines
3.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Integration tests for Auth & config utils internals.
|
|
|
|
Covers src/qwenpaw/app/auth.py (207 uncovered) and
|
|
src/qwenpaw/config/utils.py (290 uncovered).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
|
|
# ------------------------------------------------------------------ #
|
|
# auth
|
|
# ------------------------------------------------------------------ #
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.p1
|
|
def test_auth_password_hash_verify_roundtrip() -> None:
|
|
"""_hash_password + verify_password round-trip."""
|
|
from qwenpaw.app.auth import _hash_password, verify_password
|
|
|
|
hashed, salt = _hash_password("integ-password")
|
|
assert verify_password("integ-password", hashed, salt) is True
|
|
assert verify_password("wrong", hashed, salt) is False
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.p1
|
|
def test_auth_token_roundtrip() -> None:
|
|
"""create_token + verify_token round-trip."""
|
|
from qwenpaw.app.auth import create_token, verify_token
|
|
|
|
token = create_token("integ-user")
|
|
assert isinstance(token, str)
|
|
username = verify_token(token)
|
|
assert username == "integ-user"
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.p1
|
|
def test_auth_verify_token_garbage() -> None:
|
|
"""verify_token returns None for a garbage token."""
|
|
from qwenpaw.app.auth import verify_token
|
|
|
|
assert verify_token("not-a-real-token") is None
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.p1
|
|
def test_auth_is_enabled() -> None:
|
|
"""is_auth_enabled returns a bool."""
|
|
from qwenpaw.app.auth import is_auth_enabled
|
|
|
|
assert isinstance(is_auth_enabled(), bool)
|
|
|
|
|
|
# ------------------------------------------------------------------ #
|
|
# config utils
|
|
# ------------------------------------------------------------------ #
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.p1
|
|
def test_config_get_config_path() -> None:
|
|
"""get_config_path returns a Path."""
|
|
from qwenpaw.config.utils import get_config_path
|
|
|
|
assert get_config_path().name.endswith(".json")
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.p1
|
|
def test_config_get_available_channels() -> None:
|
|
"""get_available_channels returns a tuple of channel ids."""
|
|
from qwenpaw.config.utils import get_available_channels
|
|
|
|
channels = get_available_channels()
|
|
assert isinstance(channels, tuple)
|
|
assert "console" in channels
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.p1
|
|
def test_config_is_running_in_container() -> None:
|
|
"""is_running_in_container returns a bool."""
|
|
from qwenpaw.config.utils import is_running_in_container
|
|
|
|
assert isinstance(is_running_in_container(), bool)
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.p1
|
|
def test_config_load_config() -> None:
|
|
"""load_config returns a Config object."""
|
|
from qwenpaw.config.utils import load_config
|
|
|
|
config = load_config()
|
|
assert config is not None
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.p1
|
|
def test_config_remove_nested_key() -> None:
|
|
"""_remove_nested_key removes a nested path."""
|
|
from qwenpaw.config.utils import _remove_nested_key
|
|
|
|
data = {"a": {"b": {"c": 1}}}
|
|
assert _remove_nested_key(data, ["a", "b", "c"]) is True
|
|
assert data == {"a": {"b": {}}}
|
|
assert _remove_nested_key(data, ["a", "x"]) is False
|