Skip to content

Commit

Permalink
fixed test cases with login
Browse files Browse the repository at this point in the history
  • Loading branch information
Davit Lomauridze committed Jul 8, 2024
1 parent f6f107c commit 0946f54
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions document_page_portal/tests/test_document_page_portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,30 @@ def setUp(self):
"type": "content",
}
)
self.db = self.env.cr.dbname
self.login = self.portal_user.login
self.password = "admin"
self.user_agent_env = {}

def _login_portal_user(self):
self.env["res.users"].with_user(self.portal_user).sudo()._login(
self.db, self.login, self.password, self.user_agent_env
)

def test_prepare_portal_layout_values(self):
self.env["res.users"].with_user(self.portal_user).sudo()._login()
self._login_portal_user()
response = self.url_open("/my/knowledge/documents/")
self.assertEqual(response.status_code, 200)
self.assertIn("document_page_count", response.content.decode())

def test_portal_my_knowledge_document_pages(self):
self.env["res.users"].with_user(self.portal_user).sudo()._login()
self._login_portal_user()
response = self.url_open("/my/knowledge/documents/")
self.assertEqual(response.status_code, 200)
self.assertIn("document_pages", response.content.decode())

def test_document_pages_followup(self):
self.env["res.users"].with_user(self.portal_user).sudo()._login()
self._login_portal_user()
response = self.url_open(f"/knowledge/document/{self.document_page.id}")
self.assertEqual(response.status_code, 200)
self.assertIn("document_page", response.content.decode())
Expand Down

0 comments on commit 0946f54

Please sign in to comment.