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
Alexander Emmerich
erp5
Commits
77c1c67e
Commit
77c1c67e
authored
Nov 19, 2019
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testERP5Core: also test the tools registration when testing the site manager migration
parent
f7445044
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
20 deletions
+21
-20
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Core.py
...tTemplateItem/portal_components/test.erp5.testERP5Core.py
+21
-20
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Core.py
View file @
77c1c67e
...
@@ -576,7 +576,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -576,7 +576,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
if
i
.
getId
()
not
in
(
'portal_uidhandler'
,)
and
if
i
.
getId
()
not
in
(
'portal_uidhandler'
,)
and
0
!=
i
.
getUid
()
!=
i
.
getProperty
(
'uid'
)])
0
!=
i
.
getUid
()
!=
i
.
getProperty
(
'uid'
)])
def
test_site_manager_and_translation_migration
(
self
):
def
test_
04_
site_manager_and_translation_migration
(
self
):
from
zope.site.hooks
import
getSite
,
setSite
from
zope.site.hooks
import
getSite
,
setSite
from
zope.component
import
queryUtility
from
zope.component
import
queryUtility
from
zope.i18n.interfaces
import
ITranslationDomain
from
zope.i18n.interfaces
import
ITranslationDomain
...
@@ -594,25 +594,26 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -594,25 +594,26 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
assertEqual
(
queryUtility
(
ITranslationDomain
,
'ui'
),
None
)
self
.
assertEqual
(
queryUtility
(
ITranslationDomain
,
'ui'
),
None
)
# now let's simulate a site just migrated from Zope 2.8 that's being
# now let's simulate a site just migrated from Zope 2.8 that's being
# accessed for the first time:
# accessed for the first time:
old_site
=
getSite
()
from
Products.ERP5
import
ERP5Site
try
:
setSite
()
setSite
()
# Sites from Zope2.8 don't have a site_manager yet.
# Sites from Zope2.8 don't have a site_manager yet.
del
self
.
portal
.
_components
del
self
.
portal
.
_components
self
.
assertIsNotNone
(
ERP5Site
.
_missing_tools_registered
)
ERP5Site
.
_missing_tools_registered
=
None
self
.
commit
()
# check that we can't get any translation utility
# check that we can't get any translation utility
self
.
assertEqual
(
queryUtility
(
ITranslationDomain
,
'erp5_ui'
),
None
)
self
.
assertEqual
(
queryUtility
(
ITranslationDomain
,
'erp5_ui'
),
None
)
# Now simulate first access. Default behaviour from
# Now simulate first access. Default behaviour from
# ObjectManager is to raise a ComponentLookupError here:
# ObjectManager is to raise a ComponentLookupError here:
setSite
(
self
.
portal
)
setSite
(
self
.
portal
)
self
.
commit
()
self
.
assertIsNotNone
(
ERP5Site
.
_missing_tools_registered
)
# This should have automatically reconstructed the i18n utility
# This should have automatically reconstructed the i18n utility
# registrations:
# registrations:
self
.
assertEqual
(
queryUtility
(
ITranslationDomain
,
'erp5_ui'
),
self
.
assertEqual
(
queryUtility
(
ITranslationDomain
,
'erp5_ui'
),
erp5_ui_catalog
)
erp5_ui_catalog
)
self
.
assertEqual
(
queryUtility
(
ITranslationDomain
,
'ui'
),
erp5_ui_catalog
)
self
.
assertEqual
(
queryUtility
(
ITranslationDomain
,
'ui'
),
erp5_ui_catalog
)
finally
:
# clean everything up, we don't want to mess the test environment
self
.
abort
()
setSite
(
old_site
)
def
test_BasicAuthenticateDesactivated
(
self
):
def
test_BasicAuthenticateDesactivated
(
self
):
"""Make sure Unauthorized error does not lead to Basic auth popup in browser"""
"""Make sure Unauthorized error does not lead to Basic auth popup in browser"""
...
...
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