mirror of
				https://github.com/arcan1s/ahriman.git
				synced 2025-11-03 23:33:41 +00:00 
			
		
		
		
	review fixes
This commit is contained in:
		@ -1 +1,9 @@
 | 
			
		||||
# nothing to test here
 | 
			
		||||
from ahriman.application.handlers.triggers import Triggers
 | 
			
		||||
from ahriman.application.handlers.triggers_support import TriggersSupport
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_arguments() -> None:
 | 
			
		||||
    """
 | 
			
		||||
    must define own arguments
 | 
			
		||||
    """
 | 
			
		||||
    assert TriggersSupport.arguments != Triggers.arguments
 | 
			
		||||
 | 
			
		||||
@ -36,8 +36,8 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
 | 
			
		||||
    """
 | 
			
		||||
    args = _default_args(args)
 | 
			
		||||
    mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
 | 
			
		||||
    setup_mock = mocker.patch("ahriman.web.web.setup_server")
 | 
			
		||||
    run_mock = mocker.patch("ahriman.web.web.run_server")
 | 
			
		||||
    setup_mock = mocker.patch("ahriman.application.handlers.web.setup_server")
 | 
			
		||||
    run_mock = mocker.patch("ahriman.application.handlers.web.run_server")
 | 
			
		||||
    start_mock = mocker.patch("ahriman.core.spawn.Spawn.start")
 | 
			
		||||
    trigger_mock = mocker.patch("ahriman.core.triggers.TriggerLoader.load")
 | 
			
		||||
    stop_mock = mocker.patch("ahriman.core.spawn.Spawn.stop")
 | 
			
		||||
 | 
			
		||||
@ -6,6 +6,15 @@ from ahriman.core.module_loader import _modules, implementations
 | 
			
		||||
from ahriman.web.views.base import BaseView
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_modules() -> None:
 | 
			
		||||
    """
 | 
			
		||||
    must load modules
 | 
			
		||||
    """
 | 
			
		||||
    modules = list(_modules(Path(__file__).parent.parent, "ahriman.web.views"))
 | 
			
		||||
    assert modules
 | 
			
		||||
    assert all(not module.ispkg for module in modules)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_implementations() -> None:
 | 
			
		||||
    """
 | 
			
		||||
    must load implementations from the package
 | 
			
		||||
@ -14,12 +23,3 @@ def test_implementations() -> None:
 | 
			
		||||
    assert routes
 | 
			
		||||
    assert all(isinstance(view, type) for view in routes)
 | 
			
		||||
    assert all(issubclass(view, BaseView) for view in routes)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_modules() -> None:
 | 
			
		||||
    """
 | 
			
		||||
    must load modules
 | 
			
		||||
    """
 | 
			
		||||
    modules = list(_modules(Path(__file__).parent.parent, "ahriman.web.views"))
 | 
			
		||||
    assert modules
 | 
			
		||||
    assert all(not module.ispkg for module in modules)
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,7 @@ def test_dynamic_routes(resource_path_root: Path, configuration: Configuration)
 | 
			
		||||
        if file.suffix == ".py" and file.name not in ("__init__.py", "base.py", "status_view_guard.py")
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    routes = _dynamic_routes(configuration)
 | 
			
		||||
    routes = dict(_dynamic_routes(configuration))
 | 
			
		||||
    assert all(isinstance(view, type) for view in routes.values())
 | 
			
		||||
    assert len(set(routes.values())) == len(expected_views)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -36,7 +36,6 @@ async def test_get_not_found(client_with_auth: TestClient, mocker: MockerFixture
 | 
			
		||||
    """
 | 
			
		||||
    must raise not found if path is invalid
 | 
			
		||||
    """
 | 
			
		||||
    print([route.handler for route in client_with_auth.app.router.routes()])
 | 
			
		||||
    static_route = next(route for route in client_with_auth.app.router.routes() if route.handler == StaticView)
 | 
			
		||||
    mocker.patch.object(static_route.handler, "ROUTES", [])
 | 
			
		||||
    response = await client_with_auth.get("/favicon.ico", allow_redirects=False)
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user