-
-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] helpdesk_mgmt_rating: Continue migration to 16.0
- Loading branch information
1 parent
5c3b561
commit 66cdb73
Showing
9 changed files
with
79 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
helpdesk_mgmt_rating/migrations/16.0.1.0.0/noupdate_changes.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ | |
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Víctor Martínez | ||
* Carolina Fernandez |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import test_helpdesk_mgmt_rating | ||
from . import test_helpdesk_portal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,23 @@ | ||
# Copyright 2022 Tecnativa - Víctor Martínez | ||
# Copyright 2024 Tecnativa - Carolina Fernandez | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo.tests import common, new_test_user | ||
from odoo.tests.common import users | ||
from odoo.tests.common import new_test_user, users | ||
|
||
from odoo.addons.base.tests.common import BaseCommon | ||
|
||
class TestHelpdeskMgmtRating(common.TransactionCase): | ||
|
||
class TestHelpdeskMgmtRating(BaseCommon): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.partner = cls.env["res.partner"].create( | ||
{"name": "Test partner", "email": "[email protected]"} | ||
) | ||
ctx = { | ||
"mail_create_nolog": True, | ||
"mail_create_nosubscribe": True, | ||
"mail_notrack": True, | ||
"no_reset_password": True, | ||
} | ||
new_test_user( | ||
cls.env, | ||
login="test-helpdesk-user", | ||
groups="helpdesk_mgmt.group_helpdesk_user", | ||
context=ctx, | ||
) | ||
cls.stage_done = cls.env.ref("helpdesk_mgmt.helpdesk_ticket_stage_done") | ||
cls.stage_done.rating_mail_template_id = cls.env.ref( | ||
|
@@ -46,3 +41,11 @@ def test_ticket_stage_done(self): | |
rating = ticket.rating_ids.filtered(lambda x: x.partner_id == self.partner) | ||
rating.write({"rating": 5, "consumed": True}) | ||
self.assertEqual(ticket.positive_rate_percentage, 100) | ||
# Check action view ticket rating | ||
action = ticket.action_view_ticket_rating() | ||
self.assertEqual(action.get("type"), "ir.actions.act_window") | ||
self.assertEqual(action.get("name"), "Ticket Rating") | ||
self.assertEqual( | ||
action.get("id"), | ||
self.env.ref("helpdesk_mgmt_rating.helpdesk_ticket_rating_action").id, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright 2024 Tecnativa - Carolina Fernandez | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
from odoo.addons.base.tests.common import HttpCaseWithUserPortal | ||
|
||
|
||
class TestHelpdeskPortalBase(HttpCaseWithUserPortal): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.partner = cls.env["res.partner"].create( | ||
{"name": "Test partner", "email": "[email protected]"} | ||
) | ||
cls.stage_done = cls.env.ref("helpdesk_mgmt.helpdesk_ticket_stage_done") | ||
cls.stage_done.rating_mail_template_id = cls.env.ref( | ||
"helpdesk_mgmt_rating.rating_ticket_email_template" | ||
) | ||
cls.ticket = cls.env["helpdesk.ticket"].create( | ||
{ | ||
"name": "Test 1", | ||
"description": "Ticket test", | ||
"partner_id": cls.partner.id, | ||
"stage_id": cls.stage_done.id, | ||
} | ||
) | ||
|
||
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") | ||
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") | ||
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") | ||
self.assertEqual(resp.status_code, 200) | ||
self.assertEqual(self.ticket.positive_rate_percentage, 0) |