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
138
Merge Requests
138
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
24bf3539
Commit
24bf3539
authored
Feb 18, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HalJsonStyle: py3 (OK py2)
parent
0a638c70
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
...plateItem/portal_components/test.erp5.testHalJsonStyle.py
+8
-5
No files found.
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
View file @
24bf3539
...
...
@@ -16,6 +16,7 @@ from six.moves import cStringIO as StringIO
import
json
import
re
from
six.moves.urllib.parse
import
quote
,
quote_plus
import
six
import
mock
from
zope.globalrequest
import
setRequest
# pylint: disable=no-name-in-module, import-error
...
...
@@ -1324,7 +1325,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
def test_getHateoasDocument_property_corrupted_encoding(self):
document = self._makeDocument()
# this sequence of bytes does not encode to UTF-8
document.setTitle('
\
xe9
\
xcf
\
xf3
\
xaf
')
document.setTitle(
b
'
\
xe9
\
xcf
\
xf3
\
xaf
')
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")
self.assertEqual(fake_request.RESPONSE.status, 200)
...
...
@@ -1682,10 +1683,12 @@ class TestERP5Document_getHateoas_mode_search(ERP5HALJSONStyleSkinsMixin):
def test_getHateoas_default_param_json_param(self):
fake_request = do_fake_request("GET")
unknown_columns_re = re.escape("Unknown columns ['
ê
']")
if six.PY2:
unknown_columns_re = "Unknown columns.*
\
\
\
\
xc3
\
\
\
\
xaa.*"
self.assertRaisesRegex(
TypeError,
# "Unknown columns.*'
\\
xc3
\\
xaa
'.",
"Unknown columns.*
\
\
\
\
xc3
\
\
\
\
xaa.*",
unknown_columns_re,
self.portal.web_site_module.hateoas.ERP5Document_getHateoas,
REQUEST=fake_request,
mode="search",
...
...
@@ -1725,7 +1728,7 @@ return context.getPortalObject().foo_module.contentValues()
form_relative_url='
portal_skins
/
erp5_ui_test
/
FooModule_viewFooList
/
listbox
'
)
result_dict = json.loads(result)
#
edital
ble creation date is defined at proxy form
#
edita
ble creation date is defined at proxy form
# Test the listbox_uid parameter
self.assertEqual(result_dict['
_embedded
']['
contents
'][0]['
listbox_uid
:
list
']['
key
'], '
listbox_uid
:
list
')
self.assertEqual(result_dict['
_embedded
']['
contents
'][0]['
id
']['
field_gadget_param
']['
type
'], '
StringField
')
...
...
@@ -2422,7 +2425,7 @@ return context.getPortalObject().portal_catalog(portal_type='Foo', sort_on=[('id
@
changeSkin
(
'Hal'
)
def
test_getHateoas_property_corrupted_encoding
(
self
,
document
):
# this sequence of bytes does not encode to UTF-8
document
.
setTitle
(
'
\
xe9
\
xcf
\
xf3
\
xaf
'
)
document
.
setTitle
(
b
'
\
xe9
\
xcf
\
xf3
\
xaf
'
)
# self.tic()
fake_request
=
do_fake_request
(
"GET"
)
...
...
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