mirror of
https://github.com/OCA/knowledge.git
synced 2025-12-19 03:42:19 -06:00
[MIG] document_page: Migration to 9.0
This commit is contained in:
committed by
FernandoRomera
parent
705b5194a0
commit
e660a86201
36
document_page/tests/test_document_page_show_diff.py
Normal file
36
document_page/tests/test_document_page_show_diff.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from openerp.tests import common
|
||||
from openerp import _
|
||||
|
||||
|
||||
class TestDocumentPageShowDiff(common.TransactionCase):
|
||||
"""document_page_show_diff test class."""
|
||||
|
||||
def test_show_demo_page1_diff(self):
|
||||
"""Show test page history difference."""
|
||||
page = self.env.ref('document_page.demo_page1')
|
||||
|
||||
show_diff_object = self.env['wizard.document.page.history.show_diff']
|
||||
|
||||
history_document = self.env['document.page.history']
|
||||
history_pages = history_document.search([('page_id', '=', page.id)])
|
||||
|
||||
self.assertTrue(
|
||||
show_diff_object.with_context(
|
||||
active_ids=[i.id for i in history_pages]
|
||||
).get_diff()
|
||||
)
|
||||
|
||||
page.write({'content': 'Text content updated'})
|
||||
page.write({'content': 'Text updated'})
|
||||
|
||||
history_pages = history_document.search([('page_id', '=', page.id)])
|
||||
|
||||
with self.assertRaises(Exception) as context:
|
||||
show_diff_object.with_context(
|
||||
active_ids=[i.id for i in history_pages]
|
||||
).get_diff()
|
||||
|
||||
self.assertTrue(_("Select one or maximum two history revisions!")
|
||||
in context.exception)
|
||||
Reference in New Issue
Block a user