mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-31 10:01:53 +08:00
fixed tests
This commit is contained in:
@@ -27,6 +27,7 @@ import aiohttp.web
|
|||||||
import aiohttp_basicauth
|
import aiohttp_basicauth
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
import pytest_asyncio
|
||||||
|
|
||||||
from . import get_configured_auth_service
|
from . import get_configured_auth_service
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ async def _handle_auth(request: aiohttp.web.BaseRequest) -> aiohttp.web.Response
|
|||||||
return aiohttp.web.Response(text=str(status), status=status)
|
return aiohttp.web.Response(text=str(status), status=status)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="auth_server_port")
|
@pytest_asyncio.fixture(name="auth_server_port")
|
||||||
async def _auth_server_port_fixture(aiohttp_server) -> AsyncGenerator[int, None]: # type: ignore
|
async def _auth_server_port_fixture(aiohttp_server) -> AsyncGenerator[int, None]: # type: ignore
|
||||||
auth = aiohttp_basicauth.BasicAuthMiddleware(
|
auth = aiohttp_basicauth.BasicAuthMiddleware(
|
||||||
username="server-admin",
|
username="server-admin",
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ from typing import AsyncGenerator
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
import pytest_asyncio
|
||||||
|
|
||||||
from . import get_configured_auth_service
|
from . import get_configured_auth_service
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ async def _run_process(cmd: str, input: Optional[str]=None) -> None: # pylint:
|
|||||||
assert proc.returncode == 0
|
assert proc.returncode == 0
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="test_user")
|
@pytest_asyncio.fixture(name="test_user")
|
||||||
async def _test_user() -> AsyncGenerator[None, None]:
|
async def _test_user() -> AsyncGenerator[None, None]:
|
||||||
with pytest.raises(KeyError):
|
with pytest.raises(KeyError):
|
||||||
pwd.getpwnam(_USER)
|
pwd.getpwnam(_USER)
|
||||||
|
|||||||
Reference in New Issue
Block a user