From 394bfe7e9d7035d6371eb2d730674a9bfb1e7e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 27 Jul 2016 12:21:47 +0200 Subject: [PATCH] admin: return a proper 404 on invalid action path (#12760) --- tests/test_admin_pages.py | 18 ++++++++++++++++++ wcs/workflows.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/test_admin_pages.py b/tests/test_admin_pages.py index 750a9be..54c516e 100644 --- a/tests/test_admin_pages.py +++ b/tests/test_admin_pages.py @@ -1704,6 +1704,24 @@ def test_workflows_edit_display_form_action(pub): resp = resp.click('Edit') assert not 'in_listing' in resp.form.fields.keys() +def test_workflows_action_subpath(pub): + create_superuser(pub) + role = create_role() + Workflow.wipe() + workflow = Workflow(name='foo') + baz_status = workflow.add_status(name='baz') + display_message = DisplayMessageWorkflowStatusItem() + display_message.parent = baz_status + baz_status.items.append(display_message) + workflow.store() + + app = login(get_app(pub)) + resp = app.get('/backoffice/workflows/%s/status/%s/items/1/' % ( + workflow.id, baz_status.id)) + + resp = app.get('/backoffice/workflows/%s/status/%s/items/1/crash' % ( + workflow.id, baz_status.id), status=404) + def test_workflows_delete_action(pub): create_superuser(pub) role = create_role() diff --git a/wcs/workflows.py b/wcs/workflows.py index 9e0189c..f3f74b2 100644 --- a/wcs/workflows.py +++ b/wcs/workflows.py @@ -1615,7 +1615,7 @@ class WorkflowStatusItem(XmlSerialisable): def to_init_with_xml(self, elem, charset, include_id=False): self._roles_init_with_xml('to', elem, charset, include_id) - def _q_admin_lookup(self, workflow, status, component, html_top): + def q_admin_lookup(self, workflow, status, component, html_top): return None def __getstate__(self): -- 2.8.1