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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
ec59c24d
Commit
ec59c24d
authored
Nov 25, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_hal_json_style: WIP reproduce acquisition issue
parent
71f0dec8
Pipeline
#38225
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
...plateItem/portal_components/test.erp5.testHalJsonStyle.py
+33
-0
No files found.
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
View file @
ec59c24d
...
@@ -2449,6 +2449,39 @@ return context.getPortalObject().portal_catalog(portal_type='Foo', sort_on=[('id
...
@@ -2449,6 +2449,39 @@ return context.getPortalObject().portal_catalog(portal_type='Foo', sort_on=[('id
result_dict
[
'_embedded'
][
'contents'
][
0
][
"title"
],
result_dict
[
'_embedded'
][
'contents'
][
0
][
"title"
],
u'
\
ufffd
\
ufffd
\
ufffd
'
if
six
.
PY2
else
u'
\
udce9
\
udccf
\
udcf3
\
udcaf
'
)
u'
\
ufffd
\
ufffd
\
ufffd
'
if
six
.
PY2
else
u'
\
udce9
\
udccf
\
udcf3
\
udcaf
'
)
@
simulate
(
'Base_getRequestUrl'
,
'*args, **kwargs'
,
'return "http://example.org/bar"'
)
@
simulate
(
'Base_getRequestHeader'
,
'*args, **kwargs'
,
'return "application/hal+json"'
)
@
createIndexedDocument
(
quantity
=
1
)
@
changeSkin
(
'Hal'
)
def
test_getHateoas_cell_acquisition_context
(
self
,
document
):
fake_request
=
do_fake_request
(
"GET"
)
result
=
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
REQUEST
=
fake_request
,
mode
=
"search"
,
select_list
=
[
"id"
,
"absolute_url"
],
query
=
'uid:"%s"'
%
document
.
getUid
(),
)
self
.
assertEqual
(
fake_request
.
RESPONSE
.
status
,
200
)
self
.
assertEqual
(
fake_request
.
RESPONSE
.
getHeader
(
'Content-Type'
),
"application/hal+json"
)
result_dict
=
json
.
loads
(
result
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'self'
],
{
"href"
:
"http://example.org/bar"
})
self
.
assertEqual
(
result_dict
[
'_debug'
],
"search"
)
self
.
assertEqual
(
result_dict
[
'_limit'
],
10
)
self
.
assertEqual
(
result_dict
[
'_query'
],
'uid:"%s"'
%
document
.
getUid
())
self
.
assertEqual
(
result_dict
[
'_local_roles'
],
None
)
self
.
assertEqual
(
result_dict
[
'_select_list'
],
[
"id"
,
"absolute_url"
])
self
.
assertEqual
(
len
(
result_dict
[
'_embedded'
][
'contents'
]),
1
)
absolute_url
=
result_dict
[
'_embedded'
][
'contents'
][
0
][
"absolute_url"
]
self
.
assertEqual
(
str
(
absolute_url
),
'%s/%s'
%
(
self
.
portal
.
web_site_module
.
hateoas
.
absolute_url
(),
document
.
getRelativeUrl
()))
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
0
][
"_links"
][
"self"
][
"href"
],
"urn:jio:get:%s"
%
relative_url
)
# No count if not in the listbox context currently
self
.
assertEqual
(
result_dict
[
'_embedded'
].
get
(
'count'
,
None
),
None
)
class
TestERP5Person_getHateoas_mode_search
(
ERP5HALJSONStyleSkinsMixin
):
class
TestERP5Person_getHateoas_mode_search
(
ERP5HALJSONStyleSkinsMixin
):
"""Test HAL_JSON operations on cataloged Persons and other allowed content types of Person Module."""
"""Test HAL_JSON operations on cataloged Persons and other allowed content types of Person Module."""
...
...
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