Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5_fork
Commits
c1482525
Commit
c1482525
authored
Aug 29, 2012
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IDTool: check that export / import also work when use clear=True
parent
d7fca2a4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
product/ERP5/tests/testIdTool.py
product/ERP5/tests/testIdTool.py
+33
-0
No files found.
product/ERP5/tests/testIdTool.py
View file @
c1482525
...
...
@@ -297,6 +297,7 @@ class TestIdTool(ERP5TypeTestCase):
generator
.
importGeneratorIdDict
(
id_dict
=
{
'06'
:
6
})
self
.
assertEquals
(
7
,
self
.
id_tool
.
generateNewId
(
id_generator
=
id_generator
,
id_group
=
'06'
))
def
test_06_ExportImportDict
(
self
):
"""
Check export import dict for generator sql and zodb
...
...
@@ -304,6 +305,38 @@ class TestIdTool(ERP5TypeTestCase):
self
.
checkExportImportDict
(
id_generator
=
'test_application_zodb'
)
self
.
checkExportImportDict
(
id_generator
=
'test_application_sql'
)
def
checkExportClearImportDict
(
self
,
id_generator
):
"""
Check export clear import on id generator
"""
generator
=
self
.
getLastGenerator
(
id_generator
)
self
.
assertEquals
(
0
,
self
.
id_tool
.
generateNewId
(
id_generator
=
id_generator
,
id_group
=
'07'
))
id_dict
=
generator
.
exportGeneratorIdDict
()
id_dict_before
=
dict
(
id_dict
)
generator
.
importGeneratorIdDict
(
id_dict
=
id_dict
,
clear
=
True
)
# make sure it is reimported properly
self
.
assertEquals
(
id_dict_before
,
generator
.
exportGeneratorIdDict
())
# make sure generating a new id will increment
self
.
assertEquals
(
1
,
self
.
id_tool
.
generateNewId
(
id_generator
=
id_generator
,
id_group
=
'07'
))
self
.
assertEquals
(
0
,
self
.
id_tool
.
generateNewId
(
id_generator
=
id_generator
,
id_group
=
'another_group'
))
# reimport clearing, the group we just use should have been cleared out
generator
.
importGeneratorIdDict
(
id_dict
=
id_dict
,
clear
=
True
)
id_dict
=
generator
.
exportGeneratorIdDict
()
self
.
assertFalse
(
'another_group'
in
id_dict
,
id_dict
)
def
test_06_ExportClearImportDict
(
self
):
"""
Check export clear import dict for generator sql and zodb
"""
self
.
checkExportClearImportDict
(
id_generator
=
'test_application_zodb'
)
self
.
checkExportClearImportDict
(
id_generator
=
'test_application_sql'
)
def
test_07_checkImportValueAndStoreInterval
(
self
):
"""
Check that the store_interval store the last_id every N increments
...
...
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