Commit 2af448ce authored by Boxiang Sun's avatar Boxiang Sun

erp5_hal_json_style: Add a test to reproduce the draft view validation error

parent 05529fd6
......@@ -71,7 +71,7 @@ if dialog_method == 'Base_configureSortOn':
# Exceptions for Workflow
if dialog_method == 'Workflow_statusModify':
return context.Workflow_statusModify(form_id=form_id,
dialog_id=dialog_id)
dialog_id=dialog_id, REQUEST=request)
# Exception for edit relation
if dialog_method == 'Base_editRelation':
......
......@@ -708,6 +708,31 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
document.getRelativeUrl()))
self.assertEqual(result_dict['_embedded']['_view']['_actions']['put']['method'], 'POST')
@simulate('Base_getRequestUrl', '*args, **kwargs',
'return "http://example.org/bar"')
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
@changeSkin('Hal')
def test_getHateoasDocument_draft_view(self):
document = self._makeDocument()
fake_request = do_fake_request("POST" , data=(
('field_your_comment', ''),
('field_your_workflow_action', 'validate_action'),
('selection_name', 'foo_selection'),
))
response = document.Base_callDialogMethod(
REQUEST=fake_request,
dialog_method='Workflow_statusModify',
dialog_id='Base_viewWorkflowActionDialog',
form_id='Foo_view',
)
fake_request = do_fake_request("GET")
result = self.portal.web_site_module.hateoas.ERP5Document_getHateoas(REQUEST=fake_request, mode="traverse", relative_url=document.getRelativeUrl(), view="view_draft")
@simulate('Base_getRequestUrl', '*args, **kwargs',
'return "http://example.org/bar"')
@simulate('Base_getRequestHeader', '*args, **kwargs',
......
......@@ -45,7 +45,11 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
<tuple>
<string>W:719, 4: Unused variable \'result\' (unused-variable)</string>
<string>W:736, 4: Unused variable \'response\' (unused-variable)</string>
<string>W:744, 4: Unused variable \'result\' (unused-variable)</string>
</tuple>
</value>
</item>
<item>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment