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:
@@ -1,4 +1,5 @@
|
||||
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
|
||||
# Copyright 2016 Tecnativa - Carlos Dauden
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import test_contract
|
||||
from . import test_portal
|
||||
|
||||
@@ -169,6 +169,11 @@ class TestContract(TestContractBase):
|
||||
self.assertAlmostEqual(self.inv_line.price_subtotal, 50.0)
|
||||
self.assertEqual(self.contract.user_id, self.invoice_monthly.user_id)
|
||||
|
||||
def test_contract_action_preview(self):
|
||||
action = self.contract.action_preview()
|
||||
self.assertIn("/my/contracts/", action["url"])
|
||||
self.assertIn("access_token=", action["url"])
|
||||
|
||||
def test_contract_recurring_next_date(self):
|
||||
recurring_next_date = to_date('2018-01-15')
|
||||
self.assertEqual(
|
||||
|
||||
36
contract/tests/test_portal.py
Normal file
36
contract/tests/test_portal.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# 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/%s?access_token=%s" % (
|
||||
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