mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[IMP] contract: Portal
This commit is contained in:
committed by
Jean-Charles Drubay
parent
e81ac3a4d3
commit
5d558019d3
@@ -1,3 +1,4 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import test_contract
|
||||
from . import test_portal
|
||||
|
||||
@@ -2302,3 +2302,8 @@ class TestContract(TestContractBase):
|
||||
# Assign same currency as computed one
|
||||
self.contract2.currency_id = currency_cad.id
|
||||
self.assertFalse(self.contract2.manual_currency_id)
|
||||
|
||||
def test_contract_action_preview(self):
|
||||
action = self.contract.action_preview()
|
||||
self.assertIn("/my/contracts/", action["url"])
|
||||
self.assertIn("access_token=", action["url"])
|
||||
|
||||
31
contract/tests/test_portal.py
Normal file
31
contract/tests/test_portal.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# Copyright 2020 Tecnativa - Víctor Martínez
|
||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl)
|
||||
|
||||
import odoo.tests
|
||||
from odoo import http
|
||||
|
||||
|
||||
@odoo.tests.tagged("post_install", "-at_install")
|
||||
class TestContractPortal(odoo.tests.HttpCase):
|
||||
def test_tour(self):
|
||||
partner = self.env["res.partner"].create({"name": "partner test contract"})
|
||||
contract = self.env["contract.contract"].create(
|
||||
{"name": "Test Contract", "partner_id": partner.id}
|
||||
)
|
||||
user_portal = self.env.ref("base.demo_user0")
|
||||
contract.message_subscribe(partner_ids=user_portal.partner_id.ids)
|
||||
self.phantom_js(
|
||||
"/",
|
||||
"odoo.__DEBUG__.services['web_tour.tour'].run('contract_portal_tour')",
|
||||
"odoo.__DEBUG__.services['web_tour.tour'].tours.contract_portal_tour.ready",
|
||||
login="portal",
|
||||
)
|
||||
# Contract access
|
||||
self.authenticate("portal", "portal")
|
||||
http.root.session_store.save(self.session)
|
||||
url_contract = "/my/contracts/{}?access_token={}".format(
|
||||
contract.id, contract.access_token,
|
||||
)
|
||||
self.assertEqual(self.url_open(url=url_contract).status_code, 200)
|
||||
contract.message_unsubscribe(partner_ids=user_portal.partner_id.ids)
|
||||
self.assertEqual(self.url_open(url=url_contract).status_code, 200)
|
||||
Reference in New Issue
Block a user