Skip to content

Commit 08befc5

Browse files
committed
Add validation step to the migrator.
1 parent 4a79a35 commit 08befc5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

opengever/maintenance/scripts/repository_migration_analyse.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from openpyxl import Workbook
1818
from openpyxl.styles import Font
1919
from plone import api
20+
from plone.app.uuid.utils import uuidToCatalogBrain
2021
from plone.app.uuid.utils import uuidToObject
2122
from plone.uuid.interfaces import IUUID
2223
from uuid import uuid4
@@ -421,6 +422,25 @@ def reindex(self):
421422
obj.reindexObject(idxs=['Title', 'sortable_title', 'path',
422423
'reference', 'Description'])
423424

425+
def validate(self):
426+
"""This steps make sure that the repository system has
427+
been correctly migrated."""
428+
429+
for item in self.operations_list:
430+
obj = uuidToObject(item['uid'])
431+
432+
# Assert reference number, title and description on the object
433+
assert item['new_item']['position'] == obj.get_repository_number()
434+
assert item['new_item']['title'] == obj.title_de
435+
assert item['new_item']['description'] == obj.description
436+
437+
# Assert catalog
438+
brain = uuidToCatalogBrain(item['uid'])
439+
expected_title = u'{} {}'.format(
440+
item['new_item']['position'], item['new_item']['title'])
441+
assert expected_title == brain.title_de
442+
443+
424444
class FakeOptions(object):
425445
dry_run = False
426446

0 commit comments

Comments
 (0)