Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alecs_myu
erp5
Commits
f15499b2
Commit
f15499b2
authored
Apr 30, 2018
by
Tomáš Peterka
Committed by
Tomáš Peterka
Apr 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[hal_json] Fix edge cases in tests (and unused import)
parent
81883086
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
...plateItem/portal_components/test.erp5.testHalJsonStyle.py
+9
-4
No files found.
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
View file @
f15499b2
...
@@ -777,12 +777,11 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -777,12 +777,11 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
)
)
result_dict
=
json
.
loads
(
result
)
result_dict
=
json
.
loads
(
result
)
_
,
group_fields
=
result_dict
[
'group_list'
][
-
1
]
_
,
group_fields
=
result_dict
[
'group_list'
][
-
1
]
field_names
=
[
field_name
for
field_name
,
field_type
in
group_fields
]
field_names
=
[
field_name
for
field_name
,
_
in
group_fields
]
self
.
assertIn
(
"form_id"
,
field_names
)
self
.
assertIn
(
"form_id"
,
field_names
)
self
.
assertIn
(
"dialog_id"
,
field_names
)
self
.
assertIn
(
"dialog_id"
,
field_names
)
# no need for dialog_method because that one is hardcoded in javascript
# no need for dialog_method because that one is hardcoded in javascript
@
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'
,
...
@@ -974,6 +973,11 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -974,6 +973,11 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
"application/hal+json"
"application/hal+json"
)
)
result_dict = json.loads(result)
result_dict = json.loads(result)
if isinstance(result_dict['
_links
']['
action_object_jio_action
'], dict):
object_jio_action = result_dict['
_links
']['
action_object_jio_action
']
self.assertTrue(object_jio_action['
templated
'])
self.assertTrue("{&" in object_jio_action['
href
'])
else:
for object_jio_action in result_dict['
_links
']['
action_object_jio_action
']:
for object_jio_action in result_dict['
_links
']['
action_object_jio_action
']:
# the link is a template
# the link is a template
self.assertTrue(object_jio_action['
templated
'])
self.assertTrue(object_jio_action['
templated
'])
...
@@ -1428,6 +1432,7 @@ return context.getPortalObject().portal_catalog(portal_type='Foo', sort_on=[('id
...
@@ -1428,6 +1432,7 @@ return context.getPortalObject().portal_catalog(portal_type='Foo', sort_on=[('id
Practically, because we code in python, it can be any object.
Practically, because we code in python, it can be any object.
"""
"""
fake_request
=
do_fake_request
(
"GET"
)
fake_request
=
do_fake_request
(
"GET"
)
document_list
=
sorted
(
document_list
,
key
=
lambda
d
:
d
.
getId
())
result
=
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
result
=
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
REQUEST
=
fake_request
,
REQUEST
=
fake_request
,
mode
=
"search"
,
mode
=
"search"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment