mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-06-28 06:41:43 +00:00
add static files support and cookie expiration settings
This commit is contained in:
@ -62,6 +62,7 @@ def test_get_local_files(s3: S3, resource_path_root: Path) -> None:
|
||||
Path("web/templates/build-status/login-modal.jinja2"),
|
||||
Path("web/templates/build-status/package-actions-modals.jinja2"),
|
||||
Path("web/templates/build-status/package-actions-script.jinja2"),
|
||||
Path("web/templates/static/favicon.ico"),
|
||||
Path("web/templates/utils/bootstrap-scripts.jinja2"),
|
||||
Path("web/templates/utils/style.jinja2"),
|
||||
Path("web/templates/build-status.jinja2"),
|
||||
|
@ -88,14 +88,11 @@ async def test_auth_handler_write(auth: Auth, mocker: MockerFixture) -> None:
|
||||
check_permission_mock.assert_called_with(aiohttp_request, UserAccess.Write, aiohttp_request.path)
|
||||
|
||||
|
||||
def test_setup_auth(
|
||||
application_with_auth: web.Application,
|
||||
configuration: Configuration,
|
||||
mocker: MockerFixture) -> None:
|
||||
def test_setup_auth(application_with_auth: web.Application, auth: Auth, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must setup authorization
|
||||
"""
|
||||
aiohttp_security_setup_mock = mocker.patch("aiohttp_security.setup")
|
||||
application = setup_auth(application_with_auth, configuration)
|
||||
application = setup_auth(application_with_auth, auth)
|
||||
assert application.get("validator") is not None
|
||||
aiohttp_security_setup_mock.assert_called_once()
|
||||
|
@ -1,11 +1,12 @@
|
||||
from aiohttp import web
|
||||
|
||||
from ahriman.core.configuration import Configuration
|
||||
from ahriman.web.routes import setup_routes
|
||||
|
||||
|
||||
def test_setup_routes(application: web.Application) -> None:
|
||||
def test_setup_routes(application: web.Application, configuration: Configuration) -> None:
|
||||
"""
|
||||
must generate non empty list of routes
|
||||
"""
|
||||
setup_routes(application)
|
||||
setup_routes(application, configuration.getpath("web", "static_path"))
|
||||
assert application.router.routes()
|
||||
|
@ -26,3 +26,11 @@ async def test_get_without_auth(client: TestClient) -> None:
|
||||
response = await client.get("/")
|
||||
assert response.status == 200
|
||||
assert await response.text()
|
||||
|
||||
|
||||
async def test_get_static(client: TestClient) -> None:
|
||||
"""
|
||||
must return static files
|
||||
"""
|
||||
response = await client.get("/static/favicon.ico")
|
||||
assert response.status == 200
|
||||
|
@ -59,4 +59,5 @@ secret_key =
|
||||
|
||||
[web]
|
||||
host = 127.0.0.1
|
||||
static_path = ../web/templates/static
|
||||
templates = ../web/templates
|
Reference in New Issue
Block a user