Skip to content

Commit

Permalink
[FIX]reverted to older version
Browse files Browse the repository at this point in the history
  • Loading branch information
Davit Lomauridze committed Aug 13, 2024
1 parent 24cc431 commit 6a77f49
Showing 1 changed file with 0 additions and 58 deletions.
58 changes: 0 additions & 58 deletions document_page_portal/tests/test_document_page_portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,7 @@
import odoo.tests


@odoo.tests.tagged("post_install", "-at_install")
class TestPortalDocumentPage(odoo.tests.HttpCase):
def setUp(self):
super(TestPortalDocumentPage, self).setUp()
# Create some documents for testing
self.document_page_1 = self.env["document.page"].create(
{
"name": "Test Public Page 1",
"content": "Test content 1",
"is_public": True,
}
)
self.document_page_2 = self.env["document.page"].create(
{
"name": "Test Public Page 2",
"content": "Test content 2",
"is_public": True,
}
)
self.private_document_page = self.env["document.page"].create(
{
"name": "Test Private Page",
"content": "Test content 3",
"is_public": False,
}
)

def test_01_document_page_portal_tour(self):
# Test the portal tour with a public document
self.browser_js(
Expand All @@ -52,35 +26,3 @@ def test_02_document_page_portal_search_tour(self):
login="portal",
)

def test_03_view_specific_document_page(self):
# Test that a portal user can view a specific public document page
response = self.url_open(f"/knowledge/document/{self.document_page_1.id}")
self.assertEqual(response.status_code, 200)
self.assertIn("Test content 1", response.text)

def test_04_access_control_private_page(self):
# Test that a public user cannot view a private document page
response = self.url_open(f"/knowledge/document/{self.private_document_page.id}")
self.assertEqual(response.status_code, 403) # Forbidden

def test_05_document_page_sorting_and_pagination(self):
# Test sorting and pagination by creating multiple document pages
for i in range(10):
self.env["document.page"].create(
{
"name": f"Test Page {i}",
"content": f"Test content {i}",
"is_public": True,
}
)

response = self.url_open("/my/knowledge/documents?sortby=date&page=1")
self.assertEqual(response.status_code, 200)
# Check if the pages are sorted correctly by date or name
self.assertIn("Test Page 9", response.text)
self.assertNotIn("Test Page 0", response.text)

# Test the second page of the pagination
response = self.url_open("/my/knowledge/documents?sortby=date&page=2")
self.assertEqual(response.status_code, 200)
self.assertIn("Test Page 0", response.text)

0 comments on commit 6a77f49

Please sign in to comment.