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
Nikola Balog
erp5
Commits
af95e7b3
Commit
af95e7b3
authored
Dec 28, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
od*_style: test translation of fields label and form titles
parent
275e2faa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
product/ERP5OOo/tests/testOOoStyle.py
product/ERP5OOo/tests/testOOoStyle.py
+41
-0
No files found.
product/ERP5OOo/tests/testOOoStyle.py
View file @
af95e7b3
...
@@ -602,6 +602,47 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -602,6 +602,47 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
content_xml
=
parser
.
oo_files
[
'content.xml'
]
content_xml
=
parser
.
oo_files
[
'content.xml'
]
self
.
assertIn
(
'<Escape>&<text:line-break/>newline'
,
content_xml
)
self
.
assertIn
(
'<Escape>&<text:line-break/>newline'
,
content_xml
)
def
test_translation
(
self
):
def
gettext
(
message
,
**
kw
):
if
message
==
'First Name'
:
return
u'**àèüîó**'
return
kw
.
get
(
'default'
,
message
)
with
mock
.
patch
.
object
(
self
.
portal
.
Localizer
.
erp5_ui
.
__class__
,
'gettext'
,
side_effect
=
gettext
,
)
as
gettext_mock
:
for
url
in
(
# form_list
'/%s/person_module/PersonModule_viewPersonList'
%
self
.
portal
.
getId
(),
# form_report
'/%s/person_module/pers/Base_viewHistory'
%
self
.
portal
.
getId
(),
# form_view (last because we'll assert the content)
'/%s/person_module/pers/Person_view'
%
self
.
portal
.
getId
(),
):
response
=
self
.
publish
(
url
,
self
.
auth
)
self
.
assertEqual
(
HTTP_OK
,
response
.
getStatus
())
content_type
=
response
.
getHeader
(
'content-type'
)
self
.
assertTrue
(
content_type
.
startswith
(
self
.
content_type
),
content_type
)
content_disposition
=
response
.
getHeader
(
'content-disposition'
)
self
.
assertEqual
(
'attachment'
,
content_disposition
.
split
(
';'
)[
0
])
body
=
response
.
getBody
()
self
.
_validate
(
body
)
from
Products.ERP5OOo.OOoUtils
import
OOoParser
parser
=
OOoParser
()
parser
.
openFromString
(
body
)
content_xml
=
parser
.
oo_files
[
'content.xml'
]
self
.
assertIn
(
u'**àèüîó**'
,
content_xml
.
decode
(
'utf-8'
))
translated_message_list
=
[
x
[
1
][
0
]
for
x
in
gettext_mock
.
mock_calls
if
x
[
1
][
0
]]
self
.
assertIn
(
'First Name'
,
translated_message_list
)
self
.
assertIn
(
self
.
portal
.
PersonModule_viewPersonList
.
title
,
translated_message_list
)
self
.
assertIn
(
self
.
portal
.
Person_view
.
title
,
translated_message_list
)
self
.
assertIn
(
self
.
portal
.
Base_viewHistory
.
title
,
translated_message_list
)
def
test_untranslatable_columns
(
self
):
def
test_untranslatable_columns
(
self
):
self
.
portal
.
ListBoxZuite_reset
()
self
.
portal
.
ListBoxZuite_reset
()
self
.
portal
.
Localizer
=
DummyLocalizer
()
self
.
portal
.
Localizer
=
DummyLocalizer
()
...
...
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