-
-
Notifications
You must be signed in to change notification settings - Fork 597
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] pos_customer_screen_partner_location: Test is added.
- Loading branch information
Showing
4 changed files
with
53 additions
and
3 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
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 @@ | ||
from . import test_customer_screen |
45 changes: 45 additions & 0 deletions
45
pos_customer_screen_partner_location/tests/test_customer_screen.py
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,45 @@ | ||
# Copyright (C) 2024 Cetmix OÜ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo.tests import HttpCase, tagged | ||
|
||
|
||
@tagged("post_install", "-at_install") | ||
class TestCustomerScreen(HttpCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) | ||
cls.partner = cls.env["res.partner"].create({"name": "Test Partner"}) | ||
cls.pos_config = cls.env["pos.config"].create({"name": "Test Config"}) | ||
|
||
def test_customer_screen_location(self): | ||
self.authenticate("admin", "admin") | ||
|
||
resp_invalid = self.url_open( | ||
f"/customer_screen_location/0/{self.pos_config.id}/" | ||
) | ||
self.assertFalse(resp_invalid.ok, "Response must not be OK") | ||
self.assertEqual( | ||
resp_invalid.status_code, 400, "Response status code must be equal to 400" | ||
) | ||
|
||
resp_invalid = self.url_open(f"/customer_screen_location/{self.partner.id}/0/") | ||
self.assertFalse(resp_invalid.ok, "Response must not be OK") | ||
self.assertEqual( | ||
resp_invalid.status_code, 400, "Response status code must be equal to 400" | ||
) | ||
|
||
resp_invalid = self.url_open("/customer_screen_location/0/0/") | ||
self.assertFalse(resp_invalid.ok, "Response must not be OK") | ||
self.assertEqual( | ||
resp_invalid.status_code, 400, "Response status code must be equal to 400" | ||
) | ||
|
||
response = self.url_open( | ||
f"/customer_screen_location/{self.partner.id}/{self.pos_config.id}/" | ||
) | ||
self.assertTrue(response.ok, "Response must be OK") | ||
self.assertEqual( | ||
response.status_code, 200, "Response status code must be equal to 200" | ||
) |
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