From 432d141ce06e57c3a7355a6df4721927ac3f8c47 Mon Sep 17 00:00:00 2001 From: Gervais Naoussi Date: Thu, 10 Dec 2015 10:21:44 +0100 Subject: [PATCH] test improved --- document_page_approval/tests/__init__.py | 1 + .../tests/test_document_page_approval.py | 37 ++++++++++++++----- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/document_page_approval/tests/__init__.py b/document_page_approval/tests/__init__.py index 7efd37ec..4d55c4d9 100644 --- a/document_page_approval/tests/__init__.py +++ b/document_page_approval/tests/__init__.py @@ -1,2 +1,3 @@ """Module test initialisation.""" # -*- coding: utf-8 -*- +from . import test_document_page_approval diff --git a/document_page_approval/tests/test_document_page_approval.py b/document_page_approval/tests/test_document_page_approval.py index 2310fe3a..3181815c 100644 --- a/document_page_approval/tests/test_document_page_approval.py +++ b/document_page_approval/tests/test_document_page_approval.py @@ -1,16 +1,35 @@ """DocumentPageApproval test.""" # -*- coding: utf-8 -*- -from openerp.test.common import TransactionCase +from openerp.tests import common -class TestDocumentPageApproval(TransactionCase): +class TestDocumentPageApproval(common.TransactionCase): """Test document page approval model.""" - def setUp(self): - """Test setUp.""" - super() - pass + def test_get_display_content(self): + """Test page display content.""" + # Check content of a category + category = self.env['document.page'].search( + [('name', '=', 'OpenERP Features')]) - def __init__(self, arg): - """Test initialisation.""" - pass + self.assertIsNotNone(category.display_content, 'a category') + + # Check content of a page + pages = self.env['document.page'].search( + [('parent_id', '=', category.id)]) + page = pages[0] + self.assertIsNotNone(page.display_content, 'Page content') + + # Check if approval is required + self.assertFalse(page.is_approval_required(page)) + + # Check content of an approval page + page.approval_required = True + + self.assertIsNotNone(page.display_content, 'Page content') + + # Check if approval is required + self.assertTrue(page.is_approval_required(page)) + + # Check if parent approval is required + self.assertFalse(page.is_parent_approval_required)