Skip to content

Commit

Permalink
[FIX]doument_page_portal: added test cases for controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Davit Lomauridze committed Aug 13, 2024
1 parent c8a0d76 commit 82ac68a
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions document_page_portal/controllers/portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,25 @@ def setUp(self):
)

def test_prepare_portal_layout_values(self):
# Test if document_page_count is correctly set in the portal layout values
self.document_page_model.create({"name": "Test Page 1", "type": "content"})
response = self.portal_controller()._prepare_portal_layout_values()
self.assertIn("document_page_count", response)
self.assertEqual(response["document_page_count"], 1)

Check warning on line 16 in document_page_portal/controllers/portal.py

View check run for this annotation

Codecov / codecov/patch

document_page_portal/controllers/portal.py#L13-L16

Added lines #L13 - L16 were not covered by tests

def test_get_archive_groups(self):
# Test if archive groups are correctly retrieved
self.document_page_model.create({"name": "Test Page 1", "type": "content"})
domain = [("type", "=", "content")]
groups = self.portal_controller()._get_archive_groups("document.page", domain)
self.assertTrue(groups)
self.assertEqual(groups[0]["name"], "Test Page 1")

Check warning on line 23 in document_page_portal/controllers/portal.py

View check run for this annotation

Codecov / codecov/patch

document_page_portal/controllers/portal.py#L19-L23

Added lines #L19 - L23 were not covered by tests

def test_portal_my_knowledge_document_pages(self):
# Test if the portal route for knowledge document pages works correctly
self.document_page_model.create({"name": "Test Page 1", "type": "content"})
response = self.url_open("/my/knowledge/documents/")
self.assertEqual(response.status_code, 200)
self.assertIn(b"Test Page 1", response.data)

Check warning on line 29 in document_page_portal/controllers/portal.py

View check run for this annotation

Codecov / codecov/patch

document_page_portal/controllers/portal.py#L26-L29

Added lines #L26 - L29 were not covered by tests

def test_document_pages_followup(self):
# Test if the follow-up route for a specific document page works correctly
document_page = self.document_page_model.create(

Check warning on line 32 in document_page_portal/controllers/portal.py

View check run for this annotation

Codecov / codecov/patch

document_page_portal/controllers/portal.py#L32

Added line #L32 was not covered by tests
{"name": "Test Page 1", "type": "content"}
)
Expand Down

0 comments on commit 82ac68a

Please sign in to comment.