Skip to content

Commit

Permalink
[FIX]doument_page_portal: added test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Davit Lomauridze committed Aug 13, 2024
1 parent 8fbfa74 commit 9e38a69
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions document_page_portal/tests/test_document_controller.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from unittest.mock import patch

from odoo.tests import common
from odoo.tests.common import tagged

Expand All @@ -17,18 +19,30 @@ def setUp(self):
}
)

def test_get_archive_groups(self):
def _mock_request(self):
mock_request = type("MockRequest", (), {})()
mock_request.env = self.env
mock_request.session = {}
return mock_request

@patch("odoo.http.request")
def test_get_archive_groups(self, mock_request):
mock_request.env = self.env
groups = self.customer_portal._get_archive_groups("document.page")
self.assertTrue(groups)

def test_document_page_get_page_view_values(self):
@patch("odoo.http.request")
def test_document_page_get_page_view_values(self, mock_request):
mock_request.env = self.env
mock_request.session = {}
values = self.customer_portal._document_page_get_page_view_values(
self.document_page, "test_token"
)
self.assertEqual(values["page_name"], "document_page")
self.assertEqual(values["document_page"], self.document_page)

def test_portal_my_knowledge_document_pages(self):
self.authenticate("admin", "admin")
response = self.url_open("/my/knowledge/documents/")
self.assertEqual(response.status_code, 200)

Expand All @@ -39,6 +53,7 @@ def test_portal_my_knowledge_document_pages(self):
self.assertEqual(response.status_code, 200)

def test_document_pages_followup(self):
self.authenticate("admin", "admin")
response = self.url_open(f"/knowledge/document/{self.document_page.id}")
self.assertEqual(response.status_code, 200)

Expand Down

0 comments on commit 9e38a69

Please sign in to comment.