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
Bryan Kaperick
erp5
Commits
1b062408
Commit
1b062408
authored
Dec 05, 2014
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update testIdToolUpgrade due to recent change in IdTool compatibility code
testIdToolUpgrade failed since commit
a463bc45
parent
235c29f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
33 deletions
+15
-33
product/ERP5/tests/testIdToolUpgrade.py
product/ERP5/tests/testIdToolUpgrade.py
+15
-33
No files found.
product/ERP5/tests/testIdToolUpgrade.py
View file @
1b062408
...
@@ -53,7 +53,6 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
...
@@ -53,7 +53,6 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
self
.
login
()
self
.
login
()
self
.
portal
=
self
.
getPortal
()
self
.
id_tool
=
self
.
portal
.
portal_ids
self
.
id_tool
=
self
.
portal
.
portal_ids
self
.
id_tool
.
initializeGenerator
(
all
=
True
)
self
.
id_tool
.
initializeGenerator
(
all
=
True
)
self
.
createGenerators
()
self
.
createGenerators
()
...
@@ -110,11 +109,10 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
...
@@ -110,11 +109,10 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
.
getLatestVersionValue
()
.
getLatestVersionValue
()
return
last_generator
return
last_generator
def
testUpgradeIdToolDicts
(
self
):
def
testUpgradeIdToolDicts
(
self
):
# With old erp5_core, we have no generators, no IdTool_* zsql methods,
# With old erp5_core, we have no generators, no IdTool_* zsql methods,
# and we have a dictionary stored on id tool
# and we have a dictionary stored on id tool
id_tool
=
self
.
getPortal
()
.
portal_ids
id_tool
=
self
.
portal
.
portal_ids
# Rebuild a persistent mapping like it already existed in beginning 2010
# Rebuild a persistent mapping like it already existed in beginning 2010
# First persistent mapping of generateNewLengthIdList
# First persistent mapping of generateNewLengthIdList
id_tool
.
dict_length_ids
=
PersistentMapping
()
id_tool
.
dict_length_ids
=
PersistentMapping
()
...
@@ -128,41 +126,25 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
...
@@ -128,41 +126,25 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
# it was unfortunately possible to define something else
# it was unfortunately possible to define something else
# than strings
# than strings
id_tool
.
dict_ids
[(
'bar'
,
'baz'
)]
=
2
id_tool
.
dict_ids
[(
'bar'
,
'baz'
)]
=
2
# Delete new zsql methods which are used by new code
# Delete portal type info and new generators
skin_folder
=
self
.
getPortal
().
portal_skins
.
erp5_core
id_tool
.
manage_delObjects
(
ids
=
list
(
id_tool
.
objectIds
()))
custom_skin_folder
=
self
.
getPortal
().
portal_skins
.
custom
id_tool
.
__class__
.
getTypeInfo
=
lambda
self
:
None
script_id_list
=
[
x
for
x
in
skin_folder
.
objectIds
()
# Test with compatibility
if
x
.
startswith
(
'IdTool'
)]
self
.
tic
()
self
.
assertTrue
(
len
(
script_id_list
)
>
0
)
cp_data
=
skin_folder
.
manage_cutObjects
(
ids
=
script_id_list
)
custom_skin_folder
.
manage_pasteObjects
(
cp_data
)
# Set old revision for erp5_core bt, because the id tool decide which code
# to run depending on this revision
template_tool
=
self
.
getPortal
().
portal_templates
erp5_core_bt_list
=
[
x
for
x
in
template_tool
.
objectValues
()
if
x
.
getTitle
()
==
'erp5_core'
]
self
.
assertEqual
(
len
(
erp5_core_bt_list
),
1
)
erp5_core_bt
=
erp5_core_bt_list
[
0
]
erp5_core_bt
.
setRevision
(
1561
)
# Delete all new generators
generator_id_list
=
[
x
for
x
in
id_tool
.
objectIds
()]
id_tool
.
manage_delObjects
(
ids
=
generator_id_list
)
id_list
=
id_tool
.
generateNewLengthIdList
(
id_group
=
'foo'
,
store
=
1
)
id_list
=
id_tool
.
generateNewLengthIdList
(
id_group
=
'foo'
,
store
=
1
)
self
.
assertEqual
(
id_list
,
[
5
])
self
.
assertEqual
(
id_list
,
[
5
])
self
.
assertEqual
(
int
(
id_tool
.
dict_length_ids
[
'foo'
].
value
),
6
)
self
.
assertEqual
(
int
(
id_tool
.
dict_length_ids
[
'foo'
].
value
),
6
)
# Now, reinstall erp5_core, and make sure we still have the possibility
# Now, restore and make sure we can still generate ids
# to continue generating ids
del
id_tool
.
__class__
.
getTypeInfo
cp_data
=
template_tool
.
manage_copyObjects
(
ids
=
(
erp5_core_bt
.
getId
(),))
bt
=
self
.
portal
.
portal_templates
.
getInstalledBusinessTemplate
(
'erp5_core'
,
new_id
=
template_tool
.
manage_pasteObjects
(
cp_data
)[
0
][
'new_id'
]
strict
=
True
)
new_bt
=
template_tool
[
new_id
]
for
path
,
obj
in
bt
.
_path_item
.
_objects
.
iteritems
():
path
,
obj_id
=
path
.
rsplit
(
'/'
,
1
)
if
path
==
'portal_ids'
:
id_tool
.
_setObject
(
obj_id
,
obj
.
_getCopy
(
bt
))
self
.
tic
()
self
.
tic
()
self
.
commit
()
new_bt
.
install
(
force
=
1
)
erp5_core_bt
.
setRevision
(
1562
)
cp_data
=
custom_skin_folder
.
manage_cutObjects
(
ids
=
script_id_list
)
skin_folder
.
manage_pasteObjects
(
cp_data
)
id_list
=
id_tool
.
generateNewLengthIdList
(
id_group
=
'foo'
)
id_list
=
id_tool
.
generateNewLengthIdList
(
id_group
=
'foo'
)
# it is known that with current upgrade there is a
w
hole
# it is known that with current upgrade there is a hole
self
.
assertEqual
(
id_list
,
[
7
])
self
.
assertEqual
(
id_list
,
[
7
])
new_id
=
id_tool
.
generateNewId
(
id_group
=
'foo'
)
new_id
=
id_tool
.
generateNewId
(
id_group
=
'foo'
)
self
.
assertEqual
(
new_id
,
4
)
self
.
assertEqual
(
new_id
,
4
)
...
...
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