Commit 16d1b74b authored by Boxiang Sun's avatar Boxiang Sun

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

parent f9288dbc
...@@ -71,7 +71,7 @@ if dialog_method == 'Base_configureSortOn': ...@@ -71,7 +71,7 @@ if dialog_method == 'Base_configureSortOn':
# Exceptions for Workflow # Exceptions for Workflow
if dialog_method == 'Workflow_statusModify': if dialog_method == 'Workflow_statusModify':
return context.Workflow_statusModify(form_id=form_id, return context.Workflow_statusModify(form_id=form_id,
dialog_id=dialog_id) dialog_id=dialog_id, REQUEST=request)
# Exception for edit relation # Exception for edit relation
if dialog_method == 'Base_editRelation': if dialog_method == 'Base_editRelation':
......
...@@ -709,6 +709,31 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin): ...@@ -709,6 +709,31 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
document.getRelativeUrl())) document.getRelativeUrl()))
self.assertEqual(result_dict['_embedded']['_view']['_actions']['put']['method'], 'POST') 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', @simulate('Base_getRequestUrl', '*args, **kwargs',
'return "http://example.org/bar"') 'return "http://example.org/bar"')
@simulate('Base_getRequestHeader', '*args, **kwargs', @simulate('Base_getRequestHeader', '*args, **kwargs',
......
...@@ -45,7 +45,11 @@ ...@@ -45,7 +45,11 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <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> </value>
</item> </item>
<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