test writed in python

This commit is contained in:
Gervais Naoussi
2015-12-08 13:00:05 +01:00
parent 1c72749157
commit fc556602cd
5 changed files with 71 additions and 55 deletions

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import test_document_page, test_document_page_history
from . import test_document_page_create_menu

View File

@@ -0,0 +1,30 @@
# -*- coding:utf-8 -*-
from openerp.tests import common
class TestDocumentPage(common.TransactionCase):
"""document_page test class."""
def test_page_creation(self):
"""Test page creation."""
parent_page = self.env.ref('document_page.demo_category1')
self.assertEqual(parent_page.name, 'OpenERP Features')
record = self.env['document.page'].create({
'name': 'Test Page1',
'parent_id': parent_page.id,
'content': 'Test content'
})
self.assertEqual(record.name, 'Test Page1')
def test_category_display_content(self):
"""Test category display content."""
page = self.env.ref('document_page.demo_category1')
self.assertTrue(page.display_content.find('Demo') > 1)
def test_page_display_content(self):
"""Test page display content."""
page = self.env.ref('document_page.demo_page1')
self.assertTrue(page.display_content.find('Demo') > 1)

View File

@@ -0,0 +1,20 @@
# -*- coding:utf-8 -*-
from openerp.tests import common
class TestDocumentPageCreateMenu(common.TransactionCase):
"""document_page_create_menu test class."""
def test_page_menu_creation(self):
"""Test page menu creation."""
menu_parent = self.env.ref('base.menu_base_partner')
menu_created = self.env['document.page.create.menu'].create({
'menu_name': 'Wiki Test menu',
'menu_parent_id': menu_parent.id
})
menu = self.env['document.page.create.menu'].search([('id', '=', menu_created.id)])
menu.with_context(active_id=[self.ref('document_page.demo_page1')]).document_page_menu_create()

View File

@@ -0,0 +1,17 @@
# -*- coding:utf-8 -*-
from openerp.tests import common
class TestDocumentPageHistory(common.TransactionCase):
"""document_page_history test class."""
def test_page_history_demo_page1(self):
"""Test page history demo page1."""
page = self.env.ref('document_page.demo_page1')
page.content = 'Test content updated'
history_document = self.env['document.page.history']
history_pages = history_document.search([('page_id', '=', page.id)])
history_document.with_context(
active_ids=[i.id for i in history_pages]
).get_diff()