Projet

Général

Profil

0001-admin-return-a-proper-404-on-invalid-action-path-127.patch

Frédéric Péters, 27 juillet 2016 12:22

Télécharger (1,94 ko)

Voir les différences:

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(-)
tests/test_admin_pages.py
1704 1704
    resp = resp.click('Edit')
1705 1705
    assert not 'in_listing' in resp.form.fields.keys()
1706 1706

  
1707
def test_workflows_action_subpath(pub):
1708
    create_superuser(pub)
1709
    role = create_role()
1710
    Workflow.wipe()
1711
    workflow = Workflow(name='foo')
1712
    baz_status = workflow.add_status(name='baz')
1713
    display_message = DisplayMessageWorkflowStatusItem()
1714
    display_message.parent = baz_status
1715
    baz_status.items.append(display_message)
1716
    workflow.store()
1717

  
1718
    app = login(get_app(pub))
1719
    resp = app.get('/backoffice/workflows/%s/status/%s/items/1/' % (
1720
        workflow.id, baz_status.id))
1721

  
1722
    resp = app.get('/backoffice/workflows/%s/status/%s/items/1/crash' % (
1723
        workflow.id, baz_status.id), status=404)
1724

  
1707 1725
def test_workflows_delete_action(pub):
1708 1726
    create_superuser(pub)
1709 1727
    role = create_role()
wcs/workflows.py
1615 1615
    def to_init_with_xml(self, elem, charset, include_id=False):
1616 1616
        self._roles_init_with_xml('to', elem, charset, include_id)
1617 1617

  
1618
    def _q_admin_lookup(self, workflow, status, component, html_top):
1618
    def q_admin_lookup(self, workflow, status, component, html_top):
1619 1619
        return None
1620 1620

  
1621 1621
    def __getstate__(self):
1622
-