Skip to content

Commit

Permalink
Merge PR #667 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Dec 10, 2024
2 parents 497ff7b + 19ceb3b commit 48be3e6
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions helpdesk_mgmt_rating/tests/test_helpdesk_portal.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2024 Tecnativa - Carolina Fernandez
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import http

from odoo.addons.base.tests.common import HttpCaseWithUserPortal


Expand Down Expand Up @@ -27,22 +29,43 @@ def test_rating_satisfied_ticket(self):
"""Rate satisfied ticket from the portal."""
self.authenticate("portal", "portal")
portal_access_token = self.ticket._rating_get_access_token()
resp = self.url_open(f"/rate/{portal_access_token}/5")
resp = self.url_open(
f"/rate/{portal_access_token}/submit_feedback",
data={
"rate": 5,
"csrf_token": http.Request.csrf_token(self),
"feedback": "good",
},
)
self.assertEqual(resp.status_code, 200)
self.assertEqual(self.ticket.positive_rate_percentage, 100)

def test_rating_not_satisfied_ticket(self):
"""Rate not satisfied ticket from the portal."""
self.authenticate("portal", "portal")
portal_access_token = self.ticket._rating_get_access_token()
resp = self.url_open(f"/rate/{portal_access_token}/3")
resp = self.url_open(
f"/rate/{portal_access_token}/submit_feedback",
data={
"rate": 3,
"csrf_token": http.Request.csrf_token(self),
"feedback": "good",
},
)
self.assertEqual(resp.status_code, 200)
self.assertEqual(self.ticket.positive_rate_percentage, 0)

def test_rating_dissatisfied_ticket(self):
"""Rate highly dissatisfied ticket from the portal."""
self.authenticate("portal", "portal")
portal_access_token = self.ticket._rating_get_access_token()
resp = self.url_open(f"/rate/{portal_access_token}/1")
resp = self.url_open(
f"/rate/{portal_access_token}/submit_feedback",
data={
"rate": 1,
"csrf_token": http.Request.csrf_token(self),
"feedback": "bad job",
},
)
self.assertEqual(resp.status_code, 200)
self.assertEqual(self.ticket.positive_rate_percentage, 0)

0 comments on commit 48be3e6

Please sign in to comment.